ui: adding device-template item.
authorminkee.lee <minkee.lee@samsung.com>
Fri, 2 Oct 2015 10:11:51 +0000 (19:11 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 12 Oct 2015 02:03:36 +0000 (11:03 +0900)
- Add Display, Ram, Processor, Sensor, Device item.
  (UI only)

Change-Id: Id290c477165b9a1f6f5e3687f7cc1cc082e831bc
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
43 files changed:
resource/renewal/res/btn_checkbox_checked_hover.png [new file with mode: 0644]
resource/renewal/res/btn_checkbox_checked_nml.png [new file with mode: 0644]
resource/renewal/res/btn_checkbox_unchecked_hover.png [new file with mode: 0644]
resource/renewal/res/btn_checkbox_unchecked_nml.png [new file with mode: 0644]
src/org/tizen/emulator/manager/EmulatorManager.java
src/org/tizen/emulator/manager/handler/renewal/VMModifyHandler.java
src/org/tizen/emulator/manager/renewal/resources/ColorResources.java
src/org/tizen/emulator/manager/renewal/resources/FontResources.java
src/org/tizen/emulator/manager/renewal/resources/ImageResources.java
src/org/tizen/emulator/manager/renewal/resources/PatchImageResources.java
src/org/tizen/emulator/manager/ui/renewal/dialog/Dialog.java
src/org/tizen/emulator/manager/ui/renewal/dialog/DialogTitle.java
src/org/tizen/emulator/manager/ui/renewal/dialog/DragHandler.java
src/org/tizen/emulator/manager/ui/renewal/dialog/VMModifyDialog.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CheckBoxItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CheckBoxSubItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ComboItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/DeviceItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/DeviceTemplateItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/DisplayItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/IModifyDialogItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/IModifyDialogItem.java with 91% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ImageItem.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ModifyDialogItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ProcessorItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ProfileItem.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/RamSizeItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/SensorItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TextLabelItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/TextLabelItem.java with 80% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/VMNameItem.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/IconItemTitle.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/ItemTitle.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/ModifyItem.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/SubTreeItemTitle.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/SubTreeModifyItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/TreeItemTitle.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/TreeModifyItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/widgets/CheckBoxButton.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/widgets/ComboBox.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/widgets/ComboBoxPopup.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/widgets/CreateVMComboPopup.java
src/org/tizen/emulator/manager/ui/renewal/widgets/NinePatchBox.java
src/org/tizen/emulator/manager/ui/renewal/widgets/TextInputBox.java
src/org/tizen/emulator/manager/ui/renewal/widgets/WidgetHelper.java

diff --git a/resource/renewal/res/btn_checkbox_checked_hover.png b/resource/renewal/res/btn_checkbox_checked_hover.png
new file mode 100644 (file)
index 0000000..4581d09
Binary files /dev/null and b/resource/renewal/res/btn_checkbox_checked_hover.png differ
diff --git a/resource/renewal/res/btn_checkbox_checked_nml.png b/resource/renewal/res/btn_checkbox_checked_nml.png
new file mode 100644 (file)
index 0000000..37ee0e4
Binary files /dev/null and b/resource/renewal/res/btn_checkbox_checked_nml.png differ
diff --git a/resource/renewal/res/btn_checkbox_unchecked_hover.png b/resource/renewal/res/btn_checkbox_unchecked_hover.png
new file mode 100644 (file)
index 0000000..58a33bc
Binary files /dev/null and b/resource/renewal/res/btn_checkbox_unchecked_hover.png differ
diff --git a/resource/renewal/res/btn_checkbox_unchecked_nml.png b/resource/renewal/res/btn_checkbox_unchecked_nml.png
new file mode 100644 (file)
index 0000000..9ba0083
Binary files /dev/null and b/resource/renewal/res/btn_checkbox_unchecked_nml.png differ
index 40a884b..80dc6d4 100755 (executable)
@@ -51,8 +51,8 @@ import org.tizen.emulator.manager.resources.FilePathResources;
 import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.tool.CocoaUtil;
 import org.tizen.emulator.manager.tool.SettingInfoFile;
-import org.tizen.emulator.manager.ui.MainDialog;
 import org.tizen.emulator.manager.ui.dialog.MessageDialog;
+import org.tizen.emulator.manager.ui.renewal.MainDialog;
 import org.tizen.emulator.manager.vms.helper.WorkerLock;
 
 import com.sun.jna.Native;
@@ -155,7 +155,8 @@ public class EmulatorManager {
 
        private static void preare() {
                EmulatorManager.display = Display.getCurrent();
-               mainDialog = new MainDialog(mode);
+//             mainDialog = new MainDialog(mode);
+               mainDialog = new MainDialog();
        }
 
        private static void draw() {
index ca1e54c..4299d85 100644 (file)
@@ -37,10 +37,16 @@ import java.util.List;
 import org.eclipse.swt.SWT;
 import org.tizen.emulator.manager.ui.renewal.MainDialog;
 import org.tizen.emulator.manager.ui.renewal.dialog.VMModifyDialog;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.DeviceItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.DeviceTemplateItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.DisplayItem;
 import org.tizen.emulator.manager.ui.renewal.item.modify.vm.ImageItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.ProcessorItem;
 import org.tizen.emulator.manager.ui.renewal.item.modify.vm.ProfileItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.RamSizeItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.SensorItem;
 import org.tizen.emulator.manager.ui.renewal.item.modify.vm.VMNameItem;
-import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.IModifyDialogItem;
 import org.tizen.emulator.manager.vms.VMProperty;
 
 public class VMModifyHandler {
@@ -60,20 +66,30 @@ public class VMModifyHandler {
                }
        }
 
-       private static List<IModifyDialogItem> getItemList(VMProperty property) {
+       private static List<ModifyDialogItem> getItemList(VMProperty property) {
                // TODO make item list using Image's item-template
                return getTmpItemList();
 
        }
 
 
-       // FOR TEST
-       public static List<IModifyDialogItem> getTmpItemList() {
-               List<IModifyDialogItem> itemList = new ArrayList<IModifyDialogItem>();
+       // FOR TES
+       public static List<ModifyDialogItem> getTmpItemList() {
+               List<ModifyDialogItem> itemList = new ArrayList<ModifyDialogItem>();
 
                itemList.add(new VMNameItem());
                itemList.add(new ProfileItem());
                itemList.add(new ImageItem());
+               DeviceTemplateItem deviceItem = new DeviceTemplateItem();
+               itemList.add(deviceItem);
+               itemList.add(new DisplayItem(deviceItem.getTreeRoot()));
+               itemList.add(new RamSizeItem(deviceItem.getTreeRoot()));
+               itemList.add(new ProcessorItem(deviceItem.getTreeRoot()));
+               itemList.add(new SensorItem(deviceItem.getTreeRoot()));
+               itemList.add(new DeviceItem(deviceItem.getTreeRoot()));
+
+
+
                return itemList;
        }
 
index 16c1825..1b782a4 100644 (file)
@@ -37,6 +37,8 @@ public enum ColorResources {
        WHITE(255, 255, 255),
        BLACK(0, 0, 0),
        RED(255, 0, 0),
+       BLUE(0, 0, 255),
+       GREEN(0, 255, 0),
 
        // nine patch button
        GRAY_BTN_NORMAL(149, 159, 164),
index 6c3202a..d97a4ab 100644 (file)
@@ -48,7 +48,8 @@ public enum FontResources {
        MESSAGE_BOX_CONTENTS("msg_box_contents", resizeDefaultFont(9)),
 
        DEFAULT_FONT_10("default_font_10", resizeDefaultFont(10)),
-       DEFAULT_FONT_9("default_font_9", resizeDefaultFont(9));
+       DEFAULT_FONT_9("default_font_9", resizeDefaultFont(9)),
+       DEFAULT_FONT_8("default_font_8", resizeDefaultFont(8));
 
        public static FontResources MODIFY_ITEM_TITLE = DEFAULT_FONT_9;
        public static FontResources CONTENT = DEFAULT_FONT_9;
index 7ab25e4..ce9898d 100644 (file)
@@ -210,6 +210,22 @@ public enum ImageResources {
        ICON_TITLE_VMNAME("icon_title_vmname"),
        ICON_TITLE_IMAGE("icon_title_image"),
        ICON_TITLE_PROFILE("icon_title_profile"),
+       ICON_TITLE_DISPLAY("icon_title_display"),
+       ICON_TITLE_RAM("icon_title_ram"),
+       ICON_TITLE_DEVICE("icon_title_device"),
+       ICON_TITLE_EXTERNAL_INPUT("icon_title_externalinput"),
+       ICON_TITLE_FILESHARING("icon_title_filesharing"),
+       ICON_TITLE_HWSUPPORT("icon_title_hwsupport"),
+       ICON_TITLE_IMAGE_FILE("icon_title_imagefile"),
+       ICON_TITLE_JACK("icon_title_jack"),
+       ICON_TITLE_NETWORK("icon_title_network"),
+       ICON_TITLE_OCI_DEVICE("icon_title_ocidevice"),
+       ICON_TITLE_SENSOR("icon_title_sensor"),
+       ICON_TITLE_TUNER("icon_title_tuner"),
+       ICON_TITLE_VERSION("icon_title_version"),
+       ICON_TITLE_PROCESSOR("icon_title_processor"),
+       ICON_TITLE_TREE_EXPANDED("icon_title_tree_expanded"),
+       ICON_TITLE_TREE_CLOSED("icon_title_tree_closed"),
 
        // profile select button
        BTN_PROFILE_MOBILE_SELECTED("btn_profile_mobile_selected"),
@@ -220,8 +236,13 @@ public enum ImageResources {
        BTN_PROFILE_WEARABLEE_UNSELECTED_NML("btn_profile_wearable_unselected_nml"),
        BTN_PROFILE_TV_SELECTED("btn_profile_tv_selected"),
        BTN_PROFILE_TV_UNSELECTED_HOVER("btn_profile_tv_unselected_hover"),
-       BTN_PROFILE_TV_UNSELECTED_NML("btn_profile_tv_unselected_nml");
+       BTN_PROFILE_TV_UNSELECTED_NML("btn_profile_tv_unselected_nml"),
 
+       // checkbox
+       CHECKBOX_UNCHECKED_NML("btn_checkbox_unchecked_nml"),
+       CHECKBOX_UNCHECKED_HOVER("btn_checkbox_unchecked_hover"),
+       CHECKBOX_CHECKED_NML("btn_checkbox_checked_nml"),
+       CHECKBOX_CHECKED_HOVER("btn_checkbox_checked_hover");
 
        String name;
        Image image;
index 4aa820a..1bcb0b3 100644 (file)
@@ -65,18 +65,10 @@ public class PatchImageResources {
                return image;
        }
 
+       /** Image should be disposed by caller */
        public static Image getNinePatchButtonImage(int width, int height, NinePatchResourceInfo ninePatchImagesInfo) {
-               Image lt = ninePatchImagesInfo.getLeftTopImage().getImage();
-               Image t = ninePatchImagesInfo.getTopImage().getImage();
-               Image rt = ninePatchImagesInfo.getRightTopImage().getImage();
-               Image r = ninePatchImagesInfo.getRightImage().getImage();
-               Image rb = ninePatchImagesInfo.getRightBottomImage().getImage();
-               Image b = ninePatchImagesInfo.getBottomImage().getImage();
-               Image lb = ninePatchImagesInfo.getLeftBottomImage().getImage();
-               Image l = ninePatchImagesInfo.getLeftImage().getImage();
 
                Image image = new Image(Display.getCurrent(), width, height);
-
                GC gc = new GC(image);
                gc.setInterpolation(SWT.NONE);
 
@@ -85,7 +77,50 @@ public class PatchImageResources {
                gc.setBackground(transparentColor);
                gc.fillRectangle(0, 0, width, height);
 
-               // draw  background
+               drawNinePatchImage(gc, width, height, ninePatchImagesInfo);
+               gc.dispose();
+
+               // Make corner transparent
+               ImageData data = image.getImageData();
+               int cornerPixel = data.palette.getPixel(transparentColor.getRGB());
+               data.transparentPixel = cornerPixel;
+               Image cornerTransparentedImage = new Image(Display.getCurrent(), data);
+
+               // dispose original image
+               image.dispose();
+
+               return cornerTransparentedImage;
+       }
+
+
+       /** Image should be disposed by caller */
+       public static Image getComboPopupImage(int width, int height, NinePatchResourceInfo ninePatchImagesInfo) {
+               Image image = new Image(Display.getCurrent(), width, height);
+               GC gc = new GC(image);
+               gc.setInterpolation(SWT.NONE);
+
+               // Draw background
+               gc.setBackground(ColorResources.WHITE.getColor());
+               gc.fillRectangle(0, 0, width, height);
+
+               drawNinePatchImage(gc, width, height, ninePatchImagesInfo);
+
+               gc.dispose();
+
+               return image;
+       }
+
+       private static void drawNinePatchImage(GC gc, int width, int height, NinePatchResourceInfo ninePatchImagesInfo) {
+               Image lt = ninePatchImagesInfo.getLeftTopImage().getImage();
+               Image t = ninePatchImagesInfo.getTopImage().getImage();
+               Image rt = ninePatchImagesInfo.getRightTopImage().getImage();
+               Image r = ninePatchImagesInfo.getRightImage().getImage();
+               Image rb = ninePatchImagesInfo.getRightBottomImage().getImage();
+               Image b = ninePatchImagesInfo.getBottomImage().getImage();
+               Image lb = ninePatchImagesInfo.getLeftBottomImage().getImage();
+               Image l = ninePatchImagesInfo.getLeftImage().getImage();
+
+               // draw center
                gc.setBackground(ninePatchImagesInfo.getBackground().getColor());
                gc.fillRectangle(l.getImageData().width, t.getImageData().height,
                                width - l.getImageData().width - r.getImageData().width,
@@ -120,18 +155,5 @@ public class PatchImageResources {
                                width - lb.getImageData().width - rb.getImageData().width,
                                b.getImageData().height);
                gc.drawImage(rb, width - rb.getImageData().width, height - rb.getImageData().height);
-               gc.dispose();
-
-               // Make corner transparent
-               ImageData data = image.getImageData();
-               int cornerPixel = data.palette.getPixel(transparentColor.getRGB());
-               data.transparentPixel = cornerPixel;
-               Image cornerTransparentedImage = new Image(Display.getCurrent(), data);
-
-               // dispose original image
-               image.dispose();
-
-               return cornerTransparentedImage;
        }
-
 }
index 6acc923..a09efac 100644 (file)
@@ -31,6 +31,9 @@
 
 package org.tizen.emulator.manager.ui.renewal.dialog;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.PaintEvent;
 import org.eclipse.swt.events.PaintListener;
@@ -52,6 +55,7 @@ public class Dialog {
        private final int height;
        private final int buttonStyle;
 
+       private final List<Shell> childShell = new ArrayList<Shell>();
        private Composite bodyComp;
        private int returnValue = SWT.CANCEL;
 
@@ -85,6 +89,9 @@ public class Dialog {
                return shell;
        }
 
+       public void addChildShell(Shell shell) {
+               childShell.add(shell);
+       }
 
        public void setReturnValue(int returnValue) {
                this.returnValue = returnValue;
@@ -99,7 +106,7 @@ public class Dialog {
 
 
        private void makeDialog() {
-               DialogTitle.create(shell, title);
+               DialogTitle.create(shell, childShell, title);
                initBody();
                DialogButtons.create(this, buttonStyle);
        }
index 1f2c887..07d6c1c 100644 (file)
@@ -31,6 +31,8 @@
 
 package org.tizen.emulator.manager.ui.renewal.dialog;
 
+import java.util.List;
+
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.FormAttachment;
 import org.eclipse.swt.layout.FormData;
@@ -48,10 +50,10 @@ public class DialogTitle {
        private static final int TITLE_MARGIN_TOP = 7;
        private static final int TITLE_MARGIN_LEFT = 15;
 
-       public static void create(Shell parentDialog, String title) {
+       public static void create(Shell parentDialog, List<Shell> childShell, String title) {
                Composite titleComp = new Composite(parentDialog, SWT.NONE);
                initTitleComp(parentDialog, titleComp);
-               makeTitle(parentDialog, titleComp, title);
+               makeTitle(parentDialog, childShell, titleComp, title);
        }
 
 
@@ -70,7 +72,8 @@ public class DialogTitle {
        }
 
 
-       private static void makeTitle(Shell parentDialog, Composite titleComp, String title) {
+       private static void makeTitle(Shell parentDialog,
+                       List<Shell> childShell, Composite titleComp, String title) {
                // add title
                FormData data = new FormData();
                data.top = new FormAttachment(0, TITLE_MARGIN_TOP);
@@ -84,6 +87,6 @@ public class DialogTitle {
                titleLabel.setLayoutData(data);
 
                // make title drag-able
-               DragHandler.set(parentDialog, titleLabel, titleComp);
+               DragHandler.set(parentDialog, childShell, titleLabel, titleComp);
        }
 }
index 6ebd363..aa50a0a 100644 (file)
@@ -31,6 +31,8 @@
 
 package org.tizen.emulator.manager.ui.renewal.dialog;
 
+import java.util.List;
+
 import org.eclipse.swt.events.MouseEvent;
 import org.eclipse.swt.events.MouseListener;
 import org.eclipse.swt.events.MouseMoveListener;
@@ -49,15 +51,15 @@ public class DragHandler {
         * @param shell
         * @param controls to receive drag event.
         */
-       public static void set(Shell shell, Control... controls) {
+       public static void set(Shell shell, List<Shell> childShell, Control... controls) {
                DragHandler controller = new DragHandler();
-               controller.setTargetShell(shell);
+               controller.setTargetShell(shell, childShell);
                controller.setControls(controls);
        }
 
 
        // set dialog (shell)
-       private void setTargetShell(Shell shell) {
+       private void setTargetShell(Shell shell, List<Shell> childShell) {
                this.dialog = shell;
        }
 
index 4bb14ae..47eb65f 100644 (file)
@@ -40,18 +40,19 @@ import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.emulator.manager.renewal.resources.ColorResources;
-import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.IModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.ModifyDialogItem;
 import org.tizen.emulator.manager.vms.VMProperty;
 
 public class VMModifyDialog extends Dialog {
 
        private final static String TITLE = "VM Modify";
-       private final static int WIDTH = 484;
+       public final static int WIDTH = 484;
+//     private final static int WIDTH = 500;
        private final static int HEIGHT = 496;
        private final static int BUTTON_STYLE = SWT.OK | SWT.CANCEL;
 
        private Composite scrolledContent;
-       private List<IModifyDialogItem> itemList;
+       private List<ModifyDialogItem> itemList;
        private VMProperty property;
 
        public VMModifyDialog(Shell parent) {
@@ -59,7 +60,7 @@ public class VMModifyDialog extends Dialog {
        }
 
 
-       public void create(VMProperty property, List<IModifyDialogItem> itemList) {
+       public void create(VMProperty property, List<ModifyDialogItem> itemList) {
                // - create title, buttons
                // - init body
                super.create();
@@ -82,8 +83,9 @@ public class VMModifyDialog extends Dialog {
        }
 
        private void makeModifyItem() {
-               for (IModifyDialogItem item : itemList) {
-                       item.setItemData(property);
+               for (ModifyDialogItem item : itemList) {
+                       item.setParentDialog(this);
+                       item.setInitialValue(property);
                        item.create(scrolledContent);
                }
 
@@ -93,12 +95,16 @@ public class VMModifyDialog extends Dialog {
 
        private void computeScrolledContentSize() {
                int height = 0;
-               for (IModifyDialogItem item : itemList) {
+               for (ModifyDialogItem item : itemList) {
                        height += item.getHeight();
                }
                scrolledContent.setSize(WIDTH - Dialog.BORDER_WIDTH * 2, height);
        }
 
+       public void layoutScrolledComposite() {
+               computeScrolledContentSize();
+               scrolledContent.layout();
+       }
 
        private void initScrolledComposite() {
                // add scrolled-composite
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CheckBoxItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CheckBoxItem.java
new file mode 100644 (file)
index 0000000..ccd8126
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+
+import org.eclipse.swt.layout.GridData;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.ModifyItem;
+
+public abstract class CheckBoxItem extends ModifyDialogItem {
+
+       private final int ROW_HEIGHT = ModifyItem.ITEM_HEIGHT + ModifyItem.LINE_WIDTH;
+       private int rowNum;
+       private final int numColumns;
+
+       // TODO should be structures that have name, title
+       private final String[] checkBoxList;
+
+       public CheckBoxItem(int numColomn, String[] checkBoxList) {
+               this.numColumns = numColomn;
+               this.checkBoxList = checkBoxList;
+               initRowNum();
+       }
+
+
+       private void initRowNum() {
+               rowNum = checkBoxList.length / numColumns;
+               if (checkBoxList.length % numColumns != 0) {
+                       rowNum++;
+               }
+       }
+
+
+       protected int getContentHeight() {
+               return ROW_HEIGHT * rowNum;
+       }
+
+
+       protected void createCheckBoxItems(ModifyItem item) {
+               item.setBodyLayoutGrid(numColumns);
+
+               CheckBoxSubItem checkBoxItem;
+               for (int i=0 ; i < checkBoxList.length ; i++) {
+                       String sensor = checkBoxList[i];
+                       checkBoxItem = new CheckBoxSubItem(item.getBody(), sensor, sensor);
+
+                       // set checkbox item layout
+                       GridData data = new GridData();
+                       data.heightHint = ROW_HEIGHT;
+                       data.widthHint = ModifyItem.BODY_CONTENT_WIDTH / numColumns;
+                       checkBoxItem.create(data);
+               }
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CheckBoxSubItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CheckBoxSubItem.java
new file mode 100644 (file)
index 0000000..4c0f20f
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ColorResources;
+import org.tizen.emulator.manager.renewal.resources.FontResources;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.widgets.CheckBoxButton;
+
+public class CheckBoxSubItem {
+       private final Composite parentComp;
+       private final String name;
+       private final String title;
+       private boolean isChecked;
+       private Composite comp;
+       private CheckBoxButton checkBox; // TODO
+
+       public static final int CHECK_BOX_WIDTH = 15;
+       private final int CHECK_BOX_HEIGHT = 14;
+       public static final int SPACING = 2;
+
+       private final int ROW_HEIGHT = ModifyItem.ITEM_HEIGHT + ModifyItem.LINE_WIDTH;
+
+       public CheckBoxSubItem(Composite parentComp, String name, String title) {
+               this.parentComp = parentComp;
+               this.name = name;
+               this.title = title;
+       }
+
+       public void create(Object layoutData) {
+               // init comp
+               comp = new Composite(parentComp, SWT.NONE);
+               comp.setLayoutData(layoutData);
+               comp.setLayout(new FormLayout());
+
+               createCheckBox();
+               drawTitle();
+       }
+
+
+       private void createCheckBox() {
+
+               FormData data = new FormData(CHECK_BOX_WIDTH, CHECK_BOX_HEIGHT);
+               data.left = new FormAttachment(0, 0);
+               data.top = new FormAttachment(0, (ROW_HEIGHT - CHECK_BOX_HEIGHT) / 2 );
+
+               // TODO change to checkBoxWidget
+               checkBox = new CheckBoxButton(comp, SWT.NONE);
+               checkBox.setLayoutData(data);
+
+       }
+
+
+       private void drawTitle() {
+               comp.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               GC gc = e.gc;
+                               gc.setForeground(ColorResources.CONTENT_FONT.getColor());
+                               gc.setFont(FontResources.CONTENT.getFont());
+
+                               int itemHeight = ((Composite)e.widget).getBounds().height;
+                               Point textExt = gc.textExtent(title);
+                               int posY = (itemHeight - textExt.y) / 2;
+
+                               gc.drawText(title, CHECK_BOX_WIDTH + SPACING, posY);
+                       }
+               });
+
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ComboItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ComboItem.java
new file mode 100644 (file)
index 0000000..0e08d6f
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.widgets.ComboBox;
+
+
+public abstract class ComboItem extends ModifyDialogItem {
+
+       private ComboBox comboBox;
+
+       protected void createCombo(ModifyItem item, int width) {
+//             item.setBodyLayoutDefault();
+//
+//             // create combo widget
+//             GridData data = new GridData(width, COMBO_HEIGHT);
+//             data.grabExcessVerticalSpace = true;
+//             data.verticalAlignment = SWT.CENTER;
+
+               item.getBody().setLayout(new FormLayout());
+               FormData data = new FormData();
+               data.left = new FormAttachment(0, ModifyItem.BODY_MARGIN_LEFT);
+               data.top = new FormAttachment(0, ModifyItem.WIDGET_TOP);
+               data.width = width;
+               data.height = ModifyItem.WIDGET_HEIGHT;
+               comboBox = new ComboBox(getParentDialog().getShell(), item.getBody(), SWT.NONE);
+               comboBox.setLayoutData(data);
+               addSelectionListener();
+       }
+
+
+       private void addSelectionListener() {
+               Listener listener = new Listener() {
+                       @Override
+                       public void handleEvent(Event event) {
+                               switch(event.type) {
+                               case SWT.Selection:
+                                       itemSelected(comboBox);
+
+                               default:
+                                               break;
+                               }
+
+                       }
+               };
+               comboBox.addListener(SWT.Selection, listener);
+       }
+
+       public void itemSelected(ComboBox comboBox) {
+               // This is called when combo item is selected
+               // TODO override this.
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/DeviceItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/DeviceItem.java
new file mode 100644 (file)
index 0000000..5ea947b
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.SubTreeItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.SubTreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.TreeModifyItem;
+import org.tizen.emulator.manager.vms.VMProperty;
+
+public class DeviceItem extends CheckBoxItem {
+
+       private final SubTreeModifyItem item;
+
+       private final String TITLE = "Device";
+       private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_DEVICE;
+
+       private static final int NUM_COLUMN = 3;
+
+       // TODO load sensor list
+       private static final String[] sensorList = new String[]{"NFC", "Camera"};
+
+       public DeviceItem(TreeModifyItem treeRoot) {
+               super(NUM_COLUMN, sensorList);
+               item = new SubTreeModifyItem();
+               item.setItemHeight(getContentHeight());
+               treeRoot.addSubItem(item);
+       }
+
+
+       @Override
+       public void create(Composite parent) {
+               item.init(parent);
+               item.setItemTitle(new SubTreeItemTitle(item.getItemComp(), TITLE, TITLE_ICON_RESOURCE));
+               item.create();
+
+               createCheckBoxItems(item);
+
+       }
+
+       @Override
+       public int getHeight() {
+               return item.getHeight();
+       }
+
+       @Override
+       public void setInitialValue(VMProperty property) {
+               // TODO Auto-generated method stub
+
+       }
+
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/DeviceTemplateItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/DeviceTemplateItem.java
new file mode 100644 (file)
index 0000000..9d837bc
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.TreeItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.TreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.widgets.ComboBox;
+import org.tizen.emulator.manager.vms.VMProperty;
+
+public class DeviceTemplateItem extends ComboItem {
+
+       private final String TITLE = "Device";
+       private final TreeModifyItem item;
+
+       private final int COMBO_WIDTH = 200;
+
+       public TreeModifyItem getTreeRoot() {
+               return item;
+       }
+
+       public DeviceTemplateItem() {
+               item = new TreeModifyItem();
+       }
+
+       @Override
+       public void create(Composite parent) {
+               item.init(parent);
+               item.setItemTitle(new TreeItemTitle(item, TITLE));
+               item.create();
+
+               item.setModifyDialogItem(this);
+
+               createCombo(item, COMBO_WIDTH);
+       }
+
+       @Override
+       public int getHeight() {
+               return item.getHeight();
+       }
+
+       @Override
+       public void setInitialValue(VMProperty property) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void itemSelected(ComboBox comboBox) {
+               // TODO change item list for selected template.
+               System.out.println("item selected:" + comboBox.getSelectedItem());
+
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/DisplayItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/DisplayItem.java
new file mode 100644 (file)
index 0000000..c1595b5
--- /dev/null
@@ -0,0 +1,213 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.SubTreeItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.SubTreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.TreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.widgets.ComboBox;
+import org.tizen.emulator.manager.ui.renewal.widgets.TextInputBox;
+import org.tizen.emulator.manager.ui.renewal.widgets.WidgetHelper;
+import org.tizen.emulator.manager.vms.VMProperty;
+
+public class DisplayItem extends ModifyDialogItem {
+
+       private final SubTreeModifyItem item;
+
+       private final String TITLE = "Display";
+       private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_DISPLAY;
+
+       private final int ROW_HEIGHT = ModifyItem.ITEM_HEIGHT + ModifyItem.LINE_WIDTH;
+       private final int ROW_NUM = 4;
+
+       public DisplayItem(TreeModifyItem treeRoot) {
+               item = new SubTreeModifyItem();
+               item.setItemHeight(ROW_HEIGHT * ROW_NUM);
+               treeRoot.addSubItem(item);
+       }
+
+       @Override
+       public void create(Composite parent) {
+               item.init(parent);
+               item.setItemTitle(new SubTreeItemTitle(item.getItemComp(), TITLE, TITLE_ICON_RESOURCE));
+               item.create();
+
+               item.setBodyLayoutDefault();
+               createResolutionComboItem();
+               createResolutionTextItem();
+               createSizeItem();
+               createSkinItem();
+       }
+
+
+       @Override
+       public int getHeight() {
+               return item.getHeight();
+       }
+
+
+       @Override
+       public void setInitialValue(VMProperty property) {
+
+       }
+
+
+       private final String TITLE_RESOLUTION = "Resolution";
+       private final String TITLE_SIZE = "Size";
+       private final String TITLE_SKIN = "Skin";
+
+       private final int BODY_MARGIN_LEFT = 66;
+
+       private final int COMBO_WIDTH = 134;
+       private final int TEXT_BOX_WIDTH = 58;
+       private final int RESOLUTION_TEXT_BOX_SPACING = 18;
+       private final int WIDGET_TOP = (ROW_HEIGHT - ModifyItem.WIDGET_HEIGHT) / 2;
+
+
+       private ComboBox resolutionCombo = null;
+       private TextInputBox widthTextBox = null;
+       private TextInputBox heightTextBox = null;
+       private TextInputBox sizeTextBox = null;
+       private ComboBox skinCombo = null;
+
+
+       private void createResolutionComboItem() {
+               Composite comp = createSubComp(1, TITLE_RESOLUTION);
+
+               FormData data = new FormData();
+               data.left = new FormAttachment(0, BODY_MARGIN_LEFT);
+               data.top = new FormAttachment(0, WIDGET_TOP);
+               data.width = COMBO_WIDTH;
+               data.height = ModifyItem.WIDGET_HEIGHT;
+               resolutionCombo = new ComboBox(getParentDialog().getShell(), comp, SWT.NONE);
+               resolutionCombo.setLayoutData(data);
+
+       }
+
+       private void createResolutionTextItem() {
+               Composite comp = createSubComp(1, "");
+
+               // width
+               FormData data = new FormData();
+               data.left = new FormAttachment(0, BODY_MARGIN_LEFT);
+               data.top = new FormAttachment(0, WIDGET_TOP);
+               data.width = TEXT_BOX_WIDTH;
+               data.height = ModifyItem.WIDGET_HEIGHT;
+               widthTextBox = new TextInputBox(comp, SWT.NONE);
+               widthTextBox.setLayoutData(data);
+
+               // "x" label
+               data = new FormData();
+               data.left = new FormAttachment(widthTextBox, 0);
+               data.top = new FormAttachment(0, WIDGET_TOP);
+               data.width = RESOLUTION_TEXT_BOX_SPACING;
+               data.height = ModifyItem.WIDGET_HEIGHT;
+               Canvas canvas = new Canvas(comp, SWT.NONE);
+               canvas.setLayoutData(data);
+               WidgetHelper.drawText(canvas, "x", SWT.CENTER);
+
+
+               // height
+               data = new FormData();
+               data.left = new FormAttachment(widthTextBox, RESOLUTION_TEXT_BOX_SPACING);
+               data.top = new FormAttachment(0, WIDGET_TOP);
+               data.width = TEXT_BOX_WIDTH;
+               data.height = ModifyItem.WIDGET_HEIGHT;
+               heightTextBox = new TextInputBox(comp, SWT.NONE);
+               heightTextBox.setLayoutData(data);
+
+       }
+
+
+       private void createSizeItem() {
+               Composite comp = createSubComp(1, TITLE_SIZE);
+
+               // text box
+               FormData data = new FormData();
+               data.left = new FormAttachment(0, BODY_MARGIN_LEFT);
+               data.top = new FormAttachment(0, WIDGET_TOP);
+               data.width = TEXT_BOX_WIDTH;
+               data.height = ModifyItem.WIDGET_HEIGHT;
+               sizeTextBox = new TextInputBox(comp, SWT.NONE);
+               sizeTextBox.setLayoutData(data);
+
+               // "inch" label
+               data = new FormData();
+               data.left = new FormAttachment(sizeTextBox, 6);
+               data.top = new FormAttachment(0, WIDGET_TOP);
+               data.width = 30; // rough guess
+               data.height = ModifyItem.WIDGET_HEIGHT;
+               Canvas canvas = new Canvas(comp, SWT.NONE);
+               canvas.setLayoutData(data);
+               WidgetHelper.drawText(canvas, "inch", SWT.NONE);
+       }
+
+
+       private void createSkinItem() {
+               Composite comp = createSubComp(1, TITLE_SKIN);
+
+               FormData data = new FormData();
+               data.left = new FormAttachment(0, BODY_MARGIN_LEFT);
+               data.top = new FormAttachment(0, WIDGET_TOP);
+               data.width = COMBO_WIDTH;
+               data.height = ModifyItem.WIDGET_HEIGHT;
+               skinCombo = new ComboBox(getParentDialog().getShell(), comp, SWT.NONE);
+               skinCombo.setLayoutData(data);
+       }
+
+
+       private Composite createSubComp(int rowNum, String title) {
+               GridData data = new GridData();
+               data.grabExcessHorizontalSpace = true;
+               data.horizontalAlignment = SWT.FILL;
+               data.heightHint = ROW_HEIGHT * rowNum;
+
+               Composite comp = new Composite(item.getBody(), SWT.NONE);
+               comp.setLayoutData(data);
+               comp.setLayout(new FormLayout());
+
+               WidgetHelper.drawText(comp, title, SWT.NONE);
+               return comp;
+       }
+
+
+
+}
@@ -27,7 +27,7 @@
  * - S-Core Co., Ltd
  *
  */
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common;
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
 
 import org.eclipse.swt.widgets.Composite;
 import org.tizen.emulator.manager.vms.VMProperty;
@@ -39,5 +39,5 @@ public interface IModifyDialogItem {
        /** To decide modify dialog */
        public int getHeight();
 
-       public void setItemData(VMProperty property);
+       public void setInitialValue(VMProperty property);
 }
index bdad2df..030e3e5 100644 (file)
@@ -32,7 +32,6 @@ package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
 
 import org.eclipse.swt.widgets.Composite;
 import org.tizen.emulator.manager.renewal.resources.ImageResources;
-import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.TextLabelItem;
 import org.tizen.emulator.manager.vms.VMProperty;
 
 public class ImageItem extends TextLabelItem {
@@ -46,7 +45,7 @@ public class ImageItem extends TextLabelItem {
        }
 
        @Override
-       public void setItemData(VMProperty property) {
+       public void setInitialValue(VMProperty property) {
                if (property == null) {
                        return;
                }
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ModifyDialogItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ModifyDialogItem.java
new file mode 100644 (file)
index 0000000..e4fa35a
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+
+import org.tizen.emulator.manager.ui.renewal.dialog.VMModifyDialog;
+
+public abstract class ModifyDialogItem implements IModifyDialogItem {
+       private VMModifyDialog parentDialog;
+
+       public VMModifyDialog getParentDialog() {
+               return parentDialog;
+       }
+
+       public void setParentDialog(VMModifyDialog parentDialog) {
+               this.parentDialog = parentDialog;
+       }
+
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ProcessorItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ProcessorItem.java
new file mode 100644 (file)
index 0000000..eccfa50
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.SubTreeItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.SubTreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.TreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.widgets.ComboBox;
+import org.tizen.emulator.manager.vms.VMProperty;
+
+public class ProcessorItem extends ComboItem {
+
+       private final SubTreeModifyItem item;
+
+       private final String TITLE = "Processor";
+       private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_PROCESSOR;
+       private final int COMBO_WIDTH = 124;
+
+       public ProcessorItem(TreeModifyItem treeRoot) {
+               item = new SubTreeModifyItem();
+               treeRoot.addSubItem(item);
+       }
+
+       @Override
+       public void create(Composite parent) {
+               item.init(parent);
+               item.setItemTitle(new SubTreeItemTitle(item.getItemComp(), TITLE, TITLE_ICON_RESOURCE));
+               item.create();
+
+               createCombo(item, COMBO_WIDTH);
+
+       }
+
+       @Override
+       public int getHeight() {
+               return item.getHeight();
+       }
+
+       @Override
+       public void setInitialValue(VMProperty property) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void itemSelected(ComboBox comboBox) {
+               // TODO change item list for selected template.
+               System.out.println("item selected:" + comboBox.getSelectedItem());
+
+       }
+}
index bae93d2..7c2f10d 100644 (file)
@@ -36,11 +36,11 @@ import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Canvas;
 import org.eclipse.swt.widgets.Composite;
 import org.tizen.emulator.manager.renewal.resources.ImageResources;
-import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.IModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.IconItemTitle;
 import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.ModifyItem;
 import org.tizen.emulator.manager.vms.VMProperty;
 
-public class ProfileItem implements IModifyDialogItem {
+public class ProfileItem extends ModifyDialogItem {
 
        private ModifyItem item;
        private Canvas canvas;
@@ -87,7 +87,7 @@ public class ProfileItem implements IModifyDialogItem {
        }
 
        @Override
-       public void setItemData(VMProperty property) {
+       public void setInitialValue(VMProperty property) {
                if (property == null) {
                        return;
                }
@@ -102,7 +102,11 @@ public class ProfileItem implements IModifyDialogItem {
 
        @Override
        public void create(Composite parent) {
-               item = new ModifyItem(parent, TITLE, TITLE_ICON_RESOURCE);
+               item = new ModifyItem();
+               item.init(parent);
+               item.setItemTitle(new IconItemTitle(item.getItemComp(), TITLE, TITLE_ICON_RESOURCE));
+               item.create();
+
                addProfileImage();
        }
 }
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/RamSizeItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/RamSizeItem.java
new file mode 100644 (file)
index 0000000..beab76f
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.SubTreeItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.SubTreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.TreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.widgets.WidgetHelper;
+import org.tizen.emulator.manager.vms.VMProperty;
+
+public class RamSizeItem extends ComboItem {
+
+       private final SubTreeModifyItem item;
+
+       private final String TITLE = "Ram";
+       private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_RAM;
+       private final int COMBO_WIDTH = 124;
+
+       public RamSizeItem(TreeModifyItem treeRoot) {
+               item = new SubTreeModifyItem();
+               treeRoot.addSubItem(item);
+       }
+
+       @Override
+       public void create(Composite parent) {
+               item.init(parent);
+               item.setItemTitle(new SubTreeItemTitle(item.getItemComp(), TITLE, TITLE_ICON_RESOURCE));
+               item.create();
+
+               createCombo(item, COMBO_WIDTH);
+               addLabel();
+       }
+
+       private void addLabel() {
+               FormData data = new FormData();
+               int left = ModifyItem.BODY_MARGIN_LEFT + COMBO_WIDTH + 6;
+               data.left = new FormAttachment(0, left);
+               data.top = new FormAttachment(0, ModifyItem.WIDGET_TOP);
+               data.width = 30; // rough guess
+               data.height = ModifyItem.WIDGET_HEIGHT;
+
+               Canvas canvas = new Canvas(item.getBody(), SWT.NONE);
+               canvas.setLayoutData(data);
+               WidgetHelper.drawText(canvas, "MB", SWT.NONE);
+       }
+
+       @Override
+       public int getHeight() {
+               return item.getHeight();
+       }
+
+       @Override
+       public void setInitialValue(VMProperty property) {
+               // TODO Auto-generated method stub
+
+       }
+
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/SensorItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/SensorItem.java
new file mode 100644 (file)
index 0000000..2b5bbab
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.SubTreeItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.SubTreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.TreeModifyItem;
+import org.tizen.emulator.manager.vms.VMProperty;
+
+public class SensorItem extends CheckBoxItem {
+
+       private final SubTreeModifyItem item;
+
+       private final String TITLE = "Sensor";
+       private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_SENSOR;
+
+       private static final int NUM_COLUMN = 3;
+
+       // TODO load sensor list
+       private static final String[] sensorList = new String[]{"Accelerometer", "Gyroscope", "Geo-magnetic",
+                       "Proximity", "Light", "Haptic", "Pressure"};
+
+       public SensorItem(TreeModifyItem treeRoot) {
+               super(NUM_COLUMN, sensorList);
+               item = new SubTreeModifyItem();
+               item.setItemHeight(getContentHeight());
+               treeRoot.addSubItem(item);
+       }
+
+
+       @Override
+       public void create(Composite parent) {
+               item.init(parent);
+               item.setItemTitle(new SubTreeItemTitle(item.getItemComp(), TITLE, TITLE_ICON_RESOURCE));
+               item.create();
+
+               createCheckBoxItems(item);
+
+       }
+
+       @Override
+       public int getHeight() {
+               return item.getHeight();
+       }
+
+       @Override
+       public void setInitialValue(VMProperty property) {
+               // TODO Auto-generated method stub
+
+       }
+
+
+
+}
@@ -29,7 +29,7 @@
  */
 
 
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common;
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.PaintEvent;
@@ -42,8 +42,10 @@ import org.eclipse.swt.widgets.Composite;
 import org.tizen.emulator.manager.renewal.resources.ColorResources;
 import org.tizen.emulator.manager.renewal.resources.FontResources;
 import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.IconItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.ModifyItem;
 
-public abstract class TextLabelItem implements IModifyDialogItem {
+public abstract class TextLabelItem extends ModifyDialogItem {
 
        private ModifyItem item;
        private Canvas canvas;
@@ -55,8 +57,12 @@ public abstract class TextLabelItem implements IModifyDialogItem {
                return item.getHeight();
        }
 
-       protected void create(Composite parent, String title, ImageResources iconResources) {
-               item = new ModifyItem(parent, title, iconResources);
+       protected void create(Composite parent, String title, ImageResources iconResource) {
+               item = new ModifyItem();
+               item.init(parent);
+               item.setItemTitle(new IconItemTitle(item.getItemComp(), title, iconResource));
+               item.create();
+
                makeBody();
        }
 
@@ -65,16 +71,16 @@ public abstract class TextLabelItem implements IModifyDialogItem {
 
                // init canvas;
                GridData data = new GridData();
-               data.heightHint = ModifyItem.ITEM_HEIGHT;
+               data.heightHint = getHeight() - ModifyItem.LINE_WIDTH;
                data.horizontalAlignment = SWT.FILL;
                data.grabExcessHorizontalSpace = true;
                canvas = new Canvas(item.getBody(), SWT.NONE);
                canvas.setLayoutData(data);
 
-               drawImageName();
+               drawText();
        }
 
-       private void drawImageName() {
+       private void drawText() {
                canvas.addPaintListener(new PaintListener() {
 
                        @Override
@@ -83,7 +89,7 @@ public abstract class TextLabelItem implements IModifyDialogItem {
                                gc.setForeground(ColorResources.CONTENT_FONT.getColor());
                                gc.setFont(FontResources.CONTENT.getFont());
                                Point textExt = gc.textExtent(value);
-                               int poxY = (ModifyItem.ITEM_HEIGHT - textExt.y) / 2;
+                               int poxY = (getHeight() - textExt.y) / 2;
                                gc.drawText(value, 0, poxY);
                        }
                });
index 3121ce6..96e699f 100644 (file)
@@ -32,7 +32,6 @@ package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
 
 import org.eclipse.swt.widgets.Composite;
 import org.tizen.emulator.manager.renewal.resources.ImageResources;
-import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.TextLabelItem;
 import org.tizen.emulator.manager.vms.VMProperty;
 
 public class VMNameItem extends TextLabelItem {
@@ -46,7 +45,7 @@ public class VMNameItem extends TextLabelItem {
        }
 
        @Override
-       public void setItemData(VMProperty property) {
+       public void setInitialValue(VMProperty property) {
                if (property == null) {
                        return;
                }
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/IconItemTitle.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/IconItemTitle.java
new file mode 100644 (file)
index 0000000..0662b2f
--- /dev/null
@@ -0,0 +1,49 @@
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ColorResources;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+
+public class IconItemTitle extends ItemTitle {
+
+       private Canvas iconCanvas;
+       private final ImageResources iconResource;
+
+       private static int TITLE_MARGIN_LEFT = 15;
+       private static ColorResources background = ColorResources.MODIFY_ITEM_TITLE_BACKGROUND;
+
+       public IconItemTitle(Composite parent, String title, ImageResources iconResource) {
+               super(parent, title, TITLE_MARGIN_LEFT, background);
+               this.iconResource = iconResource;
+       }
+
+       @Override
+       public void create() {
+               super.create();
+               makeIcon();
+       }
+
+       private void makeIcon() {
+               // init
+               GridData data = new GridData(ICON_WIDTH, ICON_HEIGHT);
+               data.verticalAlignment = SWT.CENTER;
+               data.grabExcessVerticalSpace = true;
+               iconCanvas = new Canvas(this, SWT.NONE);
+               iconCanvas.setLayoutData(data);
+
+               // draw icon
+               iconCanvas.addPaintListener(new PaintListener() {
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               GC gc = e.gc;
+                               gc.drawImage(iconResource.getImage(), 0, 0);
+                       }
+               });
+       }
+}
index 7475f8d..dff5962 100644 (file)
@@ -34,66 +34,66 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.PaintEvent;
 import org.eclipse.swt.events.PaintListener;
 import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Canvas;
 import org.eclipse.swt.widgets.Composite;
 import org.tizen.emulator.manager.renewal.resources.ColorResources;
 import org.tizen.emulator.manager.renewal.resources.FontResources;
-import org.tizen.emulator.manager.renewal.resources.ImageResources;
 
 public class ItemTitle extends Canvas{
 
-       private final int TITLE_MARGIN_LEFT = 15;
        private final int TITLE_SPACING = 8;
-       private final int TITLE_CANVAS_WIDTH = 144;
+//     private final int TITLE_CANVAS_WIDTH = 144;
+       public static final int TITLE_CANVAS_WIDTH = 130;
        private final int LINE_INDENT = 5;
 
-       private final String title;
-       private Image titleIcon;
-       private final ImageResources titleIconResource;
+       protected int ICON_WIDTH = 18;
+       protected final int ICON_HEIGHT = 18;
 
+       private final String title;
+       private int marginLeft = 0;
+       private final ColorResources background;
 
-       public ItemTitle(Composite parent, String title, ImageResources titleIconResources) {
+       public ItemTitle(Composite parent, String title, int marginLeft, ColorResources background) {
                super(parent, SWT.NONE);
                this.title = title;
-               this.titleIconResource = titleIconResources;
-
+               this.marginLeft = marginLeft;
+               this.background = background;
        }
 
-       public void create() {
-               initTitle();
+       protected void create() {
+               init();
                makeTitle();
        }
 
-       private void initTitle() {
+       private void init() {
                GridData data = new GridData();
                data.grabExcessVerticalSpace = true;
-               data.verticalAlignment = GridData.FILL;
+               data.verticalAlignment = SWT.FILL;
                data.widthHint = TITLE_CANVAS_WIDTH;
                this.setLayoutData(data);
-               this.setBackground(ColorResources.MODIFY_ITEM_TITLE_BACKGROUND.getColor());
+               this.setBackground(background.getColor());
+               this.setBackgroundMode(SWT.INHERIT_FORCE);
+
+               // layout
+               GridLayout layout = new GridLayout();
+               layout.numColumns = 1;
+               layout.marginWidth = marginLeft;
+               this.setLayout(layout);
        }
 
 
+
        private void makeTitle() {
-               // draw icon, title
+               // draw title, under line
                this.addPaintListener(new PaintListener() {
 
                        @Override
                        public void paintControl(PaintEvent e) {
                                GC gc = e.gc;
-                               int itemHeight = ModifyItem.ITEM_HEIGHT;
-
-                               // draw icon
-                               if (titleIcon == null) {
-                                       titleIcon = titleIconResource.getImage();
-                               }
-                               ImageData imageData = titleIcon.getImageData();
-                               int iconY = (itemHeight - imageData.height) / 2;
-                               gc.drawImage(titleIcon, TITLE_MARGIN_LEFT, iconY);
+                               int itemHeight = ((Canvas)e.widget).getBounds().height - ModifyItem.LINE_WIDTH;
 
                                // draw text
                                gc.setForeground(ColorResources.MODIFY_ITEM_TITLE.getColor());
@@ -101,7 +101,7 @@ public class ItemTitle extends Canvas{
                                Point textExt = gc.textExtent(title);
                                int titleY = (itemHeight - textExt.y) / 2;
                                gc.drawText(title,
-                                               TITLE_MARGIN_LEFT + imageData.width + TITLE_SPACING, titleY);
+                                               marginLeft + ICON_WIDTH + TITLE_SPACING, titleY);
 
                                // draw under line
                                int lineWidth = ModifyItem.LINE_WIDTH;
index 23e0bac..aa92ec5 100644 (file)
@@ -9,7 +9,7 @@ import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.tizen.emulator.manager.renewal.resources.ColorResources;
-import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.dialog.VMModifyDialog;
 
 public class ModifyItem {
 
@@ -17,20 +17,44 @@ public class ModifyItem {
        public static final int LINE_WIDTH = 1;
        public static final int LINE_INDENT = 7;
        public static final int BODY_MARGIN_LEFT = 10;
+       public static final int BODY_CONTENT_WIDTH =
+                       VMModifyDialog.WIDTH - ItemTitle.TITLE_CANVAS_WIDTH - BODY_MARGIN_LEFT * 2;
 
-       private Composite comp;
+       public static final int WIDGET_HEIGHT = 23;
+
+       public static final int WIDGET_TOP = (ITEM_HEIGHT - WIDGET_HEIGHT) / 2;
+
+       protected Composite comp;
        private ItemTitle itemTitle;
        private Composite bodyComp;
 
-       public ModifyItem(Composite parent, String title, ImageResources iconResource) {
-               create(parent);
-               createTitle(title, iconResource);
-               createEmptyBody();
+       private int itemHeight = ITEM_HEIGHT;
+
+       protected int getItemHeight() {
+               return itemHeight;
        }
 
-       private void createTitle(String title, ImageResources iconResource) {
-               itemTitle = new ItemTitle(comp, title, iconResource);
+
+       public void setItemHeight(int itemHeight) {
+               this.itemHeight = itemHeight;
+       }
+
+
+       public void init(Composite parent) {
+               createComp(parent);
+       }
+
+       public void setItemTitle(ItemTitle itemTitle) {
+               this.itemTitle = itemTitle;
+       }
+
+       public Composite getItemComp() {
+               return comp;
+       }
+
+       public void create() {
                itemTitle.create();
+               createEmptyBody();
        }
 
        private void createEmptyBody() {
@@ -48,8 +72,8 @@ public class ModifyItem {
                                // draw under line
                                gc.setForeground(ColorResources.MODIFY_ITEM_LINE.getColor());
                                gc.setLineWidth(ModifyItem.LINE_WIDTH);
-                               gc.drawLine(-1, ModifyItem.ITEM_HEIGHT,
-                                               rect.width, ModifyItem.ITEM_HEIGHT);
+                               gc.drawLine(-1, getItemHeight(),
+                                               rect.width, getItemHeight());
                        }
                });
        }
@@ -75,20 +99,28 @@ public class ModifyItem {
        }
 
        public int getHeight() {
-               return ITEM_HEIGHT + LINE_WIDTH;
+               return ((GridData)comp.getLayoutData()).heightHint;
+
        }
 
-       /** For item which has single widget. */
        public void setBodyLayoutDefault() {
+               setBodyLayoutGrid(1);
+       }
+
+       public void setBodyLayoutGrid(int numColumns) {
                GridLayout layout = new GridLayout();
-               layout.numColumns = 1;
-               layout.marginWidth = ModifyItem.BODY_MARGIN_LEFT;
+               layout.numColumns = numColumns;
+               layout.marginWidth = BODY_MARGIN_LEFT;
                layout.marginHeight = 0;
+               layout.verticalSpacing = 0;
+               layout.horizontalSpacing = 0;
 
                bodyComp.setLayout(layout);
        }
 
-       private void create(Composite parent) {
+
+
+       private void createComp(Composite parent) {
                initComp(parent);
                makeComp();
        }
@@ -99,7 +131,7 @@ public class ModifyItem {
                GridData data = new GridData();
                data.grabExcessHorizontalSpace = true;
                data.horizontalAlignment = GridData.FILL;
-               data.heightHint = ITEM_HEIGHT + LINE_WIDTH;
+               data.heightHint = getItemHeight() + LINE_WIDTH;
                comp.setLayoutData(data);
        }
 
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/SubTreeItemTitle.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/SubTreeItemTitle.java
new file mode 100644 (file)
index 0000000..13ea2df
--- /dev/null
@@ -0,0 +1,50 @@
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ColorResources;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+
+public class SubTreeItemTitle extends ItemTitle {
+
+       private Canvas iconCanvas;
+       private final ImageResources iconResource;
+
+       private static int TITLE_MARGIN_LEFT = 23;
+       private static ColorResources background = ColorResources.MODIFY_ITEM_TITLE_SUB_BACKGROUDN;
+
+       public SubTreeItemTitle(Composite parent, String title, ImageResources iconResource) {
+               super(parent, title, TITLE_MARGIN_LEFT, background);
+               this.iconResource = iconResource;
+       }
+
+
+       @Override
+       public void create() {
+               super.create();
+               makeIcon();
+       }
+
+       private void makeIcon() {
+               // init
+               GridData data = new GridData(ICON_WIDTH, ICON_HEIGHT);
+               data.verticalAlignment = SWT.CENTER;
+               data.grabExcessVerticalSpace = true;
+               iconCanvas = new Canvas(this, SWT.NONE);
+               iconCanvas.setLayoutData(data);
+
+               // draw icon
+               iconCanvas.addPaintListener(new PaintListener() {
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               GC gc = e.gc;
+                               gc.drawImage(iconResource.getImage(), 0, 0);
+                       }
+               });
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/SubTreeModifyItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/SubTreeModifyItem.java
new file mode 100644 (file)
index 0000000..eb8680a
--- /dev/null
@@ -0,0 +1,31 @@
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common;
+
+import org.eclipse.swt.layout.GridData;
+
+
+public class SubTreeModifyItem extends ModifyItem{
+
+       public void changeExpanding(boolean isExpand) {
+               GridData data = new GridData();
+               if (isExpand) {
+                       data.grabExcessHorizontalSpace = true;
+                       data.horizontalAlignment = GridData.FILL;
+                       data.heightHint = getItemHeight() + LINE_WIDTH;
+               } else {
+                       data.heightHint = 0;
+               }
+               comp.setLayoutData(data);
+
+       }
+
+//     @Override
+//     @Override
+//     public int getHeight() {
+//             System.out.println(comp.getSize().y);
+//             if (comp.isVisible()) {
+//                     return super.getHeight();
+//             }
+//             return 0;
+//
+//     }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/TreeItemTitle.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/TreeItemTitle.java
new file mode 100644 (file)
index 0000000..353b0f8
--- /dev/null
@@ -0,0 +1,119 @@
+
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.tizen.emulator.manager.renewal.resources.ColorResources;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+
+public class TreeItemTitle extends ItemTitle {
+
+       private Canvas arrowCanvas;
+       private boolean isExpanded = true;
+
+       private final TreeModifyItem treeRoot;
+
+       private static int TITLE_MARGIN_LEFT = 15;
+       private static ColorResources background = ColorResources.MODIFY_ITEM_TITLE_BACKGROUND;
+       private static ImageResources ARROW_EXPANDED = ImageResources.ICON_TITLE_TREE_EXPANDED;
+       private static ImageResources ARROW_CLOSED = ImageResources.ICON_TITLE_TREE_CLOSED;
+
+
+       public TreeItemTitle(TreeModifyItem treeRoot, String title) {
+               super(treeRoot.getItemComp(), title, TITLE_MARGIN_LEFT, background);
+               this.treeRoot = treeRoot;
+       }
+
+       @Override
+       public void create() {
+               super.create();
+               makeArrow();
+       }
+
+       private void makeArrow() {
+               // init
+               GridData data = new GridData(ICON_WIDTH, ICON_HEIGHT);
+               data.verticalAlignment = SWT.CENTER;
+               data.grabExcessVerticalSpace = true;
+               arrowCanvas = new Canvas(this, SWT.NONE);
+               arrowCanvas.setLayoutData(data);
+
+               // draw icon
+               drawArrow();
+               addArrowListener();
+       }
+
+       private void drawArrow() {
+               arrowCanvas.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               GC gc = e.gc;
+                               if (isExpanded) {
+                                       gc.drawImage(ARROW_EXPANDED.getImage(), 0,0);
+
+                               } else {
+                                       gc.drawImage(ARROW_CLOSED.getImage(), 0,0);
+                               }
+
+                       }
+               });
+       }
+
+
+       private void addArrowListener() {
+
+               Listener mouseListener = new Listener() {
+                       @Override
+                       public void handleEvent(Event e) {
+
+                               if (e.type == SWT.MouseUp) {
+                                       Rectangle rect = ((Canvas)e.widget).getClientArea();
+                                       if (rect.contains(e.x, e.y)) {
+                                               isExpanded = !isExpanded;
+                                               treeRoot.changeTreeExpanding(isExpanded);
+                                               arrowCanvas.redraw();
+                                       }
+                               }
+                       }
+               };
+               arrowCanvas.addListener(SWT.MouseUp, mouseListener);
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/TreeModifyItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/TreeModifyItem.java
new file mode 100644 (file)
index 0000000..d3c2ba0
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.ModifyDialogItem;
+
+public class TreeModifyItem extends ModifyItem{
+
+       private ModifyDialogItem modifyDialogItem;
+       private final List<SubTreeModifyItem> subItemList = new ArrayList<SubTreeModifyItem>();
+
+       public void addSubItem(SubTreeModifyItem subItem) {
+               subItemList.add(subItem);
+       }
+
+       public void changeTreeExpanding(boolean isExpand) {
+               for (SubTreeModifyItem subItem : subItemList) {
+                       subItem.changeExpanding(isExpand);
+               }
+               modifyDialogItem.getParentDialog().layoutScrolledComposite();
+       }
+
+       public void setModifyDialogItem(ModifyDialogItem modifyDialogItem) {
+               this.modifyDialogItem = modifyDialogItem;
+       }
+
+
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/widgets/CheckBoxButton.java b/src/org/tizen/emulator/manager/ui/renewal/widgets/CheckBoxButton.java
new file mode 100644 (file)
index 0000000..01e0877
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.renewal.widgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.TypedListener;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.table.Helper;
+
+public class CheckBoxButton extends Canvas {
+       private Image image = null;
+       private Image imageHover = null;
+       private Image checkedImage = null;
+       private Image checkedImageHover = null;
+       private boolean isSelected = false;
+       private boolean isHover = false;
+
+       private Color checkedBackground = null;
+
+       public CheckBoxButton(Composite parent, int style) {
+               super(parent, SWT.DOUBLE_BUFFERED | style);
+
+               initButton();
+               addListeners();
+       }
+
+       protected void initButton() {
+               image = ImageResources.CHECKBOX_UNCHECKED_NML.getImage();
+               imageHover = ImageResources.CHECKBOX_UNCHECKED_HOVER.getImage();
+               checkedImage = ImageResources.CHECKBOX_CHECKED_NML.getImage();
+               checkedImageHover = ImageResources.CHECKBOX_CHECKED_HOVER.getImage();
+       }
+
+       private void addListeners() {
+               addPaintListener(paintListener);
+               addListener(SWT.MouseDown, mouseListener);
+               addListener(SWT.MouseUp, mouseListener);
+               addListener(SWT.MouseEnter, mouseListener);
+               addListener(SWT.MouseExit, mouseListener);
+               addDisposeListener(disposeListener);
+       }
+
+       @Override
+       public Point computeSize(int wHint, int hHint, boolean changed) {
+               checkWidget();
+               int width = 0, height = 0;
+
+               Rectangle bounds = image.getBounds();
+               width = bounds.width;
+               height = bounds.height;
+
+               if (wHint != SWT.DEFAULT)
+                       width = wHint;
+
+               if (hHint != SWT.DEFAULT)
+                       height = hHint;
+
+               return new Point(width, height);
+       }
+
+       private final DisposeListener disposeListener = new DisposeListener() {
+
+               @Override
+               public void widgetDisposed(DisposeEvent arg0) {
+                       Helper.tryDispose(image, imageHover, checkedImage, checkedImageHover, checkedBackground);
+               }
+       };
+
+       private final PaintListener paintListener = new PaintListener() {
+
+               @Override
+               public void paintControl(PaintEvent e) {
+                       Rectangle rect = ((Canvas) e.widget).getClientArea();
+
+                       if (isSelected && checkedBackground != null) {
+                               e.gc.setBackground(checkedBackground);
+                       } else {
+                               e.gc.setBackground(getBackground());
+                       }
+                       e.gc.fillRectangle(rect);
+
+                       Image img = image;
+                       if (isSelected) {
+                               img = isHover ? checkedImageHover : checkedImage;
+                       } else {
+                               img = isHover ? imageHover : image;
+                       }
+
+                       Rectangle bounds = img.getBounds();
+                       int x = rect.x + (rect.width - bounds.width) / 2;
+                       int y = rect.y + (rect.height - bounds.height) / 2;
+
+                       if (null != img) {
+                               e.gc.drawImage(img, x, y);
+                       }
+               }
+       };
+
+       public void addSelectionListener(SelectionListener listener) {
+               checkWidget();
+               addListener(SWT.Selection, new TypedListener(listener));
+               addListener(SWT.DefaultSelection, new TypedListener(listener));
+       }
+
+       public void removeSelectionListener(SelectionListener listener) {
+               checkWidget();
+               removeListener(SWT.Selection, listener);
+               removeListener(SWT.DefaultSelection, listener);
+       }
+
+       protected Listener mouseListener = new Listener() {
+
+               @Override
+               public void handleEvent(Event e) {
+                       if (!isEnabled()) {
+                               return;
+                       }
+
+                       CheckBoxButton button = (CheckBoxButton) e.widget;
+                       if (e.type == SWT.MouseUp) {
+                               Rectangle rect = ((Canvas)e.widget).getClientArea();
+                               if (rect.contains(e.x, e.y)) {
+                                       setSelection(!isSelection());
+                                       redraw();
+                                       button.notifyListeners(SWT.Selection, new Event());
+                               }
+
+                       } else if (e.type == SWT.MouseEnter) {
+                               isHover = true;
+                               redraw();
+
+                       } else if (e.type == SWT.MouseExit) {
+                               isHover = false;
+                               redraw();
+                       }
+               }
+       };
+
+       public void setSelection(boolean selected) {
+               checkWidget();
+               isSelected = selected;
+       }
+
+       public boolean isSelection() {
+               checkWidget();
+               return isSelected;
+       }
+
+       public void setSelectedBackground(Color color) {
+               checkWidget();
+               if (color == null) {
+                       SWT.error(SWT.ERROR_NULL_ARGUMENT);
+               }
+               this.checkedBackground = color;
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/widgets/ComboBox.java b/src/org/tizen/emulator/manager/ui/renewal/widgets/ComboBox.java
new file mode 100644 (file)
index 0000000..8f3a867
--- /dev/null
@@ -0,0 +1,293 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+package org.tizen.emulator.manager.ui.renewal.widgets;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.manager.renewal.resources.ColorResources;
+import org.tizen.emulator.manager.renewal.resources.FontResources;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+
+public class ComboBox extends NinePatchBox {
+
+       private static NinePatchResourceMap ninePatchResourceMap;
+
+       private final Shell parentShell;
+       private Canvas textCanvas;
+
+       private final int ARROW_AREA_WIDTH = 19;
+       public static final int TEXT_MARGIN_LEFT = 3;
+
+       private Image arrowImageNormal;
+       private Image arrowImageHover;
+
+       private final List<String> items;
+       private final ComboBoxPopup popup;
+       private int selectedIndex = 0;
+       private String selectedItem = "";
+
+       public ComboBox(Shell parentShell, Composite parent, int style) {
+               super(parent, style);
+               this.parentShell = parentShell;
+               popup = new ComboBoxPopup(this);
+               items = new ArrayList<String>();
+               initNinePatchResourceMap();
+               initBox();
+               createText();
+               addMouseListener();
+
+               // TODO for test
+               items.add("combo 1");
+               items.add("combo 2");
+               items.add("combo 3");
+       }
+
+
+       public Shell getParentShell() {
+               return parentShell;
+       }
+
+       public void addItem(String item) {
+               items.add(item);
+       }
+
+
+       @Override
+       public void redraw() {
+               textCanvas.redraw();
+               super.redraw();
+       }
+
+       public String getSelectedItem() {
+               return selectedItem;
+       }
+
+       public List<String> getItemList() {
+               return items;
+       }
+
+
+       public void setIndex(int index) {
+               if (index < 0 || index >= items.size()) {
+                       return;
+               }
+               selectedIndex = index;
+       }
+
+
+       public int getSelectionIndex() {
+               return selectedIndex;
+       }
+
+
+       public void select(int index) {
+               if (index < 0 || index >= items.size()) {
+                       return;
+               }
+
+               selectedIndex = index;
+               selectedItem = items.get(index);
+
+               notifyListeners(SWT.Selection, new Event());
+       }
+
+
+       private void initBox() {
+               this.setLayout(new FormLayout());
+       }
+
+
+       private void createText() {
+               FormData data = new FormData();
+               data.left = new FormAttachment(0, TEXT_MARGIN_LEFT);
+               data.right = new FormAttachment(100, ARROW_AREA_WIDTH * -1);
+               data.top = new FormAttachment(0, 1);
+               data.bottom = new FormAttachment(100,-1);
+
+               textCanvas = new Canvas(this, SWT.NONE);
+               textCanvas.setLayoutData(data);
+
+               drawText();
+       }
+
+
+       private void drawText() {
+               textCanvas.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               GC gc = e.gc;
+                               Rectangle rect = ((Canvas)e.widget).getBounds();
+                               gc.setForeground(ColorResources.CONTENT_FONT.getColor());
+                               gc.setFont(FontResources.CONTENT.getFont());
+                               Point textExt = gc.textExtent(selectedItem);
+                               int poxY = (rect.height - textExt.y) / 2;
+                               gc.drawText(selectedItem, TEXT_MARGIN_LEFT, poxY);
+                       }
+               });
+       }
+
+
+       @Override
+       protected void draw(PaintEvent e) {
+               drawArrow(e);
+       }
+
+
+       private void drawArrow(PaintEvent e) {
+               // drawArrow
+               Image image = getArrowImage();
+               ImageData imageData = image.getImageData();
+               GC gc = e.gc;
+               Rectangle rect = ((Canvas)e.widget).getBounds();
+               int posX = (rect.width - ARROW_AREA_WIDTH +
+                               (ARROW_AREA_WIDTH - imageData.width) /2 );
+               int posY = (rect.height - imageData.height) / 2;
+               gc.drawImage(image, posX, posY);
+
+       }
+
+       private Image getArrowImage() {
+               if (getState() == WSTATE.HOVER || getState() == WSTATE.SELECTED) {
+                       if (arrowImageHover == null) {
+                               arrowImageHover = ImageResources.DROP_DOWN_ARROW_HOVER.getImage();
+                       }
+                       return arrowImageHover;
+               }
+
+               if (arrowImageNormal == null) {
+                       arrowImageNormal = ImageResources.DROP_DOWN_ARROW_NORMAL.getImage();
+               }
+               return arrowImageNormal;
+
+       }
+
+
+       private void addMouseListener() {
+               Listener mouseListener = new Listener() {
+
+                       @Override
+                       public void handleEvent(Event e) {
+                               if (e.type == SWT.MouseEnter) {
+                                       if (popup.isClosed()) {
+                                               setState(WSTATE.HOVER);
+                                               redraw();
+                                       }
+
+                               } else  if (e.type == SWT.MouseExit) {
+                                       if (popup.isClosed()) {
+                                               setState(WSTATE.NORMAL);
+                                               redraw();
+                                       }
+
+                               } if (e.type == SWT.MouseUp) {
+//                                     if (items.size() == 0) {
+//                                             return;
+//                                     }
+                                       Rectangle rect = ((Canvas)e.widget).getClientArea();
+                                       if (rect.contains(e.x, e.y)) {
+                                               setState(getState() == WSTATE.SELECTED ? WSTATE.HOVER : WSTATE.SELECTED);
+                                               redraw();
+                                               popup.changePopup();
+                                       }
+                               }
+                       }
+               };
+               textCanvas.addListener(SWT.MouseEnter, mouseListener);
+               textCanvas.addListener(SWT.MouseExit, mouseListener);
+               textCanvas.addListener(SWT.MouseUp, mouseListener);
+
+               this.addListener(SWT.MouseEnter, mouseListener);
+               this.addListener(SWT.MouseExit, mouseListener);
+               this.addListener(SWT.MouseUp, mouseListener);
+
+       }
+
+       @Override
+       public NinePatchResourceMap getNinePatchResourceMap() {
+               return ninePatchResourceMap;
+       }
+
+       private static void initNinePatchResourceMap() {
+               ninePatchResourceMap = new NinePatchResourceMap();
+               ninePatchResourceMap.setImages(WSTATE.NORMAL, ColorResources.WHITE,
+                               ColorResources.BLACK,
+                               ImageResources.DROP_DOWN_BOX_NORMAL_LT,
+                               ImageResources.DROP_DOWN_BOX_NORMAL_T,
+                               ImageResources.DROP_DOWN_BOX_NORMAL_RT,
+                               ImageResources.DROP_DOWN_BOX_NORMAL_R,
+                               ImageResources.DROP_DOWN_BOX_NORMAL_RB,
+                               ImageResources.DROP_DOWN_BOX_NORMAL_B,
+                               ImageResources.DROP_DOWN_BOX_NORMAL_LB,
+                               ImageResources.DROP_DOWN_BOX_NORMAL_L);
+
+               ninePatchResourceMap.setImages(WSTATE.HOVER, ColorResources.WHITE,
+                               ColorResources.BLACK,
+                               ImageResources.DROP_DOWN_BOX_HOVER_LT,
+                               ImageResources.DROP_DOWN_BOX_HOVER_T,
+                               ImageResources.DROP_DOWN_BOX_HOVER_RT,
+                               ImageResources.DROP_DOWN_BOX_HOVER_R,
+                               ImageResources.DROP_DOWN_BOX_HOVER_RB,
+                               ImageResources.DROP_DOWN_BOX_HOVER_B,
+                               ImageResources.DROP_DOWN_BOX_HOVER_LB,
+                               ImageResources.DROP_DOWN_BOX_HOVER_L);
+
+               ninePatchResourceMap.setImages(WSTATE.SELECTED, ColorResources.WHITE,
+                               ColorResources.BLACK,
+                               ImageResources.DROP_DOWN_BOX_SELECTED_LT,
+                               ImageResources.DROP_DOWN_BOX_SELECTED_T,
+                               ImageResources.DROP_DOWN_BOX_SELECTED_RT,
+                               ImageResources.DROP_DOWN_BOX_SELECTED_R,
+                               ImageResources.DROP_DOWN_BOX_SELECTED_RB,
+                               ImageResources.DROP_DOWN_BOX_SELECTED_B,
+                               ImageResources.DROP_DOWN_BOX_SELECTED_LB,
+                               ImageResources.DROP_DOWN_BOX_SELECTED_L);
+
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/widgets/ComboBoxPopup.java b/src/org/tizen/emulator/manager/ui/renewal/widgets/ComboBoxPopup.java
new file mode 100644 (file)
index 0000000..114a103
--- /dev/null
@@ -0,0 +1,296 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+package org.tizen.emulator.manager.ui.renewal.widgets;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Region;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.manager.renewal.resources.ColorResources;
+import org.tizen.emulator.manager.renewal.resources.FontResources;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.renewal.resources.PatchImageResources;
+
+public class ComboBoxPopup {
+
+       private final ComboBox parentComboBox;
+
+       private Shell popupShell;
+       private Canvas popupCanvas;
+       private Image popupImage = null;
+       private final List<Rectangle> itemRects;
+
+       private static final int ITEM_HEIGHT = 23;
+       private static final int MARGIN_WIDTH = 6;
+       private static int LINE_OFFSET = 1;
+       private static int SHADOW_WIDTH_RIGHT = 4;
+       private static int SHADOW_WIDTH_BOTTOM = 5;
+
+
+       private int shellWidth;
+       private int shellHeight;
+
+       public ComboBoxPopup(ComboBox parentComboBox) {
+               this.parentComboBox = parentComboBox;
+               itemRects = new ArrayList<Rectangle>();
+       }
+
+       private void open() {
+               initShell();
+               initCanvas();
+
+               popupShell.open();
+       }
+
+       public void changePopup() {
+               if (popupShell == null || popupShell.isDisposed()) {
+                       open();
+
+               } else {
+                       dispose();
+               }
+       }
+
+       public boolean isClosed() {
+               if (popupShell == null || popupShell.isDisposed()) {
+                       return true;
+               }
+               return false;
+       }
+
+       private void initCanvas() {
+               popupCanvas = new Canvas(popupShell, SWT.DOUBLE_BUFFERED);
+               popupCanvas.setForeground(ColorResources.CONTENT_FONT.getColor());
+               popupCanvas.setFont(FontResources.CONTENT.getFont());
+
+               List<String> items = parentComboBox.getItemList();
+               Rectangle itemRect;
+               for (int i = 0; i < items.size(); i++) {
+                       itemRect = new Rectangle(LINE_OFFSET, LINE_OFFSET + i * ITEM_HEIGHT,
+                                                                               shellWidth - LINE_OFFSET * 2, ITEM_HEIGHT);
+                       itemRects.add(itemRect);
+               }
+
+               addPaintListener();
+               addDisposeListener();
+               addMouseListener();
+               addFocusListener();
+
+       }
+
+
+       private void addMouseListener() {
+                Listener popupMouseEventListener = new Listener() {
+                       @Override
+                       public void handleEvent(Event event) {
+                               switch(event.type) {
+                               case SWT.MouseMove:
+                                       Rectangle rect;
+                                       for (int i = 0; i < itemRects.size(); i++) {
+                                               rect = itemRects.get(i);
+                                               if (rect.contains(event.x, event.y)) {
+                                                       parentComboBox.setIndex(i);
+                                                       popupCanvas.redraw();
+                                                       break;
+                                               }
+                                       }
+                                       break;
+                               case SWT.MouseUp:
+                                       parentComboBox.select(parentComboBox.getSelectionIndex());
+                                       parentComboBox.redraw();
+                                       dispose();
+                                       break;
+                               default:
+                                               break;
+                               }
+
+                       }
+               };
+
+               popupCanvas.addListener(SWT.MouseUp, popupMouseEventListener);
+               popupCanvas.addListener(SWT.MouseMove, popupMouseEventListener);
+
+       }
+
+
+       private void addFocusListener() {
+               popupCanvas.addFocusListener(new FocusListener() {
+
+                       @Override
+                       public void focusLost(FocusEvent arg0) {
+                               dispose();
+                       }
+
+                       @Override
+                       public void focusGained(FocusEvent arg0) {
+                       }
+               });
+
+       }
+       private void initShell() {
+               popupShell = new Shell(parentComboBox.getParentShell(), SWT.ON_TOP | SWT.NO_TRIM);
+               popupShell.setLayout(new FillLayout());
+
+               List<String> items = parentComboBox.getItemList();
+
+               Rectangle parentRect = parentComboBox.getBounds();
+               Point parentPoint = parentComboBox.toDisplay(0, 0);
+
+               int itemWidth = getMaxTextWidth(items) + MARGIN_WIDTH * 2;
+               shellWidth = ((itemWidth > parentRect.width) ? itemWidth : parentRect.width);
+
+               // insures minimum popup height
+               int shellItemSize = items.size() == 0 ? 1 : items.size();
+               shellHeight = (ITEM_HEIGHT) * shellItemSize + LINE_OFFSET * 2;
+
+               Region region = new Region();
+               region.add(0, 0, shellWidth + SHADOW_WIDTH_RIGHT,
+                               shellHeight + SHADOW_WIDTH_BOTTOM);
+               region.subtract(0, shellHeight - 1, 1, 1);
+               popupShell.setRegion(region);
+
+               Rectangle size = region.getBounds();
+               popupShell.setSize(size.width, size.height);
+               popupShell.setLocation(parentPoint.x, parentPoint.y + parentRect.height);
+       }
+
+
+       private int getMaxTextWidth(List<String> items) {
+               if (items.isEmpty()) {
+                       return 0;
+               }
+               int width = 0;
+               GC gc = new GC(Display.getCurrent(), SWT.NONE);
+               for (String item : items) {
+                       Point p = gc.textExtent(item);
+                       if (p.x > width) {
+                               width = p.x;
+                       }
+               }
+               gc.dispose();
+               return width;
+       }
+
+       public void dispose() {
+               if (popupShell == null) {
+                       return;
+               }
+               parentComboBox.setState(WSTATE.NORMAL);
+               parentComboBox.redraw();
+               popupShell.close();
+       }
+
+
+       private void addPaintListener() {
+               popupCanvas.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               // draw border
+                               drawBorder(e);
+
+                               // draw item text
+                               GC gc = e.gc;
+                               int selectedIndex = parentComboBox.getSelectionIndex();
+                               int fontHeight = gc.getFontMetrics().getHeight();
+                               int yOffset = (ComboBoxPopup.ITEM_HEIGHT - fontHeight)/2 + LINE_OFFSET;
+                               int totalHeight = 0;
+
+                               List<String> items = parentComboBox.getItemList();
+                               for (int i = 0; i < itemRects.size(); i++) {
+                                       if (selectedIndex == i) {
+                                               gc.setBackground(ColorResources.CREATE_VM_COMBO_POPUP_SELECT_ITEM.getColor());
+                                       } else {
+                                               gc.setBackground(ColorResources.WHITE.getColor());
+                                       }
+                                       gc.fillRectangle(itemRects.get(i));
+
+                                       String text = items.get(i);
+                                       gc.drawText(text, MARGIN_WIDTH, totalHeight + yOffset, true);
+                                       totalHeight += ITEM_HEIGHT;
+                               }
+                       }
+               });
+       }
+
+       private void drawBorder(PaintEvent e) {
+               if (popupImage == null) {
+                       NinePatchResourceInfo ninePatchImagesInfo =
+                                       new NinePatchResourceInfo(ColorResources.WHITE,
+                                               ColorResources.WHITE,
+                                               ImageResources.CONTEXT_MENU_LT,
+                                               ImageResources.CONTEXT_MENU_T,
+                                               ImageResources.CONTEXT_MENU_RT,
+                                               ImageResources.CONTEXT_MENU_R,
+                                               ImageResources.CONTEXT_MENU_RB,
+                                               ImageResources.CONTEXT_MENU_B,
+                                               ImageResources.CONTEXT_MENU_LB,
+                                               ImageResources.CONTEXT_MENU_L);
+                       Rectangle rect = ((Canvas) e.widget).getClientArea();
+                       popupImage = PatchImageResources.getComboPopupImage(
+                                       rect.width, rect.height, ninePatchImagesInfo);
+               }
+               e.gc.drawImage(popupImage, 0, 0);
+       }
+
+
+       private void addDisposeListener() {
+               popupCanvas.addDisposeListener(new DisposeListener() {
+                       @Override
+                       public void widgetDisposed(DisposeEvent e) {
+                               System.out.println("popup disposing");
+                               if (popupImage != null) {
+                                       popupImage.dispose();
+                                       popupImage = null;
+                               }
+                               itemRects.clear();
+                       }
+               });
+       }
+}
index 851a558..5f275ca 100644 (file)
@@ -136,7 +136,7 @@ class CreateVMComboPopup {
                popupShell.open();
        }
 
-       private Listener popupMouseEventListener = new Listener() {
+       private final Listener popupMouseEventListener = new Listener() {
                @Override
                public void handleEvent(Event event) {
                        switch(event.type) {
@@ -183,7 +183,7 @@ class CreateVMComboPopup {
                popupShell = null;
        }
 
-       private PaintListener paintListener = new PaintListener() {
+       private final PaintListener paintListener = new PaintListener() {
 
                @Override
                public void paintControl(PaintEvent e) {
@@ -224,7 +224,7 @@ class CreateVMComboPopup {
                }
        };
 
-       private DisposeListener disposeListener = new DisposeListener() {
+       private final DisposeListener disposeListener = new DisposeListener() {
                @Override
                public void widgetDisposed(DisposeEvent arg0) {
                        WidgetHelper.tryDispose(popupCanvas, popupShell);
index e84b64f..ca447bf 100644 (file)
@@ -50,6 +50,15 @@ public abstract class NinePatchBox extends Canvas{
        private final Map<WSTATE, Image> imageMap = new HashMap<WSTATE, Image>();
        private WSTATE state = WSTATE.NORMAL;
 
+
+       protected void draw(PaintEvent e) {
+               // This is for sub-class
+       }
+
+       protected boolean isSelected() {
+               return state == WSTATE.SELECTED;
+       }
+
        protected void setState(WSTATE state) {
                this.state = state;
        }
@@ -72,10 +81,12 @@ public abstract class NinePatchBox extends Canvas{
                        @Override
                        public void paintControl(PaintEvent e) {
                                drawBox(e);
+                               draw(e);
                        }
                });
        }
 
+
        private void drawBox(PaintEvent e) {
                // get box image
                Image image = imageMap.get(state);
index 9e0f3a5..1f3de7e 100644 (file)
@@ -53,7 +53,6 @@ public class TextInputBox extends NinePatchBox{
        private static NinePatchResourceMap ninePatchResourceMap;
 
        private Text text;
-       private final ColorResources TEXT_BACKGROUND = ColorResources.WHITE;
 
        private final int TEXT_MARGIN_WIDTH = 2;
        private final int TEXT_MARGIN_HEIGHT = 2;
@@ -62,7 +61,8 @@ public class TextInputBox extends NinePatchBox{
        public TextInputBox(Composite parent, int style) {
                super(parent, style);
                initNinePatchResourceMap();
-               init();
+               initBox();
+               createText();
        }
 
 
@@ -75,13 +75,6 @@ public class TextInputBox extends NinePatchBox{
                text.setText(value);
        }
 
-
-       private void init() {
-               initBox();
-               initText();
-       }
-
-
        private void initBox() {
                GridLayout layout = new GridLayout();
                layout.marginHeight = TEXT_MARGIN_HEIGHT;
@@ -91,17 +84,17 @@ public class TextInputBox extends NinePatchBox{
        }
 
 
-       private void initText() {
+       private void createText() {
                GridData data = new GridData();
                data.grabExcessHorizontalSpace = true;
                data.grabExcessVerticalSpace = true;
                data.horizontalAlignment = SWT.FILL;
-               data.verticalAlignment = SWT.FILL;
+               data.verticalAlignment = SWT.CENTER;
 
                text = new Text(this, SWT.NONE);
                text.setFont(FontResources.CONTENT.getFont());
                text.setForeground(ColorResources.CONTENT_FONT.getColor());
-               text.setBackground(TEXT_BACKGROUND.getColor());
+               text.setBackground(ColorResources.WHITE.getColor());
                text.setLayoutData(data);
 
                removeTextBorder();
@@ -162,7 +155,7 @@ public class TextInputBox extends NinePatchBox{
                        @Override
                        public void paintControl(PaintEvent e) {
                                // remove by overwriting border with background's color
-                               e.gc.setForeground(TEXT_BACKGROUND.getColor());
+                               e.gc.setForeground(ColorResources.WHITE.getColor());
                                e.gc.setLineWidth(TEXT_BORDER_WIDTH);
 
                                Rectangle rect = ((Text)e.widget).getBounds();
index a306881..3f461d2 100644 (file)
 
 package org.tizen.emulator.manager.ui.renewal.widgets;
 
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Widget;
+import org.tizen.emulator.manager.renewal.resources.ColorResources;
+import org.tizen.emulator.manager.renewal.resources.FontResources;
 
-class WidgetHelper {
+public class WidgetHelper {
        public static void tryDispose(final Object... Disposables) {
                if (null == Disposables) {
                        return;
@@ -47,4 +55,32 @@ class WidgetHelper {
                        }
                }
        }
+
+
+       // draw text
+       // - valign : center
+       // - horizontal left: default 0
+       public static void drawText(Composite comp, final String text, final int horizentalAlign) {
+               comp.addPaintListener(new PaintListener() {
+                       @Override
+                       public void paintControl(PaintEvent e) {
+
+                               GC gc = e.gc;
+                               gc.setForeground(ColorResources.CONTENT_FONT.getColor());
+                               gc.setFont(FontResources.CONTENT.getFont());
+
+                               int itemHeight = ((Composite)e.widget).getBounds().height;
+                               Point textExt = gc.textExtent(text);
+                               int posY = (itemHeight - textExt.y) / 2;
+
+                               int posX = 0;
+                               if (horizentalAlign == SWT.CENTER) {
+                                       int itemWidth = ((Composite)e.widget).getBounds().width;
+                                       posX = (itemWidth - textExt.x)/ 2;
+                               }
+                               gc.drawText(text, posX, posY);
+                       }
+
+               });
+       }
 }