dialog: add device template dialog.
authorminkee.lee <minkee.lee@samsung.com>
Thu, 8 Oct 2015 10:49:51 +0000 (19:49 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 12 Oct 2015 02:03:46 +0000 (11:03 +0900)
- It support create template.
- It support modify template.(not complete yet)
- Now, UI is fixed. This should be changed to load XML.

Change-Id: Ib81c3019ecc66660c23335fc60ecca4ce700c7b1
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
48 files changed:
src/org/tizen/emulator/manager/devices/DeviceTemplateValue.java
src/org/tizen/emulator/manager/dialoghandler/renewal/DeviceTemplateDialogHandler.java [new file with mode: 0644]
src/org/tizen/emulator/manager/dialoghandler/renewal/VMModifyHandler.java [moved from src/org/tizen/emulator/manager/handler/renewal/VMModifyHandler.java with 73% similarity]
src/org/tizen/emulator/manager/renewal/resources/ImageResources.java
src/org/tizen/emulator/manager/ui/renewal/dialog/DeviceTemplateModifyDialog.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/dialog/Dialog.java
src/org/tizen/emulator/manager/ui/renewal/dialog/DialogButtons.java
src/org/tizen/emulator/manager/ui/renewal/dialog/ModifyDialog.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/dialog/VMModifyDialog.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/CheckBoxItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CheckBoxItem.java with 50% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/CheckBoxSubItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CheckBoxSubItem.java with 73% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/CheckItemData.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ComboItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ComboItem.java with 77% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/DeviceItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/DeviceItem.java with 57% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/DisplayItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/IModifyDialogItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/IModifyDialogItem.java with 79% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ImageItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ImageItem.java with 71% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ModifyDialogItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/NameItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ProcessorItem.java with 52% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ProcessorItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ProfileItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/RamSizeItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/RamSizeItem.java with 54% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/SensorItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/TextInputBoxItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/TextLabelItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TextLabelItem.java with 90% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/IconItemTitle.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/IconItemTitle.java with 54% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/ItemTitle.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/ItemTitle.java with 98% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/ModifyItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/ModifyItem.java with 76% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/PropertyValue.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/SubTreeItemTitle.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/SubTreeItemTitle.java with 54% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/SubTreeModifyItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/VMNameItem.java with 62% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/TreeItemTitle.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/TreeItemTitle.java with 97% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/TreeModifyItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/TreeModifyItem.java with 88% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/template/CameraItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/SensorItem.java with 52% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/DeviceTemplateItem.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/DisplayItem.java [deleted file]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ProfileItem.java [deleted file]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/SubTreeModifyItem.java [deleted file]
src/org/tizen/emulator/manager/ui/renewal/tableviewer/DeviceTemplateTableViewer.java
src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTable.java
src/org/tizen/emulator/manager/ui/renewal/widgets/CheckBoxButton.java
src/org/tizen/emulator/manager/ui/renewal/widgets/ComboBox.java
src/org/tizen/emulator/manager/ui/renewal/widgets/ComboBoxPopup.java
src/org/tizen/emulator/manager/ui/renewal/widgets/ImageButton.java
src/org/tizen/emulator/manager/ui/renewal/widgets/ImageRadioButton.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/widgets/ProfileImageButton.java [moved from src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ModifyDialogItem.java with 72% similarity]
src/org/tizen/emulator/manager/ui/renewal/widgets/TextInputBox.java
src/org/tizen/emulator/manager/ui/renewal/widgets/WStateImageMap.java [new file with mode: 0644]

index 1d7b1e6..f03c4f2 100644 (file)
@@ -41,6 +41,7 @@ import org.tizen.emulator.manager.device.xml.template.DeviceItem;
 import org.tizen.emulator.manager.device.xml.template.DeviceItemValue;
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.platform.Skin;
+import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.vms.RESOLUTION;
 
 public class DeviceTemplateValue implements Cloneable {
@@ -71,6 +72,29 @@ public class DeviceTemplateValue implements Cloneable {
        private int ramSize = 512;
        private int cpuCount = 1;
 
+       public String getPrintValue() {
+               StringBuilder sb = new StringBuilder();
+               sb.append("name : " + name + StringResources.NEW_LINE);
+               sb.append("profile : " + profile + StringResources.NEW_LINE);
+               sb.append("resolution : " + resolution.toString() + StringResources.NEW_LINE);
+               sb.append("width : " + displayWidth + StringResources.NEW_LINE);
+               sb.append("height : " + displayHeight + StringResources.NEW_LINE);
+               sb.append("size : " + displaySize + StringResources.NEW_LINE);
+               sb.append("ram : " + ramSize + StringResources.NEW_LINE);
+               sb.append("processor : " + cpuCount + StringResources.NEW_LINE);
+               sb.append(StringResources.NEW_LINE);
+               sb.append("======= sub devices ========");
+               sb.append(StringResources.NEW_LINE);
+               for (SubDevice subDev : additionalDevices) {
+                       sb.append("  " + subDev.getName() + " : ");
+                       for (SubDeviceItem item : subDev.getItems()) {
+                               sb.append(item.getId() + "(" + item.isSupport() + ")" + ", ");
+                       }
+                       sb.append(StringResources.NEW_LINE);
+               }
+
+               return sb.toString();
+       }
        private List<SubDevice> additionalDevices = new ArrayList<SubDevice>();
 
        public DeviceTemplateValue(DeviceTemplate template) {
diff --git a/src/org/tizen/emulator/manager/dialoghandler/renewal/DeviceTemplateDialogHandler.java b/src/org/tizen/emulator/manager/dialoghandler/renewal/DeviceTemplateDialogHandler.java
new file mode 100644 (file)
index 0000000..b59fae7
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * 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.dialoghandler.renewal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.tizen.emulator.manager.devices.DeviceTemplateCreator;
+import org.tizen.emulator.manager.devices.DeviceTemplateValue;
+import org.tizen.emulator.manager.ui.renewal.MainDialog;
+import org.tizen.emulator.manager.ui.renewal.dialog.DeviceTemplateModifyDialog;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.DeviceItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.DisplayItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.NameItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ProcessorItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ProfileItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.RamSizeItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.SensorItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.template.CameraItem;
+import org.tizen.emulator.manager.vms.VMProperty;
+
+public class DeviceTemplateDialogHandler {
+
+       public static final String TITLE_CREATE = "New Template";
+       public static final String TITLE_MODIFY = "Modify Template";
+       public static final String TITLE_CLONE = "Clone Template";
+
+
+       public static void create(DeviceTemplateValue value) {
+
+               if (value == null) {
+                       value = new DeviceTemplateValue(null);
+               }
+
+               DeviceTemplateValue itemValue = value.clone();
+               DeviceTemplateModifyDialog dialog = createDialog(TITLE_CREATE, true, itemValue);
+
+               int retValue = dialog.open();
+
+               if (retValue == SWT.OK) {
+                       dialog.saveDataInto(itemValue);
+                       DeviceTemplateCreator.create(itemValue);
+
+                       // TODO for test
+                       System.out.println(itemValue.getPrintValue());
+               }
+       }
+
+
+       public static void clone(DeviceTemplateValue value) {
+               DeviceTemplateValue newValue = value.clone();
+               int retValue = createDialog(TITLE_CLONE, true, newValue).open();
+               if (retValue == SWT.OK) {
+                       // TODO do clone
+               }
+       }
+
+
+       public static void modify(DeviceTemplateValue value) {
+               if (value == null) {
+                       value = new DeviceTemplateValue(null);
+               }
+
+               DeviceTemplateValue itemValue = value.clone();
+               DeviceTemplateModifyDialog dialog = createDialog(TITLE_MODIFY, false, itemValue);
+
+               int retValue = dialog.open();
+
+               if (retValue == SWT.OK) {
+                       dialog.saveDataInto(itemValue);
+
+                       // TODO for test
+                       System.out.println(itemValue.getPrintValue());
+
+                       // TODO do modify
+               }
+       }
+
+
+
+       private static DeviceTemplateModifyDialog createDialog(
+                       String dialogTitle, boolean isCreateMode, DeviceTemplateValue value) {
+
+               // open dialog
+               DeviceTemplateModifyDialog dialog =
+                               new DeviceTemplateModifyDialog(MainDialog.getShell(), dialogTitle);
+               dialog.setCreateMode(isCreateMode);
+               dialog.create(value, getItemList(null));
+
+               return dialog;
+
+       }
+
+       private static List<ModifyDialogItem> getItemList(VMProperty property) {
+               // TODO make item list using Image's item-template
+               return getTmpItemList();
+
+       }
+
+
+       // FOR TES
+       public static List<ModifyDialogItem> getTmpItemList() {
+               List<ModifyDialogItem> itemList = new ArrayList<ModifyDialogItem>();
+
+               itemList.add(new NameItem("deviceTemplateName", "Device Name"));
+               itemList.add(new ProfileItem());
+               itemList.add(new DisplayItem());
+               itemList.add(new RamSizeItem());
+               itemList.add(new ProcessorItem());
+               itemList.add(new SensorItem());
+               itemList.add(new DeviceItem());
+               itemList.add(new CameraItem());
+
+
+
+               return itemList;
+       }
+
+}
@@ -29,7 +29,7 @@
  */
 
 
-package org.tizen.emulator.manager.handler.renewal;
+package org.tizen.emulator.manager.dialoghandler.renewal;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -37,16 +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.common.DeviceItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.DisplayItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ImageItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.NameItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ProcessorItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ProfileItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.RamSizeItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.SensorItem;
 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.vms.VMProperty;
 
 public class VMModifyHandler {
@@ -55,7 +55,8 @@ public class VMModifyHandler {
 
                // open modify dialog
                VMModifyDialog dialog = new VMModifyDialog(MainDialog.getShell());
-               dialog.create(property, getItemList(property));
+               dialog.setCreateMode(false);
+               dialog.create(property.getPropertyValue(), getItemList(property));
 
                // TODO set display value to dialog
 
@@ -77,7 +78,7 @@ public class VMModifyHandler {
        public static List<ModifyDialogItem> getTmpItemList() {
                List<ModifyDialogItem> itemList = new ArrayList<ModifyDialogItem>();
 
-               itemList.add(new VMNameItem());
+               itemList.add(new NameItem("vmName", "VM name"));
                itemList.add(new ProfileItem());
                itemList.add(new ImageItem());
                DeviceTemplateItem deviceItem = new DeviceTemplateItem();
index ce9898d..67e3d9d 100644 (file)
@@ -233,7 +233,7 @@ public enum ImageResources {
        BTN_PROFILE_MOBILE_UNSELECTED_NML("btn_profile_mobile_unselected_nml"),
        BTN_PROFILE_WEARABLE_SELECTED("btn_profile_wearable_selected"),
        BTN_PROFILE_WEARABLE_UNSELECTED_HOVER("btn_profile_wearable_unselected_hover"),
-       BTN_PROFILE_WEARABLEE_UNSELECTED_NML("btn_profile_wearable_unselected_nml"),
+       BTN_PROFILE_WEARABLE_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"),
diff --git a/src/org/tizen/emulator/manager/ui/renewal/dialog/DeviceTemplateModifyDialog.java b/src/org/tizen/emulator/manager/ui/renewal/dialog/DeviceTemplateModifyDialog.java
new file mode 100644 (file)
index 0000000..aa10920
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * 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.dialog;
+
+import java.util.List;
+
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.manager.devices.DeviceTemplateValue;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
+import org.tizen.emulator.manager.vms.VMProperty;
+
+public class DeviceTemplateModifyDialog extends ModifyDialog {
+
+       public final static int WIDTH = 484;
+       private final static int HEIGHT = 496;
+
+       public DeviceTemplateModifyDialog(Shell parent, String title) {
+               super(parent, title, WIDTH, HEIGHT);
+       }
+
+
+       public void create(DeviceTemplateValue value, List<ModifyDialogItem> itemList) {
+               // - create title, buttons
+               // - init body
+
+               super.create(new PropertyValue(value), itemList);
+
+
+       }
+
+
+       public void setItemValue(VMProperty property) {
+
+       }
+
+
+}
index a09efac..a444820 100644 (file)
@@ -44,6 +44,7 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.emulator.manager.renewal.resources.ColorResources;
+import org.tizen.emulator.manager.ui.renewal.widgets.GrayButton;
 
 public class Dialog {
 
@@ -51,7 +52,7 @@ public class Dialog {
 
        private final Shell parent;
        private final String title;
-       private final int width;
+       protected final int width;
        private final int height;
        private final int buttonStyle;
 
@@ -59,8 +60,21 @@ public class Dialog {
        private Composite bodyComp;
        private int returnValue = SWT.CANCEL;
 
+       // create / modify mode
+       private boolean isCreateMode = true;
+
+       private GrayButton okButton;
+
        protected static final int BORDER_WIDTH = 1;
 
+       public void setOkButton(GrayButton okButton) {
+               this.okButton = okButton;
+       }
+
+       public void setOKButtonEnable(boolean enable) {
+               okButton.setEnabled(enable);
+       }
+
        public Dialog(Shell parent, String title, int width, int height, int buttonStyle) {
                this.parent = parent;
                this.title = title;
@@ -104,7 +118,6 @@ public class Dialog {
        }
 
 
-
        private void makeDialog() {
                DialogTitle.create(shell, childShell, title);
                initBody();
@@ -178,4 +191,12 @@ public class Dialog {
                bodyComp.setLayoutData(gridData);
        }
 
+       public boolean isCreateMode() {
+               return isCreateMode;
+       }
+
+       public void setCreateMode(boolean isCreateMode) {
+               this.isCreateMode = isCreateMode;
+       }
+
 }
index 0e30550..c420bdc 100644 (file)
@@ -114,7 +114,8 @@ public class DialogButtons {
                data.verticalAlignment = SWT.CENTER;
                data.grabExcessHorizontalSpace = true;
                data.grabExcessVerticalSpace = true;
-               makeButton(CONFIRM, SWT.OK, data, buttonComp, dialog);
+               GrayButton okButton = makeButton(CONFIRM, SWT.OK, data, buttonComp, dialog);
+               dialog.setOkButton(okButton);
 
                // Cancel button
                data =  new GridData(BUTTON_WIDTH, BUTTON_HEIGHT);
@@ -123,7 +124,7 @@ public class DialogButtons {
                makeButton(CANCEL, SWT.CANCEL, data, buttonComp, dialog);
        }
 
-       private static void makeButton(final String text, final int type, GridData data, Composite buttonComp, final Dialog dialog) {
+       private static GrayButton makeButton(final String text, final int type, GridData data, Composite buttonComp, final Dialog dialog) {
                GrayButton button = new GrayButton(buttonComp, SWT.PUSH);
                button.setText(text);
                button.setLayoutData(data);
@@ -137,6 +138,7 @@ public class DialogButtons {
                                }
                        }
                });
+               return button;
        }
 
 }
diff --git a/src/org/tizen/emulator/manager/ui/renewal/dialog/ModifyDialog.java b/src/org/tizen/emulator/manager/ui/renewal/dialog/ModifyDialog.java
new file mode 100644 (file)
index 0000000..c0af9aa
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * 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.dialog;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.layout.FillLayout;
+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.common.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
+
+public class ModifyDialog extends Dialog {
+
+       private Composite scrolledContent;
+       private List<ModifyDialogItem> itemList;
+
+       private final static int BUTTON_STYLE = SWT.OK | SWT.CANCEL;
+
+       private PropertyValue propertyValue;
+
+       public ModifyDialog(Shell parent, String title, int width, int height) {
+               super(parent, title, width, height, BUTTON_STYLE);
+               // TODO Auto-generated constructor stub
+       }
+
+
+       public void create(PropertyValue value, List<ModifyDialogItem> itemList) {
+               super.create();
+               this.itemList = itemList;
+               this.propertyValue = value;
+               createDialogBody();
+               checkValid();
+       }
+
+       private void createDialogBody() {
+               initScrolledComposite();
+               makeModifyItem();
+       }
+
+       private void makeModifyItem() {
+               for (ModifyDialogItem item : itemList) {
+                       item.setDialog(this);
+
+                       // TODO we need default value for dialog
+                       item.setInitialValue(propertyValue);
+
+                       item.create(scrolledContent);
+               }
+
+               // set scrolled-content size
+               computeScrolledContentSize();
+       }
+
+       private void computeScrolledContentSize() {
+               int height = 0;
+               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
+               Composite bodyComp = getBodyComposite();
+               bodyComp.setLayout(new FillLayout());
+               ScrolledComposite sc = new ScrolledComposite(bodyComp,  SWT.V_SCROLL);
+               scrolledContent = new Composite(sc, SWT.NONE);
+
+               // add content
+               sc.setContent(scrolledContent);
+               scrolledContent.setBackground(ColorResources.BLACK.getColor());
+
+               GridLayout layout = new GridLayout();
+               layout.numColumns = 1;
+               layout.marginWidth = 0;
+               layout.marginHeight = 0;
+               layout.verticalSpacing = 0;
+               scrolledContent.setLayout(layout);
+       }
+
+
+       public PropertyValue getPropertyValue() {
+               return propertyValue;
+       }
+
+
+       public void checkValid() {
+               boolean isOKButtonEnable = true;
+               for (ModifyDialogItem dialogItem : itemList) {
+                       if (!dialogItem.isValid()) {
+                               isOKButtonEnable = false;
+                               break;
+                       }
+               }
+
+               if (!isCreateMode()) {
+                       // TODO check change
+               }
+
+               setOKButtonEnable(isOKButtonEnable);
+       }
+
+       public void saveDataInto(Object obj) {
+               PropertyValue value = new PropertyValue(obj);
+
+               for(ModifyDialogItem item : itemList) {
+                       item.setValue(value);
+               }
+       }
+
+
+
+}
index 47eb65f..cab9587 100644 (file)
@@ -33,96 +33,38 @@ package org.tizen.emulator.manager.ui.renewal.dialog;
 
 import java.util.List;
 
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.layout.FillLayout;
-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.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
 import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.VMPropertyValue;
 
-public class VMModifyDialog extends Dialog {
+public class VMModifyDialog extends ModifyDialog {
 
        private final static String TITLE = "VM Modify";
        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<ModifyDialogItem> itemList;
-       private VMProperty property;
 
        public VMModifyDialog(Shell parent) {
-               super(parent, TITLE, WIDTH, HEIGHT, BUTTON_STYLE);
+               super(parent, TITLE, WIDTH, HEIGHT);
        }
 
 
-       public void create(VMProperty property, List<ModifyDialogItem> itemList) {
+       public void create(VMPropertyValue value, List<ModifyDialogItem> itemList) {
                // - create title, buttons
                // - init body
-               super.create();
-
-               // make body contents
-               this.property = property;
-               this.itemList = itemList;
-               createScrolledComposite();
-       }
+               super.create(new PropertyValue(value), itemList);
 
 
-       public void setItemValue(VMProperty property) {
-
        }
 
 
-       private void createScrolledComposite() {
-               initScrolledComposite();
-               makeModifyItem();
-       }
-
-       private void makeModifyItem() {
-               for (ModifyDialogItem item : itemList) {
-                       item.setParentDialog(this);
-                       item.setInitialValue(property);
-                       item.create(scrolledContent);
-               }
+       public void setItemValue(VMProperty property) {
 
-               // set scrolled-content size
-               computeScrolledContentSize();
        }
 
-       private void computeScrolledContentSize() {
-               int height = 0;
-               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
-               Composite bodyComp = getBodyComposite();
-               bodyComp.setLayout(new FillLayout());
-               ScrolledComposite sc = new ScrolledComposite(bodyComp,  SWT.V_SCROLL);
-               scrolledContent = new Composite(sc, SWT.NONE);
-
-               // add content
-               sc.setContent(scrolledContent);
-               scrolledContent.setBackground(ColorResources.BLACK.getColor());
-
-               GridLayout layout = new GridLayout();
-               layout.numColumns = 1;
-               layout.marginWidth = 0;
-               layout.marginHeight = 0;
-               layout.verticalSpacing = 0;
-               scrolledContent.setLayout(layout);
-       }
 
 }
  *
  */
 
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+package org.tizen.emulator.manager.ui.renewal.item.modify.common;
+
+import java.util.ArrayList;
+import java.util.List;
 
 import org.eclipse.swt.layout.GridData;
-import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
 
 public abstract class CheckBoxItem extends ModifyDialogItem {
 
@@ -39,19 +43,29 @@ public abstract class CheckBoxItem extends ModifyDialogItem {
        private int rowNum;
        private final int numColumns;
 
+       List<CheckBoxSubItem> subItemList = new ArrayList<CheckBoxSubItem>();
+
+       public List<CheckBoxSubItem> getSubItemList() {
+               return subItemList;
+       }
+
        // TODO should be structures that have name, title
-       private final String[] checkBoxList;
+       private List<CheckItemData> dataList;
 
-       public CheckBoxItem(int numColomn, String[] checkBoxList) {
+       public CheckBoxItem(String name, String title, int numColomn) {
+               super(name, title);
                this.numColumns = numColomn;
-               this.checkBoxList = checkBoxList;
+       }
+
+       public void setDataList(List<CheckItemData> dataList) {
+               this.dataList = dataList;
                initRowNum();
        }
 
 
        private void initRowNum() {
-               rowNum = checkBoxList.length / numColumns;
-               if (checkBoxList.length % numColumns != 0) {
+               rowNum = dataList.size() / numColumns;
+               if (dataList.size() % numColumns != 0) {
                        rowNum++;
                }
        }
@@ -66,15 +80,52 @@ public abstract class CheckBoxItem extends ModifyDialogItem {
                item.setBodyLayoutGrid(numColumns);
 
                CheckBoxSubItem checkBoxItem;
-               for (int i=0 ; i < checkBoxList.length ; i++) {
-                       String sensor = checkBoxList[i];
-                       checkBoxItem = new CheckBoxSubItem(item.getBody(), sensor, sensor);
+               for (int i=0 ; i < dataList.size() ; i++) {
+                       CheckItemData checkItemData = dataList.get(i);
+                       checkBoxItem = new CheckBoxSubItem(this, item.getBody(),
+                                       checkItemData.getName(), checkItemData.getTitle(), checkItemData.isChecked());
 
                        // set checkbox item layout
                        GridData data = new GridData();
                        data.heightHint = ROW_HEIGHT;
                        data.widthHint = ModifyItem.BODY_CONTENT_WIDTH / numColumns;
                        checkBoxItem.create(data);
+
+                       subItemList.add(checkBoxItem);
+               }
+       }
+
+       public void checkBoxSelected() {
+               getDialog().checkValid();
+       }
+
+
+       @Override
+       public void setInitialValue(PropertyValue value) {
+               List<CheckItemData> dataList = value.getCheckOptions(getName());
+               for (CheckItemData data : dataList) {
+                       String name = data.getName();
+                       boolean isChecked = data.isChecked();
+                       for (CheckItemData ownData : dataList) {
+                               if (ownData.getName().equals(name)) {
+                                       ownData.setChecked(isChecked);
+                               }
+                       }
+               }
+       }
+
+
+       @Override
+       public void setValue(PropertyValue value) {
+
+               List<CheckItemData> dataList = new ArrayList<CheckItemData>();
+               for (CheckBoxSubItem subItem : getSubItemList()) {
+                       dataList.add(new CheckItemData(
+                                       subItem.getName(),
+                                       subItem.getTitle(), subItem.isChecked()));
                }
+               value.setCheckOptions(getName(), dataList);
+
        }
+
 }
@@ -29,7 +29,7 @@
  */
 
 
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+package org.tizen.emulator.manager.ui.renewal.item.modify.common;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.PaintEvent;
@@ -40,12 +40,16 @@ 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.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.FontResources;
-import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
 import org.tizen.emulator.manager.ui.renewal.widgets.CheckBoxButton;
 
 public class CheckBoxSubItem {
+
+       private final CheckBoxItem parentItem;
        private final Composite parentComp;
        private final String name;
        private final String title;
@@ -59,10 +63,13 @@ public class CheckBoxSubItem {
 
        private final int ROW_HEIGHT = ModifyItem.ITEM_HEIGHT + ModifyItem.LINE_WIDTH;
 
-       public CheckBoxSubItem(Composite parentComp, String name, String title) {
+       public CheckBoxSubItem(CheckBoxItem parentItem, Composite parentComp,
+                       String name, String title, boolean isChecked) {
+               this.parentItem = parentItem;
                this.parentComp = parentComp;
                this.name = name;
                this.title = title;
+               this.isChecked = isChecked;
        }
 
        public void create(Object layoutData) {
@@ -73,6 +80,7 @@ public class CheckBoxSubItem {
 
                createCheckBox();
                drawTitle();
+               addSelectionListener();
        }
 
 
@@ -85,7 +93,26 @@ public class CheckBoxSubItem {
                // TODO change to checkBoxWidget
                checkBox = new CheckBoxButton(comp, SWT.NONE);
                checkBox.setLayoutData(data);
+               checkBox.setSelection(isChecked);
+
+       }
+
+
+       private void addSelectionListener() {
+               Listener listener = new Listener() {
+                       @Override
+                       public void handleEvent(Event e) {
+                               switch(e.type) {
+                               case SWT.Selection:
+                                       isChecked = ((CheckBoxButton)e.widget).isSelection();
+                                       parentItem.checkBoxSelected();
+                               default:
+                                               break;
+                               }
 
+                       }
+               };
+               checkBox.addListener(SWT.Selection, listener);
        }
 
 
@@ -107,4 +134,25 @@ public class CheckBoxSubItem {
                });
 
        }
+
+       public String getName() {
+               return name;
+       }
+
+
+       public String getTitle() {
+               return title;
+       }
+
+
+       public boolean isChecked() {
+               return isChecked;
+       }
+
+
+       public void setChecked(boolean isChecked) {
+               this.isChecked = isChecked;
+       }
+
+//     public
 }
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/CheckItemData.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/CheckItemData.java
new file mode 100644 (file)
index 0000000..8ba0ab9
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * 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.common;
+
+public class CheckItemData {
+       private String name;
+       private String title;
+       private boolean isChecked;
+
+       public String getTitle() {
+               return title;
+       }
+
+       public void setTitle(String title) {
+               this.title = title;
+       }
+
+       public String getName() {
+               return name;
+       }
+
+       public void setName(String name) {
+               this.name = name;
+       }
+
+       public boolean isChecked() {
+               return isChecked;
+       }
+
+       public void setChecked(boolean isChecked) {
+               this.isChecked = isChecked;
+       }
+
+       public CheckItemData(String name, String title) {
+               this(name, title, false);
+       }
+
+       public CheckItemData(String name, String title, boolean isChecked) {
+               this.name = name;
+               this.title = title;
+               this.isChecked = isChecked;
+       }
+
+
+}
@@ -28,7 +28,9 @@
  *
  */
 
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+package org.tizen.emulator.manager.ui.renewal.item.modify.common;
+
+import java.util.List;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.FormAttachment;
@@ -36,7 +38,7 @@ 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.item.modify.comp.ModifyItem;
 import org.tizen.emulator.manager.ui.renewal.widgets.ComboBox;
 
 
@@ -44,6 +46,33 @@ public abstract class ComboItem extends ModifyDialogItem {
 
        private ComboBox comboBox;
 
+       public ComboItem(String name, String title) {
+               super(name, title);
+       }
+
+
+       protected void addComboItem(String item) {
+               comboBox.addItem(item);
+       }
+
+       protected List<String> getComboItemList() {
+               return comboBox.getItemList();
+       }
+
+       protected String getComboItem(int index) {
+               return comboBox.getItemList().get(index);
+       }
+
+
+       protected void selectComboItem(int index) {
+               comboBox.select(index);
+       }
+
+       protected String getSelectedItem() {
+               return comboBox.getSelectedItem();
+       }
+
+
        protected void createCombo(ModifyItem item, int width) {
 //             item.setBodyLayoutDefault();
 //
@@ -58,7 +87,7 @@ public abstract class ComboItem extends ModifyDialogItem {
                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 = new ComboBox(getDialog().getShell(), item.getBody(), SWT.NONE);
                comboBox.setLayoutData(data);
                addSelectionListener();
        }
  *
  */
 
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+package org.tizen.emulator.manager.ui.renewal.item.modify.common;
+
+import java.util.ArrayList;
+import java.util.List;
 
 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;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubTreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.TreeModifyItem;
 
 public class DeviceItem extends CheckBoxItem {
 
-       private final SubTreeModifyItem item;
+       private final ModifyItem item;
 
-       private final String TITLE = "Device";
-       private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_DEVICE;
+       private static final String TITLE = "Device";
+       private static final String NAME = "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"};
+       // TODO load from xml
+       private final List<CheckItemData> dataList =
+                       new ArrayList<CheckItemData>();
+
+       private void initDataList() {
+               dataList.add(new CheckItemData("nfc", "NFC"));
+       }
 
+       /** constructor for tree sub item */
        public DeviceItem(TreeModifyItem treeRoot) {
-               super(NUM_COLUMN, sensorList);
+               super(NAME, TITLE, NUM_COLUMN);
+               initDataList();
+               setDataList(dataList);
                item = new SubTreeModifyItem();
                item.setItemHeight(getContentHeight());
-               treeRoot.addSubItem(item);
+               treeRoot.addSubItem((SubTreeModifyItem)item);
+       }
+
+       public DeviceItem() {
+               super(NAME, TITLE, NUM_COLUMN);
+               initDataList();
+               setDataList(dataList);
+               item = new ModifyItem();
+               item.setItemHeight(getContentHeight());
        }
 
 
        @Override
        public void create(Composite parent) {
                item.init(parent);
-               item.setItemTitle(new SubTreeItemTitle(item.getItemComp(), TITLE, TITLE_ICON_RESOURCE));
+               item.setItemTitle(createIconTitle(item, null));
                item.create();
 
                createCheckBoxItems(item);
@@ -72,10 +90,5 @@ public class DeviceItem extends CheckBoxItem {
                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/common/DisplayItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/DisplayItem.java
new file mode 100644 (file)
index 0000000..9c03ff9
--- /dev/null
@@ -0,0 +1,444 @@
+/*
+ * 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.common;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.tizen.emulator.manager.logging.EMLogger;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubTreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.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.RESOLUTION;
+
+public class DisplayItem extends ModifyDialogItem {
+
+       private final ModifyItem item;
+
+       private static final String TITLE = "Display";
+       private static final String NAME = "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;  // TODO
+
+
+       /** constructor for tree sub item */
+       public DisplayItem(TreeModifyItem treeRoot) {
+               super(NAME, TITLE);
+               item = new SubTreeModifyItem();
+               item.setItemHeight(ROW_HEIGHT * ROW_NUM);
+               treeRoot.addSubItem((SubTreeModifyItem)item);
+       }
+
+
+       public DisplayItem() {
+               super(NAME, TITLE);
+               item = new ModifyItem();
+               item.setItemHeight(ROW_HEIGHT * ROW_NUM);
+       }
+
+
+       @Override
+       public void create(Composite parent) {
+               item.init(parent);
+               item.setItemTitle(createIconTitle(item, TITLE_ICON_RESOURCE));
+               item.create();
+
+               item.setBodyLayoutDefault();
+               createResolutionComboItem();
+               createResolutionTextItem();
+               createSizeItem();
+               createSkinItem();
+
+               initResolutionCombo();
+       }
+
+
+       @Override
+       public int getHeight() {
+               return item.getHeight();
+       }
+
+
+       @Override
+       public void setInitialValue(PropertyValue value) {
+               resolution = value.getResolution();
+               displaySize = String.valueOf(value.getDisplaySize());
+               displayWidth = String.valueOf(value.getDisplayWidth());
+               displayHeight = String.valueOf(value.getDisplayHeight());
+       }
+
+
+       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;
+
+       List<RESOLUTION> resList;
+       private RESOLUTION resolution;
+       private String displayWidth = "";
+       private String displayHeight = "";
+       private String displaySize = "";
+
+
+       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(getDialog().getShell(), comp, SWT.NONE);
+               resolutionCombo.setLayoutData(data);
+
+       }
+
+       private void initResolutionCombo() {
+               // init resolution list
+               // TODO from XML
+               resList = new ArrayList<RESOLUTION>();
+               resList.add(RESOLUTION.HD);
+               resList.add(RESOLUTION.HD1080);
+               resList.add(RESOLUTION.HVGA);
+               resList.add(RESOLUTION.QHD);
+               resList.add(RESOLUTION.R_360_480);
+               resList.add(RESOLUTION.WQXGA);
+
+               // add combo list
+               for (RESOLUTION res : resList) {
+                       resolutionCombo.addItem(res.toString());
+               }
+
+               // select resolution
+               // TODO default resolution
+               String re = null;
+               if (resolution != null) {
+                       re = resolution.toString();
+               } else {
+                       re = resList.get(0).toString();
+               }
+
+               // select combobox
+               for (int i=0 ; i < resolutionCombo.getItemList().size() ; i++) {
+                       String str = resolutionCombo.getItemList().get(i);
+                       if (str.equals(re)) {
+                               resolutionCombo.select(i);
+                               break;
+                       }
+               }
+               resolutionComboSelected(re);
+
+               addResolutionComboListener();
+       }
+
+
+       private void addResolutionComboListener() {
+               Listener listener = new Listener() {
+                       @Override
+                       public void handleEvent(Event event) {
+                               switch(event.type) {
+                               case SWT.Selection:
+                                       resolutionComboSelected(resolutionCombo.getSelectedItem());
+
+                               default:
+                                               break;
+                               }
+
+                       }
+               };
+               resolutionCombo.addListener(SWT.Selection, listener);
+       }
+
+
+
+       private void resolutionComboSelected(String re) {
+               resolutionCombo.setToolTipText(re);
+
+               // find resolution
+               RESOLUTION d = null;
+               for (RESOLUTION r : resList) {
+                       if (re.equals(r.toString())) {
+                               d = r;
+                       }
+               }
+
+               if (d != null) {
+                       resolution = d;
+                       setResolutionTextBox();
+               }
+
+
+               // TODO checkValid is needed?
+               getDialog().checkValid();
+
+//             if (d == null) {
+//                     if (re.equals(oldResolution.toString())) {
+//                             d = oldResolution;
+//                     }
+//             }
+
+//             if (d != null) {
+//                     EMLogger.getLogger().fine("Change Resolution -> " + d.getStrTypeValue()); //$NON-NLS-1$
+//                     resolution = d;
+//                     // TODO
+//                     displayItem.changeResolution(d);
+//             }
+
+
+       }
+
+
+       private void setResolutionTextBox() {
+               if (resolution != null) {
+                       displayWidth = String.valueOf(resolution.getResolution().getWidth());
+                       displayHeight = String.valueOf(resolution.getResolution().getHeight());
+                       widthTextBox.setText(displayWidth);
+                       heightTextBox.setText(displayHeight);
+               }
+       }
+
+
+       private void createResolutionTextItem() {
+               Composite comp = createSubComp(1, "");
+
+               // text box for 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);
+
+
+               // text box for 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);
+
+               addWidthHeightListener();
+       }
+
+
+       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);
+
+               selectSize();
+               addSizeListener();
+       }
+
+       private void selectSize() {
+               // TODO default value
+               sizeTextBox.setText("5.0");
+
+               displaySize = sizeTextBox.getValue();
+               getDialog().checkValid();
+       }
+
+
+       private void addSizeListener() {
+               sizeTextBox.getTextWidget().addModifyListener(new ModifyListener() {
+
+                       @Override
+                       public void modifyText(ModifyEvent e) {
+                               displaySize = sizeTextBox.getValue();
+                               getDialog().checkValid();
+                       }
+               });
+       }
+
+       private void addWidthHeightListener() {
+               // TODO what should we do width custom widdth/height
+
+               widthTextBox.getTextWidget().addModifyListener(new ModifyListener() {
+
+                       @Override
+                       public void modifyText(ModifyEvent e) {
+                               displayWidth = widthTextBox.getValue();
+                               getDialog().checkValid();
+                       }
+               });
+
+               heightTextBox.getTextWidget().addModifyListener(new ModifyListener() {
+
+                       @Override
+                       public void modifyText(ModifyEvent e) {
+                               displayHeight = heightTextBox.getValue();
+                               getDialog().checkValid();
+                       }
+               });
+       }
+
+
+
+       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(getDialog().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;
+       }
+
+
+       @Override
+       public void setValue(PropertyValue value) {
+               // set resolution
+               value.setResolution(resolution);
+
+               try {
+                       // set display size (inch)
+                       value.setDisplaySize(Double.parseDouble(displaySize));
+
+                       // TODO set displayWidth, displayHeight
+                       value.setDisplayWidth(Integer.parseInt(displayWidth));
+                       value.setDisplayHeight(Integer.parseInt(displayHeight));
+
+
+               } catch (NumberFormatException e) {
+                       EMLogger.getLogger().warning(e.getMessage());
+               }
+       }
+
+
+       @Override
+       public boolean isValid() {
+
+               // check Size text box
+               if (displaySize.isEmpty()) {
+                       return false;
+               }
+               try {
+                       Double.parseDouble(displaySize);
+               } catch (NumberFormatException e) {
+                       return false;
+               }
+
+               // TODO check display width/height
+               if (displayWidth.isEmpty() || displayHeight.isEmpty()) {
+                       return false;
+               }
+               try {
+                       Integer.parseInt(displayWidth);
+                       Integer.parseInt(displayHeight);
+               } catch (NumberFormatException e) {
+                       return false;
+               }
+
+               return true;
+       }
+
+
+
+}
  * - S-Core Co., Ltd
  *
  */
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+package org.tizen.emulator.manager.ui.renewal.item.modify.common;
 
 import org.eclipse.swt.widgets.Composite;
-import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
 
 public interface IModifyDialogItem {
 
@@ -39,5 +39,10 @@ public interface IModifyDialogItem {
        /** To decide modify dialog */
        public int getHeight();
 
-       public void setInitialValue(VMProperty property);
+       public void setInitialValue(PropertyValue value);
+
+       public boolean isValid();
+
+       /** set dialog data to property value */
+       public void setValue(PropertyValue value);
 }
  *
  */
 
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+package org.tizen.emulator.manager.ui.renewal.item.modify.common;
 
 import org.eclipse.swt.widgets.Composite;
 import org.tizen.emulator.manager.renewal.resources.ImageResources;
-import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
 
 public class ImageItem extends TextLabelItem {
 
-       private final String TITLE = "Image";
+       private final static String TITLE = "Image";
+       private static final String NAME = "image";
        private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_IMAGE;
 
+       public ImageItem() {
+               super(NAME, TITLE);
+       }
+
        @Override
        public void create(Composite parent) {
-               create(parent, TITLE, TITLE_ICON_RESOURCE);
+               create(parent, getTitle(), TITLE_ICON_RESOURCE);
        }
 
        @Override
-       public void setInitialValue(VMProperty property) {
-               if (property == null) {
+       public void setInitialValue(PropertyValue value) {
+               if (value == null) {
                        return;
                }
-               value = property.getBaseImageName();
+               this.value = value.getImageName();
+       }
+
+       @Override
+       public void setValue(PropertyValue value) {
+               // TODO Auto-generated method stub
+
        }
 }
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ModifyDialogItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ModifyDialogItem.java
new file mode 100644 (file)
index 0000000..6b0a7ef
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * 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.common;
+
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.dialog.ModifyDialog;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.IconItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubTreeItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubTreeModifyItem;
+
+public abstract class ModifyDialogItem implements IModifyDialogItem {
+
+       private String title;
+       private String name;
+       private ModifyDialog dialog;
+
+       public ModifyDialogItem(String name, String title) {
+
+               this.title = title;
+               this.name = name;
+       }
+
+       public String getName() {
+               return name;
+       }
+
+       public void setName(String name) {
+               this.name = name;
+       }
+
+       public String getTitle() {
+               return title;
+       }
+
+       public void setTitle(String title) {
+               this.title = title;
+       }
+
+       public ModifyDialog getDialog() {
+               return dialog;
+       }
+
+       public void setDialog(ModifyDialog dialog) {
+               this.dialog = dialog;
+       }
+
+       protected ItemTitle createIconTitle(ModifyItem item, ImageResources icon) {
+               if (item instanceof SubTreeModifyItem) {
+                       return new SubTreeItemTitle(item.getItemComp(), title, icon);
+               }
+               return new IconItemTitle(item.getItemComp(),title, icon);
+       }
+
+       @Override
+       public boolean isValid() {
+               return true;
+       }
+}
  *
  */
 
-
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+package org.tizen.emulator.manager.ui.renewal.item.modify.common;
 
 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;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
 
-public class ProcessorItem extends ComboItem {
+public class NameItem extends TextInputBoxItem {
 
-       private final SubTreeModifyItem item;
+       private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_VMNAME;
+       private final int INPUT_BOX_WIDTH = 236;
 
-       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);
+       public NameItem(String name, String title) {
+               super(name, title);
        }
 
+
        @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);
-
+               create(parent, getTitle(), TITLE_ICON_RESOURCE, INPUT_BOX_WIDTH);
        }
 
+
        @Override
-       public int getHeight() {
-               return item.getHeight();
+       public void setInitialValue(PropertyValue value) {
+               if (value == null) {
+                       return;
+               }
+               this.value = value.getName();
        }
 
+
        @Override
-       public void setInitialValue(VMProperty property) {
-               // TODO Auto-generated method stub
+       public void textModified() {
+               getDialog().checkValid();
+               // TODO check validation
+               // TODO check confirm button enable/disable
 
        }
 
        @Override
-       public void itemSelected(ComboBox comboBox) {
-               // TODO change item list for selected template.
-               System.out.println("item selected:" + comboBox.getSelectedItem());
+       public boolean isValid() {
+               if (value == null || value.isEmpty()) {
+                       return false;
+               }
+               return true;
+       }
+
 
+       @Override
+       public void setValue(PropertyValue value) {
+               value.setName(this.value);
        }
+
 }
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ProcessorItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ProcessorItem.java
new file mode 100644 (file)
index 0000000..9d503d5
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * 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.common;
+
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.job.CheckVT;
+import org.tizen.emulator.manager.logging.EMLogger;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubTreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.TreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.widgets.ComboBox;
+import org.tizen.emulator.manager.vms.CPU;
+
+public class ProcessorItem extends ComboItem {
+
+       private final ModifyItem item;
+
+       private static final String TITLE = "Processor";
+       private static final String NAME = "processor";
+       private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_PROCESSOR;
+       private final int COMBO_WIDTH = 124;
+
+       private int cpuNum;
+
+
+       /** constructor for tree sub item */
+       public ProcessorItem(TreeModifyItem treeRoot) {
+               super(NAME, TITLE);
+               item = new SubTreeModifyItem();
+               treeRoot.addSubItem((SubTreeModifyItem)item);
+       }
+
+       public ProcessorItem() {
+               super(NAME, TITLE);
+               item = new ModifyItem();
+
+
+       }
+
+       @Override
+       public void create(Composite parent) {
+               item.init(parent);
+               item.setItemTitle(createIconTitle(item, TITLE_ICON_RESOURCE));
+               item.create();
+
+               createCombo(item, COMBO_WIDTH);
+               initProcessorCombo();
+
+       }
+
+       private void initProcessorCombo() {
+
+               // init combo list
+               for (CPU r : CPU.values()) {
+                       addComboItem(r.toString());
+               }
+
+               // select item
+               int index = 0;
+               for (int i=0 ; i < getComboItemList().size() ; i++) {
+                       if (getComboItemList().get(i).equals(String.valueOf(cpuNum))) {
+                               index = i;
+                               break;
+                       }
+               }
+               selectComboItem(index);
+               comboSelected();
+       }
+
+
+
+       private void comboSelected() {
+               // get selected value
+               String value = getSelectedItem();
+               try {
+                       cpuNum = Integer.valueOf(value);
+
+               } catch (NumberFormatException e) {
+                       EMLogger.getLogger().warning(e.getMessage());
+               }
+
+               getDialog().checkValid();
+       }
+
+
+       @Override
+       public int getHeight() {
+               return item.getHeight();
+       }
+
+       @Override
+       public void setInitialValue(PropertyValue value) {
+               if (value == null) {
+                       return;
+               }
+
+               if (getDialog().isCreateMode()) {
+                       if (CheckVT.isNonUG()) {
+                               cpuNum = 1;
+
+                       } else {
+                               // set MAX cpu value.
+                               int maxNum = CPU.getMaxCpuNum();
+                               if (maxNum > 4) {
+                                       cpuNum = 4; // 4 : target max cpu.
+                               } else {
+                                       cpuNum = maxNum;
+                               }
+                       }
+
+               } else {
+                       cpuNum = value.getCpuNum();
+               }
+
+       }
+
+       @Override
+       public void itemSelected(ComboBox comboBox) {
+               comboSelected();
+       }
+
+       @Override
+       public void setValue(PropertyValue value) {
+               value.setCpuNum(cpuNum);
+
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ProfileItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ProfileItem.java
new file mode 100644 (file)
index 0000000..3765e15
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * 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.common;
+
+import java.util.HashMap;
+import java.util.Map;
+
+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.Rectangle;
+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.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
+import org.tizen.emulator.manager.ui.renewal.widgets.ImageRadioButton;
+import org.tizen.emulator.manager.ui.renewal.widgets.WSTATE;
+
+public class ProfileItem extends ModifyDialogItem {
+
+
+       private ModifyItem item;
+       private Canvas imageCanvas;
+       private String currentProfile = "mobile"; // TODO this is temp default.
+
+       private final static String TITLE = "Profile";
+       private static final String NAME = "profile";
+       private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_PROFILE;
+       private final String MOBILE = "mobile";
+       private final String WEARABLE = "wearable";
+       private final String TV = "tv";
+       private final int PROFILE_IMAGE_WIDTH = 34;
+       private final int PROFILE_IMAGE_HEIGHT = 25;
+       private final int IMAGE_SPACING = 4;
+
+       // TODO profileList from XML ?
+       private final String[] profileList = new String[]{MOBILE,WEARABLE,TV};
+
+
+       private final Map<String, ImageRadioButton> buttonMap =
+                       new HashMap<String, ImageRadioButton>();
+
+       public ProfileItem() {
+               super(NAME, TITLE);
+       }
+
+       @Override
+       public void setInitialValue(PropertyValue value) {
+               if (value == null) {
+                       return;
+               }
+               this.currentProfile = value.getProfile();
+       }
+
+
+       @Override
+       public int getHeight() {
+               return item.getHeight();
+       }
+
+       @Override
+       public void create(Composite parent) {
+               item = new ModifyItem();
+               item.init(parent);
+               item.setItemTitle(createIconTitle(item, TITLE_ICON_RESOURCE));
+               item.create();
+
+               if (getDialog().isCreateMode()) {
+                       createProfileButton();
+
+               } else {
+                       createProfileImage();
+               }
+       }
+
+
+       private void createProfileImage() {
+               item.setBodyLayoutDefault();
+
+               // init canvas
+               GridData data = new GridData(PROFILE_IMAGE_WIDTH, PROFILE_IMAGE_HEIGHT);
+               data.verticalAlignment = SWT.CENTER;
+               data.grabExcessVerticalSpace = true;
+               imageCanvas = new Canvas(item.getBody(), SWT.NONE);
+               imageCanvas.setLayoutData(data);
+
+               // set image
+               drawProfileImage();
+       }
+
+
+       private void drawProfileImage() {
+               imageCanvas.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               Image image = null;
+                               if (currentProfile.equals(MOBILE)) {
+                                       image =  ImageResources.BTN_PROFILE_MOBILE_SELECTED.getImage();
+
+                               } else if (currentProfile.equals(WEARABLE)) {
+                                       image = ImageResources.BTN_PROFILE_WEARABLE_SELECTED.getImage();
+
+                               } else if (currentProfile.equals(TV)) {
+                                       image = ImageResources.BTN_PROFILE_TV_SELECTED.getImage();
+                               }
+
+                               if (image != null) {
+                                       GC gc = e.gc;
+                                       Rectangle imgRect = image.getBounds();
+                                       gc.drawImage(image, imgRect.x, imgRect.y);
+                               }
+                       }
+               });
+       }
+
+
+
+       private void createProfileButton() {
+               item.getBody().setLayout(new FormLayout());
+               ImageRadioButton mobileButton = new ImageRadioButton(item.getBody());
+               mobileButton.setImage(WSTATE.NORMAL, ImageResources.BTN_PROFILE_MOBILE_UNSELECTED_NML);
+               mobileButton.setImage(WSTATE.HOVER, ImageResources.BTN_PROFILE_MOBILE_UNSELECTED_HOVER);
+               mobileButton.setImage(WSTATE.SELECTED, ImageResources.BTN_PROFILE_MOBILE_SELECTED);
+               mobileButton.setToolTipText(MOBILE);
+
+               ImageRadioButton wearableButton = new ImageRadioButton(item.getBody());
+               wearableButton.setImage(WSTATE.NORMAL, ImageResources.BTN_PROFILE_WEARABLE_UNSELECTED_NML);
+               wearableButton.setImage(WSTATE.HOVER, ImageResources.BTN_PROFILE_WEARABLE_UNSELECTED_HOVER);
+               wearableButton.setImage(WSTATE.SELECTED, ImageResources.BTN_PROFILE_WEARABLE_SELECTED);
+               wearableButton.setToolTipText(WEARABLE);
+
+               ImageRadioButton tvButton = new ImageRadioButton(item.getBody());
+               tvButton.setImage(WSTATE.NORMAL, ImageResources.BTN_PROFILE_TV_UNSELECTED_NML);
+               tvButton.setImage(WSTATE.HOVER, ImageResources.BTN_PROFILE_TV_UNSELECTED_HOVER);
+               tvButton.setImage(WSTATE.SELECTED, ImageResources.BTN_PROFILE_TV_SELECTED);
+               tvButton.setToolTipText(TV);
+
+
+               int top = (ModifyItem.ITEM_HEIGHT - PROFILE_IMAGE_HEIGHT) / 2;
+
+               FormData data = new FormData();
+               data.top = new FormAttachment(0, top);
+               data.left = new FormAttachment(0, ModifyItem.BODY_MARGIN_LEFT);
+               data.width = PROFILE_IMAGE_WIDTH;
+               data.height = PROFILE_IMAGE_HEIGHT;
+               mobileButton.setLayoutData(data);
+
+               data = new FormData();
+               data.top = new FormAttachment(0, top);
+               data.left = new FormAttachment(mobileButton, IMAGE_SPACING);
+               data.width = PROFILE_IMAGE_WIDTH;
+               data.height = PROFILE_IMAGE_HEIGHT;
+               wearableButton.setLayoutData(data);
+
+               data = new FormData();
+               data.top = new FormAttachment(0, top);
+               data.left = new FormAttachment(wearableButton, IMAGE_SPACING);
+               data.width = PROFILE_IMAGE_WIDTH;
+               data.height = PROFILE_IMAGE_HEIGHT;
+               tvButton.setLayoutData(data);
+
+               buttonMap.put(MOBILE, mobileButton);
+               buttonMap.put(WEARABLE, wearableButton);
+               buttonMap.put(TV, tvButton);
+
+               addSelectListener();
+               selectButton();
+
+       }
+
+
+       private void addSelectListener() {
+               for (final String profile : buttonMap.keySet()) {
+
+                       buttonMap.get(profile).addListener(SWT.Selection, new Listener() {
+                               @Override
+                               public void handleEvent(Event e) {
+                                       if (e.type == SWT.Selection) {
+                                               currentProfile = profile;
+                                       }
+                               }
+                       });
+               }
+       }
+
+
+       private void selectButton() {
+               // TODO default
+               buttonMap.get(MOBILE).selectRadio();
+               if (currentProfile.isEmpty()) {
+                       currentProfile = MOBILE;
+               }
+
+               for (String profile : buttonMap.keySet()) {
+                       if (profile.equals(currentProfile)) {
+                               buttonMap.get(profile).selectRadio();
+                       }
+               }
+       }
+
+       @Override
+       public void setValue(PropertyValue value) {
+               value.setProfile(currentProfile);
+
+       }
+
+}
  *
  */
 
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+package org.tizen.emulator.manager.ui.renewal.item.modify.common;
 
 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.logging.EMLogger;
 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.item.modify.comp.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubTreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.TreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.widgets.ComboBox;
 import org.tizen.emulator.manager.ui.renewal.widgets.WidgetHelper;
-import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.RAM_SIZE;
 
 public class RamSizeItem extends ComboItem {
 
-       private final SubTreeModifyItem item;
+       private final ModifyItem item;
+
+       private static final String TITLE = "Ram";
+       private static final String NAME = "ram";
 
-       private final String TITLE = "Ram";
        private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_RAM;
        private final int COMBO_WIDTH = 124;
 
+       private int ramSize = 512;
+
+       /** constructor for tree sub item */
        public RamSizeItem(TreeModifyItem treeRoot) {
+               super(NAME, TITLE);
                item = new SubTreeModifyItem();
-               treeRoot.addSubItem(item);
+               treeRoot.addSubItem((SubTreeModifyItem)item);
        }
 
+       public RamSizeItem() {
+               super(NAME, TITLE);
+               item = new ModifyItem();
+       }
+
+
        @Override
        public void create(Composite parent) {
                item.init(parent);
-               item.setItemTitle(new SubTreeItemTitle(item.getItemComp(), TITLE, TITLE_ICON_RESOURCE));
+               item.setItemTitle(createIconTitle(item, TITLE_ICON_RESOURCE));
                item.create();
 
                createCombo(item, COMBO_WIDTH);
+               initRamSizeCombo();
                addLabel();
        }
 
+       private void initRamSizeCombo() {
+               // init combo list
+               for (RAM_SIZE r : RAM_SIZE.values()) {
+                       addComboItem(r.toString());
+               }
+
+               // select item
+               int index = 0;
+               for (int i=0 ; i < getComboItemList().size() ; i++) {
+                       if (getComboItemList().get(i).equals(String.valueOf(ramSize))) {
+                               index = i;
+                               break;
+                       }
+               }
+               selectComboItem(index);
+               comboSelected();
+       }
+
+       private void comboSelected() {
+               // get selected value
+               String value = getSelectedItem();
+               try {
+                       ramSize = Integer.valueOf(value);
+
+               } catch (NumberFormatException e) {
+                       EMLogger.getLogger().warning(e.getMessage());
+               }
+
+               getDialog().checkValid();
+       }
+
        private void addLabel() {
                FormData data = new FormData();
                int left = ModifyItem.BODY_MARGIN_LEFT + COMBO_WIDTH + 6;
@@ -85,9 +131,20 @@ public class RamSizeItem extends ComboItem {
        }
 
        @Override
-       public void setInitialValue(VMProperty property) {
-               // TODO Auto-generated method stub
+       public void setInitialValue(PropertyValue value) {
+               ramSize = value.getRamSize();
+       }
+
+       @Override
+       public void setValue(PropertyValue value) {
+               value.setRamSize(ramSize);
 
        }
 
+       @Override
+       public void itemSelected(ComboBox comboBox) {
+               // This is called when combo item is selected
+               // TODO override this.
+               comboSelected();
+       }
 }
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/SensorItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/SensorItem.java
new file mode 100644 (file)
index 0000000..129ad56
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * 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.common;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubTreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.TreeModifyItem;
+
+public class SensorItem extends CheckBoxItem {
+
+       private final ModifyItem item;
+
+       private static final String TITLE = "Sensor";
+       private static final String NAME = "sensor";
+       private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_SENSOR;
+
+       private static final int NUM_COLUMN = 3;
+
+
+       // TODO load from xml
+       private final List<CheckItemData> dataList =
+                       new ArrayList<CheckItemData>();
+
+       private void initDataList() {
+               dataList.add(new CheckItemData("accel", "Accelerometer"));
+               dataList.add(new CheckItemData("gyro", "Gyroscope"));
+               dataList.add(new CheckItemData("proxi", "Proximity"));
+               dataList.add(new CheckItemData("geo-magnetic", "Geo-magnetic"));
+               dataList.add(new CheckItemData("light", "Light"));
+               dataList.add(new CheckItemData("haptic", "Haptic"));
+               dataList.add(new CheckItemData("pressure", "Pressure"));
+
+       }
+
+       /** constructor for tree sub item */
+       public SensorItem(TreeModifyItem treeRoot) {
+               super(NAME, TITLE, NUM_COLUMN);
+               item = new SubTreeModifyItem();
+               initDataList();
+               setDataList(dataList);
+
+               item.setItemHeight(getContentHeight());
+               treeRoot.addSubItem((SubTreeModifyItem)item);
+       }
+
+
+       public SensorItem() {
+               super(NAME, TITLE, NUM_COLUMN);
+               initDataList();
+               setDataList(dataList);
+               item = new ModifyItem();
+               item.setItemHeight(getContentHeight());
+
+       }
+
+
+       @Override
+       public void create(Composite parent) {
+               item.init(parent);
+               item.setItemTitle(createIconTitle(item, TITLE_ICON_RESOURCE));
+               item.create();
+
+               createCheckBoxItems(item);
+
+       }
+
+       @Override
+       public int getHeight() {
+               return item.getHeight();
+       }
+
+
+       @Override
+       public void setInitialValue(PropertyValue value) {
+               List<CheckItemData> dataList = value.getCheckOptions(getName());
+               for (CheckItemData data : dataList) {
+                       String name = data.getName();
+                       boolean isChecked = data.isChecked();
+                       for (CheckItemData ownData : this.dataList) {
+                               if (ownData.getName().equals(name)) {
+                                       ownData.setChecked(isChecked);
+                               }
+                       }
+               }
+       }
+
+
+       @Override
+       public void setValue(PropertyValue value) {
+
+               List<CheckItemData> dataList = new ArrayList<CheckItemData>();
+               for (CheckBoxSubItem subItem : getSubItemList()) {
+                       dataList.add(new CheckItemData(
+                                       subItem.getName(),
+                                       subItem.getTitle(), subItem.isChecked()));
+               }
+               value.setCheckOptions(getName(), dataList);
+
+       }
+
+
+
+
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/TextInputBoxItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/TextInputBoxItem.java
new file mode 100644 (file)
index 0000000..f883ed8
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * 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.common;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.IconItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.widgets.TextInputBox;
+import org.tizen.emulator.manager.ui.renewal.widgets.WidgetHelper;
+
+public abstract class TextInputBoxItem extends ModifyDialogItem {
+
+       private ModifyItem item;
+       private TextInputBox textBox;
+
+       protected String value = "";
+
+       /** This is called when text is modified */
+       public abstract void textModified();
+
+       public TextInputBoxItem(String name, String title) {
+               super(name, title);
+       }
+
+
+       @Override
+       public int getHeight() {
+               return item.getHeight();
+       }
+
+       protected void create(Composite parent, String title,
+                       ImageResources iconResource, int textBoxWidth) {
+               item = new ModifyItem();
+               item.init(parent);
+               item.setItemTitle(new IconItemTitle(item.getItemComp(), title, iconResource));
+               item.create();
+
+               makeBody(textBoxWidth);
+
+       }
+
+
+       protected void makeBody(int textBoxWidth) {
+               item.setBodyLayoutDefault();
+
+               if (getDialog().isCreateMode()) {
+                       createTextBox(textBoxWidth);
+
+               } else {
+                       createTextLabel();
+               }
+       }
+
+
+       // for create mode
+       private void createTextBox(int textBoxWidth) {
+               GridData data = new GridData();
+               data.heightHint = ModifyItem.WIDGET_HEIGHT;
+               data.widthHint = textBoxWidth;
+               data.grabExcessVerticalSpace = true;
+               data.verticalAlignment = SWT.CENTER;
+               textBox = new TextInputBox(item.getBody(), SWT.NONE);
+               textBox.setLayoutData(data);
+
+               addTextListener();
+       }
+
+       private void addTextListener() {
+               textBox.getTextWidget().addModifyListener(new ModifyListener() {
+
+                       @Override
+                       public void modifyText(ModifyEvent e) {
+                               value = ((Text)e.widget).getText();
+                               textModified();
+                       }
+               });
+       }
+
+
+       private void createTextLabel() {
+               // init canvas;
+               GridData data = new GridData();
+               data.heightHint = getHeight() - ModifyItem.LINE_WIDTH;
+               data.horizontalAlignment = SWT.FILL;
+               data.grabExcessHorizontalSpace = true;
+               Canvas canvas = new Canvas(item.getBody(), SWT.NONE);
+               canvas.setLayoutData(data);
+
+               WidgetHelper.drawText(canvas, value, SWT.NONE);
+       }
+}
@@ -29,7 +29,7 @@
  */
 
 
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+package org.tizen.emulator.manager.ui.renewal.item.modify.common;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.PaintEvent;
@@ -42,8 +42,8 @@ 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;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.IconItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
 
 public abstract class TextLabelItem extends ModifyDialogItem {
 
@@ -52,6 +52,12 @@ public abstract class TextLabelItem extends ModifyDialogItem {
 
        protected String value = "";
 
+
+       public TextLabelItem(String name, String title) {
+               super(name, title);
+       }
+
+
        @Override
        public int getHeight() {
                return item.getHeight();
@@ -1,4 +1,34 @@
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common;
+/*
+ * 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.comp;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.PaintEvent;
@@ -38,6 +68,9 @@ public class IconItemTitle extends ItemTitle {
                iconCanvas.setLayoutData(data);
 
                // draw icon
+               if (iconResource == null) {
+                       return;
+               }
                iconCanvas.addPaintListener(new PaintListener() {
                        @Override
                        public void paintControl(PaintEvent e) {
@@ -28,7 +28,7 @@
  *
  */
 
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common;
+package org.tizen.emulator.manager.ui.renewal.item.modify.comp;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.PaintEvent;
@@ -1,4 +1,34 @@
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common;
+/*
+ * 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.comp;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.PaintEvent;
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/PropertyValue.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/PropertyValue.java
new file mode 100644 (file)
index 0000000..83d20f6
--- /dev/null
@@ -0,0 +1,291 @@
+/*
+ * 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.comp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.emulator.manager.devices.DeviceTemplateValue;
+import org.tizen.emulator.manager.devices.SubDevice;
+import org.tizen.emulator.manager.devices.SubDeviceItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.CheckItemData;
+import org.tizen.emulator.manager.vms.RESOLUTION;
+import org.tizen.emulator.manager.vms.VMPropertyValue;
+
+public class PropertyValue {
+
+       // VMPropertyValue or DeviceTemplateValue
+       private VMPropertyValue vmValue;
+       private DeviceTemplateValue templateValue;
+
+
+       public PropertyValue(Object value) {
+               if (value instanceof VMPropertyValue) {
+                       vmValue = (VMPropertyValue)value;
+
+               } else if (value instanceof DeviceTemplateValue) {
+                       templateValue = (DeviceTemplateValue)value;
+               }
+       }
+
+
+       private boolean isVMValue() {
+               return vmValue != null;
+       }
+
+
+       private boolean isTemplateValue() {
+               return templateValue != null;
+       }
+
+
+       public String getName() {
+               if (isVMValue()) {
+                       return vmValue.vmsName;
+
+               } else if (isTemplateValue()){
+                       return templateValue.getName();
+               }
+
+               return "";
+       }
+
+
+       public void setName(String name) {
+               if (isVMValue()) {
+                       vmValue.vmsName = name;
+
+               } else if (isTemplateValue()) {
+                       templateValue.setName(name);
+               }
+       }
+
+
+       public String getImageName() {
+               if (isVMValue()) {
+                       return vmValue.baseImage.getName();
+               }
+               return "";
+       }
+
+
+       public String getProfile() {
+               if (isVMValue()) {
+                       return vmValue.baseImage.getProfile();
+               } else if (isTemplateValue()) {
+                       return templateValue.getProfile();
+               }
+               return "";
+       }
+
+
+       public void setProfile(String profile) {
+               if (isVMValue()) {
+                       // do nothing
+               } else if (isTemplateValue()) {
+                       templateValue.setProfile(profile);
+               }
+       }
+
+       public void setResolution(RESOLUTION r) {
+               if (isVMValue()) {
+                       vmValue.resolution = r;
+
+               } else if (isTemplateValue()) {
+                       templateValue.setResolution(r);
+//                     templateValue.setDisplayWidth(r.getResolution().getWidth());
+//                     templateValue.setDisplayHeight(r.getResolution().getHeight());
+               }
+       }
+
+
+       public RESOLUTION getResolution() {
+               if (isVMValue()) {
+                       return vmValue.resolution;
+
+               } else if (isTemplateValue()) {
+                       return templateValue.getResolution();
+               }
+               return null;
+       }
+
+
+       public void setDisplaySize(double displaySize) {
+               if (isVMValue()) {
+                       // nothing
+
+               } else if (isTemplateValue()) {
+                       templateValue.setDisplaySize(displaySize);
+               }
+       }
+
+       public double getDisplaySize() {
+               if (isVMValue()) {
+
+
+               } else if (isTemplateValue()) {
+                       return templateValue.getDisplaySize();
+               }
+               return 0.0;
+       }
+
+       public void setDisplayWidth(int displayWidth) {
+               if (isVMValue()) {
+                       // TODO
+
+               } else if (isTemplateValue()) {
+                       templateValue.setDisplayWidth(displayWidth);
+               }
+       }
+
+       public int getDisplayWidth() {
+               if (isVMValue()) {
+                       // TODO
+
+               } else if (isTemplateValue()) {
+                       return templateValue.getDisplayWidth();
+               }
+               return 0;
+       }
+
+
+       public void setDisplayHeight(int displayHeight) {
+               if (isVMValue()) {
+                       // TODO
+
+               } else if (isTemplateValue()) {
+                       templateValue.setDisplayHeight(displayHeight);
+               }
+       }
+
+       public int getDisplayHeight() {
+               if (isVMValue()) {
+                       // TODO
+
+               } else if (isTemplateValue()) {
+                       return templateValue.getDisplayHeight();
+               }
+               return 0;
+       }
+
+
+       public int getRamSize() {
+               if (isVMValue()) {
+                       return vmValue.ramSize;
+
+               } else if (isTemplateValue()) {
+                       return templateValue.getRamSize();
+               }
+               return 0;
+       }
+
+       public void setRamSize(int ramSize) {
+               if (isVMValue()) {
+                       vmValue.ramSize = ramSize;
+
+               } else if (isTemplateValue()) {
+                       templateValue.setRamSize(ramSize);
+               }
+       }
+
+       public void setCpuNum(int cpuNum) {
+               if (isVMValue()) {
+                       vmValue.cpu = cpuNum;
+
+               } else if (isTemplateValue()) {
+                       templateValue.setCpuCount(cpuNum);
+               }
+       }
+
+       public int getCpuNum() {
+               if (isVMValue()) {
+                       return vmValue.cpu;
+
+               } else if (isTemplateValue()) {
+                       return templateValue.getCpuCount();
+               }
+               return 1;
+       }
+
+
+       public void setCheckOptions(String name,
+                       List<CheckItemData> dataList) {
+               if (isVMValue()) {
+                       // TODO
+
+               } else if (isTemplateValue()) {
+                       SubDevice subDevice = new SubDevice(name);
+                       for (CheckItemData data : dataList) {
+                               SubDeviceItem subDeviceItem = new SubDeviceItem(data.getName());
+                               subDeviceItem.setSupport(data.isChecked());
+                               subDevice.addSubDeviceItem(subDeviceItem);
+                       }
+                       // TODO add is OK?
+                       templateValue.getAdditionalDevices().add(subDevice);
+               }
+       }
+
+
+       public List<CheckItemData> getCheckOptions(String name) {
+               List<CheckItemData> dataList = new ArrayList<CheckItemData>();
+               // TODO
+               if (isVMValue()) {
+                       // TODO
+
+               } else if (isTemplateValue()) {
+                       for (SubDevice subDevice : templateValue.getAdditionalDevices()) {
+                               if (subDevice.getName().equals(name)) {
+                                       for (SubDeviceItem subDeviceItem : subDevice.getItems()) {
+                                               CheckItemData data = new CheckItemData(
+                                                               subDeviceItem.getId(), "", subDeviceItem.isSupport());
+                                               dataList.add(data);
+                                       }
+                               }
+                       }
+               }
+               return dataList;
+       }
+
+
+//     public
+/*
+       public RESOLUTION getResolution() {
+               if (isVMValue()) {
+                       vmValue.
+
+               } else if (isTemplateValue()) {
+                       templateValue.
+               }
+       }
+       */
+}
@@ -1,4 +1,34 @@
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common;
+/*
+ * 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.comp;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.PaintEvent;
@@ -39,6 +69,10 @@ public class SubTreeItemTitle extends ItemTitle {
                iconCanvas.setLayoutData(data);
 
                // draw icon
+               if (iconResource == null) {
+                       return;
+               }
+
                iconCanvas.addPaintListener(new PaintListener() {
                        @Override
                        public void paintControl(PaintEvent e) {
  *
  */
 
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+package org.tizen.emulator.manager.ui.renewal.item.modify.comp;
 
-import org.eclipse.swt.widgets.Composite;
-import org.tizen.emulator.manager.renewal.resources.ImageResources;
-import org.tizen.emulator.manager.vms.VMProperty;
+import org.eclipse.swt.layout.GridData;
 
-public class VMNameItem extends TextLabelItem {
 
-       private final String TITLE = "VM Name";
-       private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_VMNAME;
+public class SubTreeModifyItem extends ModifyItem{
 
-       @Override
-       public void create(Composite parent) {
-               create(parent, TITLE, TITLE_ICON_RESOURCE);
-       }
-
-       @Override
-       public void setInitialValue(VMProperty property) {
-               if (property == null) {
-                       return;
+       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;
                }
-               value = property.getName();
-       }
+               comp.setLayoutData(data);
 
+       }
 
+//     @Override
+//     @Override
+//     public int getHeight() {
+//             System.out.println(comp.getSize().y);
+//             if (comp.isVisible()) {
+//                     return super.getHeight();
+//             }
+//             return 0;
+//
+//     }
 }
  */
 
 
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common;
+package org.tizen.emulator.manager.ui.renewal.item.modify.comp;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.tizen.emulator.manager.ui.renewal.item.modify.vm.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
 
 public class TreeModifyItem extends ModifyItem{
 
@@ -49,7 +49,7 @@ public class TreeModifyItem extends ModifyItem{
                for (SubTreeModifyItem subItem : subItemList) {
                        subItem.changeExpanding(isExpand);
                }
-               modifyDialogItem.getParentDialog().layoutScrolledComposite();
+               modifyDialogItem.getDialog().layoutScrolledComposite();
        }
 
        public void setModifyDialogItem(ModifyDialogItem modifyDialogItem) {
  *
  */
 
+package org.tizen.emulator.manager.ui.renewal.item.modify.template;
 
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+import java.util.ArrayList;
+import java.util.List;
 
 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;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.CheckBoxItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.CheckItemData;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
 
-public class SensorItem extends CheckBoxItem {
+public class CameraItem extends CheckBoxItem {
 
-       private final SubTreeModifyItem item;
+       private final ModifyItem item;
 
-       private final String TITLE = "Sensor";
-       private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_SENSOR;
+       private static final String TITLE = "Camera";
+       private static final String NAME = "camera";
+//     private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_SENSOR;
 
-       private static final int NUM_COLUMN = 3;
+       private static final int NUM_COLUMN = 2;
+
+       // TODO load from xml
+       private static final List<CheckItemData> dataList =
+                       new ArrayList<CheckItemData>();
+       private void initDataList() {
+               dataList.add(new CheckItemData("rear", "Rear"));
+               dataList.add(new CheckItemData("front", "Front"));
+       }
 
-       // 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();
+       public CameraItem() {
+               super(NAME, TITLE, NUM_COLUMN);
+               initDataList();
+               setDataList(dataList);
+               item = new ModifyItem();
                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.setItemTitle(createIconTitle(item, null));
                item.create();
 
                createCheckBoxItems(item);
@@ -74,12 +81,4 @@ public class SensorItem extends CheckBoxItem {
                return item.getHeight();
        }
 
-       @Override
-       public void setInitialValue(VMProperty property) {
-               // TODO Auto-generated method stub
-
-       }
-
-
-
 }
index 9d837bc..429dfb0 100644 (file)
 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.item.modify.common.ComboItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.TreeItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.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 static final String TITLE = "Device";
+       private static final String NAME = "deviceTemplate";
        private final TreeModifyItem item;
 
        private final int COMBO_WIDTH = 200;
@@ -49,13 +51,14 @@ public class DeviceTemplateItem extends ComboItem {
        }
 
        public DeviceTemplateItem() {
+               super(NAME, TITLE);
                item = new TreeModifyItem();
        }
 
        @Override
        public void create(Composite parent) {
                item.init(parent);
-               item.setItemTitle(new TreeItemTitle(item, TITLE));
+               item.setItemTitle(new TreeItemTitle(item, getTitle()));
                item.create();
 
                item.setModifyDialogItem(this);
@@ -69,7 +72,7 @@ public class DeviceTemplateItem extends ComboItem {
        }
 
        @Override
-       public void setInitialValue(VMProperty property) {
+       public void setInitialValue(PropertyValue value) {
                // TODO Auto-generated method stub
 
        }
@@ -80,4 +83,10 @@ public class DeviceTemplateItem extends ComboItem {
                System.out.println("item selected:" + comboBox.getSelectedItem());
 
        }
+
+       @Override
+       public void setValue(PropertyValue value) {
+               // TODO Auto-generated method stub
+
+       }
 }
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
deleted file mode 100644 (file)
index c1595b5..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * 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;
-       }
-
-
-
-}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ProfileItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ProfileItem.java
deleted file mode 100644 (file)
index 7c2f10d..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.graphics.Image;
-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.IconItemTitle;
-import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.ModifyItem;
-import org.tizen.emulator.manager.vms.VMProperty;
-
-public class ProfileItem extends ModifyDialogItem {
-
-       private ModifyItem item;
-       private Canvas canvas;
-       private String profile = "";
-
-       private final String TITLE = "Profile";
-       private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_PROFILE;
-       private final String MOBILE = "mobile";
-       private final String WEARABLE = "wearable";
-       private final String TV = "tv";
-       private final int PROFILE_IMAGE_WIDTH = 34;
-       private final int PROFILE_IMAGE_HEIGHT = 25;
-
-
-       private void addProfileImage() {
-               item.setBodyLayoutDefault();
-
-               // init canvas
-               GridData data = new GridData(PROFILE_IMAGE_WIDTH, PROFILE_IMAGE_HEIGHT);
-               data.verticalAlignment = SWT.CENTER;
-               data.grabExcessVerticalSpace = true;
-               canvas = new Canvas(item.getBody(), SWT.NONE);
-               canvas.setLayoutData(data);
-
-               // set image
-               Image profileImage = getProfileImage(profile);
-               if (profileImage != null) {
-                       canvas.setBackgroundImage(profileImage);
-               }
-       }
-
-       private Image getProfileImage(String profile) {
-               if (profile.equals(MOBILE)) {
-                       return ImageResources.BTN_PROFILE_MOBILE_SELECTED.getImage();
-
-               } else if (profile.equals(WEARABLE)) {
-                       return ImageResources.BTN_PROFILE_WEARABLE_SELECTED.getImage();
-
-               } else if (profile.equals(TV)) {
-                       return ImageResources.BTN_PROFILE_TV_SELECTED.getImage();
-               }
-
-               return null;
-       }
-
-       @Override
-       public void setInitialValue(VMProperty property) {
-               if (property == null) {
-                       return;
-               }
-               this.profile = property.getImageProfile();
-
-       }
-
-       @Override
-       public int getHeight() {
-               return item.getHeight();
-       }
-
-       @Override
-       public void create(Composite parent) {
-               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/common/SubTreeModifyItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/SubTreeModifyItem.java
deleted file mode 100644 (file)
index eb8680a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-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;
-//
-//     }
-}
index db1e30e..e2dfa4d 100644 (file)
@@ -46,6 +46,7 @@ import org.eclipse.swt.widgets.Shell;
 import org.tizen.emulator.manager.EmulatorManager;
 import org.tizen.emulator.manager.devices.DeviceTemplate;
 import org.tizen.emulator.manager.devices.DeviceTemplateValue;
+import org.tizen.emulator.manager.dialoghandler.renewal.DeviceTemplateDialogHandler;
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.platform.Profile;
 import org.tizen.emulator.manager.platform.ProfileList;
@@ -203,7 +204,7 @@ public class DeviceTemplateTableViewer extends AbstractTableViewer {
                });
        }
 
-       private String[] titles = {"Type", "Name", "Resolution", "Display Size", "Ram", "Processor"};
+       private final String[] titles = {"Type", "Name", "Resolution", "Display Size", "Ram", "Processor"};
        private void makeTable() {
                table = new Table(comp, SWT.BORDER);
 
@@ -367,6 +368,7 @@ public class DeviceTemplateTableViewer extends AbstractTableViewer {
                        public void handleEvent(Event event) {
                                if (event.type == SWT.Selection) {
                                        // TODO
+                                       DeviceTemplateDialogHandler.create(null);
                                }
                        }
                });
@@ -398,7 +400,12 @@ public class DeviceTemplateTableViewer extends AbstractTableViewer {
                        @Override
                        public void handleEvent(Event event) {
                                if (event.type == SWT.Selection) {
-                                       // TODO
+
+                                       // TODO check please
+                                       TableItem[] items = table.getSelection();
+                                       DeviceTemplate deviceTemplate = (DeviceTemplate)items[0].getData();
+                                       DeviceTemplateDialogHandler.modify(deviceTemplate.getValue());
+
                                }
                        }
                });
@@ -529,7 +536,7 @@ public class DeviceTemplateTableViewer extends AbstractTableViewer {
                table.setLayoutData(workerButtonData);
        }
 
-       private NinePatchResourceInfo normalInfo = new NinePatchResourceInfo(ColorResources.TABLE_VIEWER_BG,
+       private final NinePatchResourceInfo normalInfo = new NinePatchResourceInfo(ColorResources.TABLE_VIEWER_BG,
                        ColorResources.TABLE_VIEWER_BG,
                        null, //left top
                        ImageResources.BACK_BTN_NORMAL_C, // top -> center
@@ -540,7 +547,7 @@ public class DeviceTemplateTableViewer extends AbstractTableViewer {
                        null, // left bottom
                        ImageResources.BACK_BTN_NORMAL_L); // left
 
-       private NinePatchResourceInfo hoverInfo = new NinePatchResourceInfo(ColorResources.TABLE_VIEWER_BG,
+       private final NinePatchResourceInfo hoverInfo = new NinePatchResourceInfo(ColorResources.TABLE_VIEWER_BG,
                        ColorResources.TABLE_VIEWER_BG,
                        null, //left top
                        ImageResources.BACK_BTN_HOVER_C, // top -> center
index 21119e9..9f22916 100644 (file)
@@ -42,7 +42,7 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Listener;
-import org.tizen.emulator.manager.handler.renewal.VMModifyHandler;
+import org.tizen.emulator.manager.dialoghandler.renewal.VMModifyHandler;
 import org.tizen.emulator.manager.platform.Profile;
 import org.tizen.emulator.manager.platform.ProfileList;
 import org.tizen.emulator.manager.renewal.resources.ImageResources;
index 01e0877..70a17d7 100644 (file)
@@ -180,6 +180,7 @@ public class CheckBoxButton extends Canvas {
        public void setSelection(boolean selected) {
                checkWidget();
                isSelected = selected;
+               redraw();
        }
 
        public boolean isSelection() {
index 8f3a867..3a8b205 100644 (file)
@@ -82,10 +82,6 @@ public class ComboBox extends NinePatchBox {
                createText();
                addMouseListener();
 
-               // TODO for test
-               items.add("combo 1");
-               items.add("combo 2");
-               items.add("combo 3");
        }
 
 
index 114a103..5fbc05e 100644 (file)
@@ -284,7 +284,6 @@ public class ComboBoxPopup {
                popupCanvas.addDisposeListener(new DisposeListener() {
                        @Override
                        public void widgetDisposed(DisposeEvent e) {
-                               System.out.println("popup disposing");
                                if (popupImage != null) {
                                        popupImage.dispose();
                                        popupImage = null;
index 1b139d3..a4130a0 100644 (file)
@@ -473,10 +473,12 @@ public class ImageButton extends Canvas {
                redraw();
        }
 
+
        public boolean isSelection() {
                return selected;
        }
 
+
        private void selectRadio() {
                Control[] children = parent.getChildren();
                for (int i = 0; i < children.length; i++) {
diff --git a/src/org/tizen/emulator/manager/ui/renewal/widgets/ImageRadioButton.java b/src/org/tizen/emulator/manager/ui/renewal/widgets/ImageRadioButton.java
new file mode 100644 (file)
index 0000000..fc12f28
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * 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.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+
+public class ImageRadioButton extends Canvas {
+
+       WStateImageMap images = new WStateImageMap();
+       WSTATE state = WSTATE.NORMAL;
+
+       private final boolean isSelected = false;
+
+       public ImageRadioButton(Composite parent) {
+               super(parent, SWT.DOUBLE_BUFFERED | SWT.RADIO);
+               addMouseListener();
+               addPaintListener();
+       }
+
+       public void setImage(WSTATE state, ImageResources imageResource) {
+               images.put(state, imageResource);
+       }
+
+
+       private void addPaintListener() {
+               this.addPaintListener(new PaintListener() {
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               Image image = images.get(state);
+
+                               if (image != null) {
+                                       GC gc = e.gc;
+                                       Rectangle imgRect = image.getBounds();
+                                       gc.drawImage(image, imgRect.x, imgRect.y);
+                               }
+                       }
+               });
+       }
+
+
+       private void addMouseListener() {
+               Listener mouseListener = new Listener() {
+                       @Override
+                       public void handleEvent(Event e) {
+                               if (e.type == SWT.MouseEnter) {
+                                       if (state == WSTATE.SELECTED) {
+                                               return;
+                                       }
+                                       state = WSTATE.HOVER;
+                                       redraw();
+
+                               } else  if (e.type == SWT.MouseExit) {
+                                       if (state == WSTATE.SELECTED) {
+                                               return;
+                                       }
+                                       state = WSTATE.NORMAL;
+                                       redraw();
+
+
+                               } if (e.type == SWT.MouseUp) {
+                                       Rectangle rect = ((Canvas)e.widget).getClientArea();
+                                       if (rect.contains(e.x, e.y)) {
+                                               selectRadio();
+                                               notifyListeners(SWT.Selection, new Event());
+                                       }
+                               }
+                       }
+               };
+               this.addListener(SWT.MouseEnter, mouseListener);
+               this.addListener(SWT.MouseExit, mouseListener);
+               this.addListener(SWT.MouseUp, mouseListener);
+       }
+
+
+       public void setState(WSTATE state) {
+               this.state = state;
+       }
+
+
+       public void selectRadio() {
+               Control[] children = this.getParent().getChildren();
+               for (int i = 0; i < children.length; i++) {
+                       Control child = children[i];
+                       if (child instanceof ImageRadioButton && child != this) {
+                               ((ImageRadioButton) child).setState(WSTATE.NORMAL);
+                               child.redraw();
+                       }
+               }
+               setState(WSTATE.SELECTED);
+               redraw();
+       }
+
+//     public void setSelection(boolean selected) {
+//             state = WSTATE
+//             if (selected) {
+//                     state = WSTATE.SELECTED;
+//             }
+//     }
+
+//     private void setSelection(boolean selected) {
+//             if (selected) {
+//                     state = (state == WSTATE.DISABLE_OFF) ? state : WSTATE.SELECTED;
+//                     this.selected = true;
+//             } else {
+//                     state = state != WSTATE.DISABLE_ON ? WSTATE.NORMAL : WSTATE.DISABLE_ON;
+//                     this.selected = false;
+//             }
+//     }
+
+}
  *
  */
 
+package org.tizen.emulator.manager.ui.renewal.widgets;
 
-package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
+import org.eclipse.swt.widgets.Composite;
 
-import org.tizen.emulator.manager.ui.renewal.dialog.VMModifyDialog;
+public class ProfileImageButton extends ImageButton {
 
-public abstract class ModifyDialogItem implements IModifyDialogItem {
-       private VMModifyDialog parentDialog;
+       private String profile;
 
-       public VMModifyDialog getParentDialog() {
-               return parentDialog;
+       public ProfileImageButton(Composite parent, int style) {
+               super(parent, style);
+               // TODO Auto-generated constructor stub
        }
 
-       public void setParentDialog(VMModifyDialog parentDialog) {
-               this.parentDialog = parentDialog;
+       public void setProfile(String profile) {
+               this.profile = profile;
        }
 
+
 }
index 1f3de7e..d2bddee 100644 (file)
@@ -71,10 +71,18 @@ public class TextInputBox extends NinePatchBox{
                return ninePatchResourceMap;
        }
 
+       public Text getTextWidget() {
+               return text;
+       }
+
        public void setText(String value) {
                text.setText(value);
        }
 
+       public String getValue() {
+               return text.getText();
+       }
+
        private void initBox() {
                GridLayout layout = new GridLayout();
                layout.marginHeight = TEXT_MARGIN_HEIGHT;
diff --git a/src/org/tizen/emulator/manager/ui/renewal/widgets/WStateImageMap.java b/src/org/tizen/emulator/manager/ui/renewal/widgets/WStateImageMap.java
new file mode 100644 (file)
index 0000000..8582a9b
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * 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.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Image;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+
+public class WStateImageMap {
+
+       Map<WSTATE, ImageResources> resources = new HashMap<WSTATE, ImageResources>();
+       Map<WSTATE, Image> images = new HashMap<WSTATE, Image>();
+
+       public void put(WSTATE state, ImageResources imageResource) {
+               resources.put(state, imageResource);
+       }
+
+
+       public Image get(WSTATE state) {
+               Image img = images.get(state);
+               if (img == null) {
+                       ImageResources imageResource = resources.get(state);
+                       if (imageResource == null) {
+                               return null;
+                       }
+
+                       img = imageResource.getImage();
+                       images.put(state, img);
+               }
+
+               return img;  // can be null
+       }
+}