UI: Improved warning/error indication.
authorminkee.lee <minkee.lee@samsung.com>
Thu, 22 Jan 2015 12:56:26 +0000 (21:56 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Sat, 2 May 2015 07:51:48 +0000 (16:51 +0900)
- When create or modify VM, added validation of each option value.
  Invalid option is indicated with different color and message in status-bar.

Change-Id: I5979dcceb1f33014ab47933c6b46b0904efc8dd3
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
55 files changed:
common-project/src/org/tizen/emulator/manager/resources/ColorResources.java
common-project/src/org/tizen/emulator/manager/resources/FontResources.java
common-project/src/org/tizen/emulator/manager/tool/CheckVirtualization.java
common-project/src/org/tizen/emulator/manager/tool/TapUtil.java
common-project/src/org/tizen/emulator/manager/ui/MainDialog.java
common-project/src/org/tizen/emulator/manager/ui/StatusBar.java
common-project/src/org/tizen/emulator/manager/ui/UIHelper.java [new file with mode: 0644]
common-project/src/org/tizen/emulator/manager/ui/VMStatusBar.java [new file with mode: 0644]
common-project/src/org/tizen/emulator/manager/ui/VMsDetailView.java
common-project/src/org/tizen/emulator/manager/ui/detail/DetailViewPage.java
common-project/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java
common-project/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/AdvancedViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItemChangeListener.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/IModifyViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/IViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/ItemState.java [new file with mode: 0644]
common-project/src/org/tizen/emulator/manager/ui/detail/item/ItemValidator.java [new file with mode: 0644]
common-project/src/org/tizen/emulator/manager/ui/detail/item/LineLabelViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/ViewItem.java [new file with mode: 0644]
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/BaseImageViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/DisplayViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/FileShareOnOffSubViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/FileShareViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/GPUSupportSubViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/HWSupportViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/MaxTouchViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/NetConnectTypeViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/NetDnsViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/NetIPInfoDHCPSubViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/NetIPInfoTextSubViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/NetIPInfoViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/NetProxyViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/NetTapDeviceViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/ProcessorViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/RamSizeItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/VMNameViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/CheckLabelViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/CheckSubViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboSubViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/DetailSubViewItem.java [moved from common-project/src/org/tizen/emulator/manager/ui/detail/item/template/SubViewItem.java with 67% similarity]
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileSubViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/FileViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ISubViewItem.java [deleted file]
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/LabelViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/OnOffSubViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/OnOffViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/SpinnerSubViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/TextSubViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/TextViewItem.java
common-project/src/org/tizen/emulator/manager/ui/widgets/ImageLabel.java
common-project/src/org/tizen/emulator/manager/ui/widgets/ItemCategoryLabel.java [new file with mode: 0644]
common-project/src/org/tizen/emulator/manager/vms/helper/HelperClass.java

index 2aa3eb2..1f8cc8b 100644 (file)
@@ -55,6 +55,7 @@ public enum ColorResources {
        GOLDENROD("goldenrod", new RGB(212, 150, 57)),
        TURQUOISE("turquoise", new RGB(72, 194, 168)),
        ORANGE("orange", new RGB(236, 107, 47)),
+       ORANGERED("orangeRed", new RGB(255,69,0)),
        YELLOWGREEN("yellowgreen", new RGB(129, 172, 50)),
        SKYBLUE("skyblue", new RGB(72, 185, 221)),
        ORCHID("orchid", new RGB(175, 49, 200)),
@@ -109,7 +110,14 @@ public enum ColorResources {
 
        /** status bar **/
        STATUS_BAR_COLOR("status_bar_color", new RGB(106, 119, 125)),
-       STATUS_BAR_FONT_COLOR("status_bar_font_color", new RGB(255, 255, 255));
+       STATUS_BAR_FONT_COLOR("status_bar_font_color", new RGB(255, 255, 255)),
+
+       /** warning/error color **/
+       WARNING_FONT("warningFont", new RGB(243, 134, 29)),
+       ERROR_FONT("errorFont", new RGB(226, 30, 40)),
+       CATEGORY_WARNING_BG("categoryWarningBg", new RGB(240, 178, 73)),
+       CATEGORY_ERROR_BG("categoryErrorBg", new RGB(217, 83, 79)),
+       STATUS_WARNING_FONT("statusWarningFont", new RGB(231, 119, 37));
 
        String name;
        Color color;
index 312744c..df667d4 100644 (file)
-/*\r
- * Emulator Manager\r
- *\r
- * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact:\r
- * JiHye Kim <jihye1128.kim@samsung.com>\r
- * SeokYeon Hwang <syeon.hwang@samsung.com>\r
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
- *\r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- *\r
- */\r
-\r
-package org.tizen.emulator.manager.resources;\r
-\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.graphics.Font;\r
-import org.eclipse.swt.graphics.FontData;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.tizen.emulator.manager.EmulatorManager;\r
-\r
-public enum FontResources {\r
-       // * Toolbal Layout\r
-       // Main Title\r
-       TITLEBAR("titlebar", resizeDefaultFont(10)),\r
-       // Device Name\r
-       COMBO("combo", resizeDefaultFont(9)),\r
-       // Application Name\r
-       DROPDOWN("dropdown", resizeDefaultFont(9)),\r
-       // Timer\r
-       TIMER("timer", resizeDefaultFont(12)),\r
-\r
-       // * Tab Layout\r
-       TAB_BUTTON_FONT("tab_button_font", setDefaultFontStyleAndSize(SWT.BOLD, 9)),\r
-\r
-       // * List Layout\r
-       VM_BUTTON_TITLE_FONT("vm_button_title_font", setDefaultFontStyleAndSize(SWT.BOLD, 8)),\r
-       VM_BUTTON_FONT("vm_button_font", resizeDefaultFont(8)),\r
-\r
-       // * Detail Layout\r
-       DETAIL_TOP_FONT("detail_top_font", setDefaultFontStyleAndSize(SWT.BOLD, 10)),\r
-       DETAIL_TITLE_FONT("detail_title_font", resizeDefaultFont(9)),\r
-       DETAIL_LABEL_FONT("datail_label_font", resizeDefaultFont(8)),\r
-\r
-       // * Nomal button\r
-       BUTTON_FONT("button_font", resizeDefaultFont(9)),\r
-\r
-       // * Combo button\r
-       COMBO_BUTTON_FONT("combo_button_font", resizeDefaultFont(8)),\r
-\r
-       // * About Dlg.\r
-       ABOUT_TITLE("about_title", resizeDefaultFont(12)),\r
-       ABOUT_TEXT("about_text", resizeDefaultFont(9)),\r
-       DIALOG_BUTTON_FONT("dialog_button_font", resizeDefaultFont(10)),\r
-\r
-       // * Status bar\r
-       STATUS_BAR_FONT("status_bar_font", resizeDefaultFont(9)),\r
-\r
-       // * Radio button\r
-       RADIO_BUTTON_FONT("radio_button_font", resizeDefaultFont(8)),\r
-\r
-       // * Tree view\r
-       TREE_CREATE_FONT("tree_creaet_font", setDefaultFontStyleAndSize(SWT.BOLD, 9)),\r
-       TREE_HEADER_FONT("tree_header_font", resizeDefaultFont(9)),\r
-       TREE_ITEM_FONT("tree_item_font", resizeDefaultFont(8)),\r
-\r
-       // * not support\r
-       TOOLTIP("tooltip", resizeDefaultFont(9));\r
-\r
-       String name;\r
-       Font font;\r
-       FontData[] data;\r
-       FontResources(String name, FontData[] data) {\r
-               this.name = name;\r
-               this.data = data;\r
-       }\r
-\r
-       public Font getFont() {\r
-               return getFont(name, data);\r
-       }\r
-\r
-       public Font getFont(String fontName, FontData[] fontData) {\r
-               if (this.font == null) {\r
-                       this.font = new Font(Display.getCurrent(), fontData);\r
-               }\r
-               return font;\r
-       }\r
-\r
-       //private static FontRegistry fontRegistry = new FontRegistry();\r
-       private static Font defaultFont = null;\r
-       static {\r
-               defaultFont = getDADefaultFont();\r
-       }\r
-\r
-       public static FontData[] resizeDefaultFont(int size) {\r
-               if (defaultFont == null) {\r
-                       defaultFont = getDADefaultFont();\r
-               }\r
-\r
-               if (EmulatorManager.isMac()) {\r
-                       size = size + 2;\r
-               }\r
-\r
-               FontData[] fontData = defaultFont.getFontData();\r
-               for (int i = 0; i < fontData.length; i++) {\r
-                       fontData[i].setHeight(size);\r
-               }\r
-               return fontData;\r
-       }\r
-\r
-       public static FontData[] setDefaultFontStyle(int style) {\r
-               if (defaultFont == null) {\r
-                       defaultFont = getDADefaultFont();\r
-               }\r
-               FontData[] fontData = defaultFont.getFontData();\r
-               for (int i = 0; i < fontData.length; i++) {\r
-                       fontData[i].setStyle(style);\r
-               }\r
-               return fontData;\r
-       }\r
-\r
-       public static FontData[] setDefaultFontStyleAndSize(int style, int size) {\r
-               if (defaultFont == null) {\r
-                       defaultFont = getDADefaultFont();\r
-               }\r
-\r
-               if (EmulatorManager.isMac()) {\r
-                       size = size + 2;\r
-               }\r
-\r
-               FontData[] fontData = defaultFont.getFontData();\r
-               for (int i = 0; i < fontData.length; i++) {\r
-                       fontData[i].setStyle(style);\r
-                       fontData[i].setHeight(size);\r
-               }\r
-               return fontData;\r
-       }\r
-\r
-       public static Font getDADefaultFont() {\r
-               if (defaultFont == null) {\r
-                       String fontName = null;\r
-                       if (EmulatorManager.isLinux()) {\r
-                               fontName = "Dejavu Sans";\r
-                       } else if (EmulatorManager.isWin()) {\r
-                               fontName = "Verdana";\r
-                       } else if (EmulatorManager.isMac()) {\r
-                               fontName = "Lucida Grande";\r
-                       } else {\r
-                               defaultFont = Display.getCurrent().getSystemFont();\r
-                               return defaultFont;\r
-                       }\r
-                       defaultFont = EmulatorManager.isMac()\r
-                                       ? new Font(Display.getCurrent(), new FontData[] { new FontData(fontName, 11, SWT.NORMAL) })\r
-                                       : new Font(Display.getCurrent(), new FontData[] { new FontData(fontName, 9, SWT.NORMAL) });\r
-               }\r
-\r
-               return defaultFont;\r
-       }\r
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@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.resources;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Display;
+import org.tizen.emulator.manager.EmulatorManager;
+
+public enum FontResources {
+       // * Toolbal Layout
+       // Main Title
+       TITLEBAR("titlebar", resizeDefaultFont(10)),
+       // Device Name
+       COMBO("combo", resizeDefaultFont(9)),
+       // Application Name
+       DROPDOWN("dropdown", resizeDefaultFont(9)),
+       // Timer
+       TIMER("timer", resizeDefaultFont(12)),
+
+       // * Tab Layout
+       TAB_BUTTON_FONT("tab_button_font", setDefaultFontStyleAndSize(SWT.BOLD, 9)),
+
+       // * List Layout
+       VM_BUTTON_TITLE_FONT("vm_button_title_font", setDefaultFontStyleAndSize(SWT.BOLD, 8)),
+       VM_BUTTON_FONT("vm_button_font", resizeDefaultFont(8)),
+
+       // * Detail Layout
+       DETAIL_TOP_FONT("detail_top_font", setDefaultFontStyleAndSize(SWT.BOLD, 10)),
+       DETAIL_TITLE_FONT("detail_title_font", resizeDefaultFont(9)),
+       DETAIL_TITLE_FONT_BOLD("detail_title_font", setDefaultFontStyleAndSize(SWT.BOLD, 9)),
+       DETAIL_LABEL_FONT("datail_label_font", resizeDefaultFont(8)),
+
+       // * Nomal button
+       BUTTON_FONT("button_font", resizeDefaultFont(9)),
+
+       // * Combo button
+       COMBO_BUTTON_FONT("combo_button_font", resizeDefaultFont(8)),
+
+       // * About Dlg.
+       ABOUT_TITLE("about_title", resizeDefaultFont(12)),
+       ABOUT_TEXT("about_text", resizeDefaultFont(9)),
+       DIALOG_BUTTON_FONT("dialog_button_font", resizeDefaultFont(10)),
+
+       // * Status bar
+       STATUS_BAR_FONT("status_bar_font", resizeDefaultFont(9)),
+       STATUS_BAR_SUB_FONT("status_bar_sub_font", resizeDefaultFont(8)),
+
+       // * Radio button
+       RADIO_BUTTON_FONT("radio_button_font", resizeDefaultFont(8)),
+
+       // * Tree view
+       TREE_CREATE_FONT("tree_creaet_font", setDefaultFontStyleAndSize(SWT.BOLD, 9)),
+       TREE_HEADER_FONT("tree_header_font", resizeDefaultFont(9)),
+       TREE_ITEM_FONT("tree_item_font", resizeDefaultFont(8)),
+
+       // * not support
+       TOOLTIP("tooltip", resizeDefaultFont(9));
+
+       String name;
+       Font font;
+       FontData[] data;
+       FontResources(String name, FontData[] data) {
+               this.name = name;
+               this.data = data;
+       }
+
+       public Font getFont() {
+               return getFont(name, data);
+       }
+
+       public Font getFont(String fontName, FontData[] fontData) {
+               if (this.font == null) {
+                       this.font = new Font(Display.getCurrent(), fontData);
+               }
+               return font;
+       }
+
+       //private static FontRegistry fontRegistry = new FontRegistry();
+       private static Font defaultFont = null;
+       static {
+               defaultFont = getDADefaultFont();
+       }
+
+       public static FontData[] resizeDefaultFont(int size) {
+               if (defaultFont == null) {
+                       defaultFont = getDADefaultFont();
+               }
+
+               if (EmulatorManager.isMac()) {
+                       size = size + 2;
+               }
+
+               FontData[] fontData = defaultFont.getFontData();
+               for (int i = 0; i < fontData.length; i++) {
+                       fontData[i].setHeight(size);
+               }
+               return fontData;
+       }
+
+       public static FontData[] setDefaultFontStyle(int style) {
+               if (defaultFont == null) {
+                       defaultFont = getDADefaultFont();
+               }
+               FontData[] fontData = defaultFont.getFontData();
+               for (int i = 0; i < fontData.length; i++) {
+                       fontData[i].setStyle(style);
+               }
+               return fontData;
+       }
+
+       public static FontData[] setDefaultFontStyleAndSize(int style, int size) {
+               if (defaultFont == null) {
+                       defaultFont = getDADefaultFont();
+               }
+
+               if (EmulatorManager.isMac()) {
+                       size = size + 2;
+               }
+
+               FontData[] fontData = defaultFont.getFontData();
+               for (int i = 0; i < fontData.length; i++) {
+                       fontData[i].setStyle(style);
+                       fontData[i].setHeight(size);
+               }
+               return fontData;
+       }
+
+       public static Font getDADefaultFont() {
+               if (defaultFont == null) {
+                       String fontName = null;
+                       if (EmulatorManager.isLinux()) {
+                               fontName = "Dejavu Sans";
+                       } else if (EmulatorManager.isWin()) {
+                               fontName = "Verdana";
+                       } else if (EmulatorManager.isMac()) {
+                               fontName = "Lucida Grande";
+                       } else {
+                               defaultFont = Display.getCurrent().getSystemFont();
+                               return defaultFont;
+                       }
+                       defaultFont = EmulatorManager.isMac()
+                                       ? new Font(Display.getCurrent(), new FontData[] { new FontData(fontName, 11, SWT.NORMAL) })
+                                       : new Font(Display.getCurrent(), new FontData[] { new FontData(fontName, 9, SWT.NORMAL) });
+               }
+
+               return defaultFont;
+       }
 }
\ No newline at end of file
index 26d7003..d8dfb22 100644 (file)
@@ -60,7 +60,6 @@ public class CheckVirtualization {
        private static boolean isGallium = false; // for ubuntu OS
        private static boolean isNonUG = false; // non-UG mode
 
-
        private CheckVirtualization() {
                // singleton class
        }
@@ -314,4 +313,5 @@ class ProcessOutputReader extends Thread {
                        msgList.clear();
                }
        }
+
 }
index 2923222..dc0a732 100644 (file)
@@ -734,25 +734,22 @@ public class TapUtil {
        static private final String IPV4_REGEX = "(([0-1]?[0-9]{1,2}\\.)|(2[0-4][0-9]\\.)|(25[0-5]\\.)){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))";
        static private Pattern IPV4_PATTERN = Pattern.compile(IPV4_REGEX);
 
-       public static boolean checkIPString(boolean widgetEnable, String ip,
+       public static String checkIPString(boolean widgetEnable, String ip,
                        String title) {
-               boolean result = true;
                String errMsg = "";
                if (widgetEnable == true) {
                        if (ip == null || ip.isEmpty()) {
                                errMsg = title + " cannot be empty!";
-                               result = false;
 
                        } else {
-                               result = IPV4_PATTERN.matcher(ip).matches();
-                               if (result == false) {
+                               boolean isMatch = IPV4_PATTERN.matcher(ip).matches();
+                               if (!isMatch) {
                                        errMsg = title + " is invalid!";
                                }
                        }
                }
 
-               HelperClass.setStatusBar(errMsg);
-               return result;
+               return errMsg;
        }
 
        public static boolean checkIP(String ip) {
index d33b705..1e60aee 100644 (file)
@@ -67,7 +67,7 @@ public class MainDialog {
        private static final String ICON_FILE_NAME = "res/em.ico";
 
        public static final int DEFALUT_WIDTH  = 840;
-       public static final int DEFAULT_HEIGHT = 482;
+       public static final int DEFAULT_HEIGHT = 493;
        public static final int MIN_HEIGHT      = 380;
        public static final int MIN_WIDTH       = 620;
        public static int WIDTH  = DEFALUT_WIDTH;
index c43e45f..d218132 100644 (file)
@@ -37,6 +37,7 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.tizen.emulator.manager.resources.ColorResources;
 import org.tizen.emulator.manager.resources.FontResources;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
 
 public class StatusBar {
        private Composite bar = null;
@@ -61,6 +62,7 @@ public class StatusBar {
 
        private boolean isError = false;
        private String message;
+
        public void info(String msg) {
                if (isError) {
                        return;
@@ -73,7 +75,7 @@ public class StatusBar {
                isError = true;
                message = msg;
                msgLabel.setText(message);
-               
+
        }
 
        public void reset() {
diff --git a/common-project/src/org/tizen/emulator/manager/ui/UIHelper.java b/common-project/src/org/tizen/emulator/manager/ui/UIHelper.java
new file mode 100644 (file)
index 0000000..2ea8511
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * sangho Park <sangho1204.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;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+
+public class UIHelper {
+
+       public static String shortenText(GC gc, String text, Rectangle clientRect) {
+               Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
+               int x = (clientRect.width - p.x) / 2;
+
+               if (x >= 0) {
+                       return text;
+
+               } else { // shorten text and add "..."
+                       String subStr = null;
+                       String ellipsis = "...";
+                       int fixedWidth;
+                       for(int i = text.length() ; i > 0 ; i--){
+                               subStr = text.substring(0, i);
+                               subStr += ellipsis;
+                               fixedWidth = gc.textExtent(subStr, SWT.DRAW_MNEMONIC).x;
+                               if(fixedWidth < clientRect.width){
+                                       break;
+                               }
+                       }
+                       return subStr;
+               }
+       }
+}
diff --git a/common-project/src/org/tizen/emulator/manager/ui/VMStatusBar.java b/common-project/src/org/tizen/emulator/manager/ui/VMStatusBar.java
new file mode 100644 (file)
index 0000000..c83c606
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * sangho Park <sangho1204.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;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.resources.ColorResources;
+import org.tizen.emulator.manager.resources.FontResources;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
+
+public class VMStatusBar {
+
+       private Composite comp;
+       private Canvas msgLabel;
+       private Image warningIcon;
+       private Image errorIcon;
+       private ItemState itemState = new ItemState(ItemState.NORMAL);
+
+       public VMStatusBar(Composite parent, int style) {
+               comp = new Composite(parent, style);
+               comp.setLayout(new FormLayout());
+               comp.setBackground(ColorResources.DETAIL_VIEW_PAGE_COLOR.getColor());
+       }
+
+       public void init(Object layoutData) {
+               comp.setLayoutData(layoutData);
+
+               msgLabel = new Canvas(comp, SWT.NONE);
+               msgLabel.setBackground(ColorResources.DETAIL_VIEW_PAGE_COLOR.getColor());
+               msgLabel.setFont(FontResources.STATUS_BAR_SUB_FONT.getFont());
+               FormData data = new FormData();
+               data = new FormData();
+               data.top        = new FormAttachment(0, 0);
+               data.left       = new FormAttachment(0, 0);
+               data.right      = new FormAttachment(100, 0);
+               data.bottom = new FormAttachment(100, 0);
+               msgLabel.setLayoutData(data);
+
+               addCompositeListener();
+               addPaintListener();
+
+       }
+
+       public void addPaintListener() {
+               msgLabel.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               Rectangle rect = ((Canvas)e.widget).getClientArea();
+                               GC gc = e.gc;
+
+                               String text = itemState.getDisplayMsg();
+                               ((Canvas)e.widget).setToolTipText(text);
+                               text = UIHelper.shortenText(gc, text, ((Canvas)e.widget).getClientArea());
+                               Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
+                               gc.setFont(msgLabel.getFont());
+
+                               // Clear status bar.
+                               gc.setBackground(ColorResources.DETAIL_VIEW_PAGE_COLOR.getColor());
+                               gc.fillRectangle(rect);
+
+                               // Draw text
+                               int x = 0, y = 0;
+                               y = (e.height - p.y) / 2;
+                               gc.setForeground(itemState.getStatusFontColor());
+                               gc.drawText(text, x+5, y, true);
+                       }
+               });
+       }
+
+       public void updateStatus(ItemState state) {
+               itemState = state;
+               msgLabel.redraw();
+       }
+
+       private void addCompositeListener() {
+               comp.addDisposeListener(new DisposeListener() {
+
+                       @Override
+                       public void widgetDisposed(DisposeEvent arg0) {
+                               if (warningIcon != null) {
+                                       warningIcon.dispose();
+                               }
+                               if (errorIcon != null) {
+                                       errorIcon.dispose();
+                               }
+                       }
+               });
+       }
+}
index db89a79..ca876dd 100644 (file)
@@ -46,7 +46,7 @@ public class VMsDetailView {
        private Composite parent = null;
        private Composite mainView = null;
        private int WIDTH  = 328;
-       private int HEIGHT = 430;
+       private int HEIGHT = 350;
 
        private DetailViewPage emptyView = null;
        private DetailViewPage detailView = null;
index 0f258f8..290d666 100644 (file)
@@ -55,7 +55,7 @@ public abstract class DetailViewPage {
        protected VMsDetailView parent  = null;
        protected Composite view                        = null;
        protected Composite itemListTop = null;
-       private Composite itemListBack          = null;
+       protected Composite itemListBack                = null;
        protected CustomScrolledComposite scrolledList= null;
        protected Composite itemList            = null;
        protected Composite buttonComp  = null;
@@ -64,7 +64,7 @@ public abstract class DetailViewPage {
        protected int itemListCount = 0;
 
        public int checkItemCountwithSize() {
-               int h = parent.getSize().y - 30 - 36 - 60;
+               int h = parent.getSize().y - 30 - 36 - 60 - (PModifyViewPage.statusBarHeight - 2);
                int middleH = ImageResources.DETAIL_LIST_MIDDLE.getImage().getImageData().height;
                int bottomH = ImageResources.DETAIL_LIST_BOTTOM.getImage().getImageData().height;
 
index 1cbc640..8234e00 100644 (file)
@@ -263,6 +263,7 @@ public class PInfoViewPage extends DetailViewPage {
 
                // draw button
                settingButtonStatus(property);
+
        }
 
        private void settingButtonStatus(VMProperty property) {
index cf098d4..101036c 100644 (file)
@@ -50,6 +50,7 @@ import org.tizen.emulator.manager.resources.ImageResources;
 import org.tizen.emulator.manager.resources.PatchImageResources;
 import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.ui.MainDialog;
+import org.tizen.emulator.manager.ui.VMStatusBar;
 import org.tizen.emulator.manager.ui.VMsDetailView;
 import org.tizen.emulator.manager.ui.VMsMainView;
 import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
@@ -57,6 +58,8 @@ import org.tizen.emulator.manager.ui.detail.item.DetailViewItemChangeListener;
 import org.tizen.emulator.manager.ui.detail.item.IItemListFactory;
 import org.tizen.emulator.manager.ui.detail.item.IModifyViewItem;
 import org.tizen.emulator.manager.ui.detail.item.ItemChangeState;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
+import org.tizen.emulator.manager.ui.detail.item.ItemValidator;
 import org.tizen.emulator.manager.ui.dialog.MessageDialog;
 import org.tizen.emulator.manager.ui.widgets.ImageButton;
 import org.tizen.emulator.manager.vms.VMProperty;
@@ -70,6 +73,13 @@ public class PModifyViewPage extends DetailViewPage
                super(parent, style);
        }
 
+       private static VMStatusBar statusBar;
+       public static VMStatusBar getStatusBar() {
+               return statusBar;
+       }
+       private ItemValidator currentStatusBarItem;
+       public static final int statusBarHeight = 14;
+
        private ImageButton cancelButton;
        private boolean isCreateMode = false;
 
@@ -96,8 +106,16 @@ public class PModifyViewPage extends DetailViewPage
                cancelButton.setToolTipText("cancel modification of vm");
 
                topButton = cancelButton;
+
                makeButton();
                makeModifyView();
+               statusBar = new VMStatusBar(view, SWT.NONE);
+               FormData data = new FormData();
+               data.left       = new FormAttachment(0, 10);
+               data.right      = new FormAttachment(100, -13);
+               data.bottom = new FormAttachment(buttonComp, -3);
+               data.height = statusBarHeight;
+               statusBar.init(data);
        }
 
        private static int CONFIRM_BUTTON_WIDTH  = 303;
@@ -278,32 +296,18 @@ public class PModifyViewPage extends DetailViewPage
        }
 
        @Override
-       public void changeConfirmButton() {
-               boolean isAvailable = true;
-               for (IModifyViewItem item : topViewList.itemList) {
-                       if (!item.checkValue()) {  // Check if confirm button available
-                               isAvailable = false;
-                               break;
-                       }
-               }
-               confirmButton.setEnabled(isAvailable);
+       public void changeCreateConfirmButton() {
+               boolean isConfirmAvailable = checkItemList();
+               // Update confirm button state.
+               confirmButton.setEnabled(isConfirmAvailable);
 
        }
 
        @Override
-       public void changeConfirmButton(DetailViewItem viewItem) {
-
-               // Check item value is valid.
-               boolean isAvailable = true;
-               for (IModifyViewItem item : topViewList.itemList) {
-                       if (!item.checkValue()) {
-                               isAvailable = false;
-                               break;
-                       }
-               }
-
+       public void changeModifyConfirmButton(DetailViewItem viewItem) {
+               boolean isConfirmAvailable = checkItemList();
                viewItem.setValue(newValue);
-               if (isAvailable) { // If valid, check if value is changed.
+               if (isConfirmAvailable) { // If valid, check if value is changed.
                        if (!oldValue.equals(newValue)) {
                                confirmButton.setEnabled(true);
                        } else {
@@ -315,6 +319,65 @@ public class PModifyViewPage extends DetailViewPage
 
        }
 
+       // Set item 's normal, warning, error state and
+       // return false if more than one error found.
+       private boolean checkItemList() {
+               boolean isValid = true;
+               DetailViewItem errorItem = null;
+
+               // Check Item state
+               for (IModifyViewItem item : topViewList.itemList) {
+                       if (item instanceof DetailViewItem) {
+                               DetailViewItem viewItem = (DetailViewItem)item;
+                               viewItem.checkValue();
+                               viewItem.updateItemUI(); // normal / warning / error
+
+                               if (viewItem.getItemState().isError()) {
+                                       if (errorItem == null || !errorItem.getItemState().isError()) {
+                                               errorItem = viewItem;
+                                       }
+
+                               } else if (viewItem.getItemState().isWarning()) {
+                                       if (errorItem == null || errorItem.getItemState().isNormal()) {
+                                               errorItem = viewItem;
+                                       }
+                               }
+
+                               if (viewItem.getItemState().isError()) {
+                                       isValid = false;
+                               }
+                       }
+               }
+
+               // Update status bar
+               if (errorItem == null) {
+                       statusBar.updateStatus(ItemState.CreateNormalState());
+
+               } else {
+                       statusBar.updateStatus(errorItem.getItemState());
+               }
+
+               // Mark current status bar item.
+               if (currentStatusBarItem != errorItem) {
+                       changeStatusBarItem(errorItem);
+               }
+
+               return isValid;
+       }
+
+       private void changeStatusBarItem(DetailViewItem item) {
+               if (item == null) {
+                       currentStatusBarItem.setItemMarked(false);
+
+               } else {
+                       item.setItemMarked(true);
+                       if (currentStatusBarItem != null) {
+                               currentStatusBarItem.setItemMarked(false);
+                       }
+               }
+               currentStatusBarItem = item;
+       }
+
        @Override
        public void ChangeState(ItemChangeState state) {
                if (state == ItemChangeState.CREATE) {
index 09015c1..e16f7ca 100644 (file)
@@ -34,6 +34,7 @@ package org.tizen.emulator.manager.ui.detail.item;
 import org.eclipse.swt.layout.FormAttachment;
 import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.vms.xml.template.Item;
 
 public abstract class AdvancedViewItem extends DetailViewItem {
 
@@ -43,7 +44,8 @@ public abstract class AdvancedViewItem extends DetailViewItem {
 
        protected LineLabelViewItem lineLabelViewItem;
 
-       public AdvancedViewItem(LineLabelViewItem lineLabelViewItem) {
+       public AdvancedViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
+               super(template);
                this.lineLabelViewItem = lineLabelViewItem;
        }
 
index 8be3483..1a5459f 100644 (file)
@@ -41,6 +41,7 @@ import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.FormAttachment;
 import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.layout.FormLayout;
@@ -50,23 +51,31 @@ import org.tizen.emulator.manager.resources.ColorResources;
 import org.tizen.emulator.manager.resources.FontResources;
 import org.tizen.emulator.manager.resources.ImageResources;
 import org.tizen.emulator.manager.ui.widgets.ImageButton;
+import org.tizen.emulator.manager.vms.VMPropertyValue;
+import org.tizen.emulator.manager.vms.xml.template.Item;
 
-public abstract class DetailViewItem implements IInfoViewItem, IModifyViewItem {
+public abstract class DetailViewItem extends ViewItem {
        protected Composite comp   = null;
        protected DetailViewItem upperItem = null;
        protected DetailViewItem downItem  = null;
        protected Canvas titleLabel;
-       protected String title;
        private boolean isCreateMode;
        protected boolean isMinMode = false;
        private boolean isViewMode;
 
+       protected Canvas stateLabel;
+
        protected ImageButton arrowButton;
        protected int count;
 
        protected DetailViewItem item;
 
        public DetailViewItem() {
+
+       }
+
+       public DetailViewItem(Item template) {
+               super(template.getName(), template.getTitle());
                this.item = this;
        }
 
@@ -78,16 +87,18 @@ public abstract class DetailViewItem implements IInfoViewItem, IModifyViewItem {
                return upperItem;
        }
 
-       @Override
        public void initItem(Composite parent, IInfoViewItem upperItem) {
                initItem(parent, (DetailViewItem) upperItem);
+               initStateLabel();
        }
 
-       @Override
        public void initItem(Composite parent, IModifyViewItem upperItem) {
                initItem(parent, (DetailViewItem) upperItem);
+               initStateLabel();
        }
 
+       public abstract void init();
+
        protected ArrayList<Composite> compList = new ArrayList<Composite>();
        protected static int ITEM_HEIGHT  = 20;
        protected static int ITEM_WIDTH  = 20;
@@ -151,7 +162,9 @@ public abstract class DetailViewItem implements IInfoViewItem, IModifyViewItem {
 
                        compList.add(comp);
                        up = comp;
+
                }
+               addCompListener();
 
                //comp = new Composite(parent, SWT.NONE);
                /*
@@ -172,6 +185,24 @@ public abstract class DetailViewItem implements IInfoViewItem, IModifyViewItem {
                initTitle(true);
        }
 
+       private void addCompListener() {
+               compList.get(0).addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               drawComp(e);
+                       }
+
+               });
+       }
+
+       public void drawComp(PaintEvent e) {
+               Rectangle rect = ((Composite)e.widget).getClientArea();
+               if (!itemState.isNormal()) {
+                       // fillBackground(e.gc, rect.x+1, rect.y-1, rect.width-2, rect.height);
+               }
+       }
+
        private void setDownItem(DetailViewItem down) {
                this.downItem = down;
        }
@@ -207,6 +238,7 @@ public abstract class DetailViewItem implements IInfoViewItem, IModifyViewItem {
                                        
                                }
                        });
+
                }
 
                titleLabel = new Canvas(compList.get(0), SWT.NONE);
@@ -258,6 +290,52 @@ public abstract class DetailViewItem implements IInfoViewItem, IModifyViewItem {
 
        }
 
+       protected void initStateLabel() {
+               stateLabel = new Canvas(compList.get(0), SWT.NONE);
+               FormData data = new FormData();
+               data.left       = new FormAttachment(titleLabel, 3); // 15
+               data.top        = new FormAttachment(titleLabel, 0, SWT.CENTER);  // 4
+               data.height = TITLE_HEIGHT - 5;  // 20 - 5
+               data.width  = TITLE_HEIGHT - 10;
+               stateLabel.setLayoutData(data);
+               stateLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
+               stateLabel.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               GC gc = e.gc;
+                               Canvas canvas = (Canvas)e.widget;
+
+                               if (!itemState.isNormal()) {
+
+                                       Rectangle rect = canvas.getClientArea();
+                                       // fillBackground(gc, rect.x, rect.y, rect.width, rect.height);
+
+                                       // Draw mark next to title label.
+                                       // "*" : Item which is showed in status bar.
+                                       // "" : Items that aren't showed in status bar.
+                                       String mark;
+                                       Point p;
+                                       gc.setForeground(itemState.getFontColor());
+                                       canvas.setToolTipText(itemState.getDisplayMsg());
+                                       int x = 0, y = 0;
+                                       if (itemState.isTitleMarked()) {
+                                               gc.setFont(titleLabel.getFont()); // font size 9
+                                               mark = "*";
+                                               p = gc.textExtent(mark, SWT.DRAW_MNEMONIC);
+
+                                       } else {
+                                               gc.setFont(FontResources.STATUS_BAR_SUB_FONT.getFont()); // font size 8
+                                               mark = "";
+                                               p = gc.textExtent(mark, SWT.DRAW_MNEMONIC);
+                                       }
+                                       y = (e.height - p.y) / 2;
+                                       gc.drawText(mark, x, y, true);
+                               }
+                       }
+               });
+       }
+
        protected void changeArrowState() {
                if (arrowButton == null) {
                        return;
@@ -331,31 +409,35 @@ public abstract class DetailViewItem implements IInfoViewItem, IModifyViewItem {
                }
 
                Point p = null;
-
                GC gc = e.gc;
-               gc.setFont(titleLabel.getFont());
 
+               // Draw text
+               if (itemState.isNormal()) {
+                       gc.setFont(titleLabel.getFont());
+
+               } else {
+                       gc.setFont(FontResources.DETAIL_TITLE_FONT_BOLD.getFont());
+               }
+               gc.setFont(titleLabel.getFont());
                int x = 0, y = 0;
                int offset = 0;
                p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
                x = 0;
                y = (e.height - p.y) / 2;
-
-               gc.setForeground(ColorResources.DETAIL_TITILE_FONT_COLOR.getColor());
+               gc.setForeground(itemState.getFontColor());
+               ((Canvas)e.widget).setToolTipText(itemState.getDisplayMsg());
                gc.drawText(text, x + offset , y, true);
+
        }
 
-       @Override
        public ArrayList<Composite> getCompositeList() {
                return compList;
        }
 
-       @Override
        public Composite getTopComposite() {
                return compList.get(0);
        }
 
-       @Override
        public Composite getBottomComposite() {
                return compList.get(compList.size()-1);
        }
@@ -426,4 +508,32 @@ public abstract class DetailViewItem implements IInfoViewItem, IModifyViewItem {
                closeItem();
        }
 
+       @Override
+       public ItemState checkValue() {
+               itemState.setNormal();
+               return itemState;
+       }
+
+       @Override
+       public void updateItemUI() {
+               if (titleLabel != null) {
+                       titleLabel.redraw();
+               }
+               if (stateLabel != null) {
+                       stateLabel.redraw();
+               }
+               if (compList != null && compList.get(0) != null) {
+                       compList.get(0).redraw();
+               }
+       }
+
+       @Override
+       public void setItemMarked(boolean marked) {
+               itemState.setTitleMarked(marked);
+               stateLabel.redraw();
+       }
+
+       public String getItemValue(VMPropertyValue value) {
+               return value.getAdvancedOptionValue(name);
+       }
 }
index d419787..8bfbfe5 100644 (file)
@@ -38,6 +38,6 @@ public interface DetailViewItemChangeListener {
        public void ChangeValue(DetailViewItem item);
        public void ChangeValue(boolean isChange);
        public void ChangeState(ItemChangeState state);
-       public void changeConfirmButton();
-       public void changeConfirmButton(DetailViewItem item);
+       public void changeCreateConfirmButton();
+       public void changeModifyConfirmButton(DetailViewItem item);
 }
index 82021db..5c89a86 100644 (file)
@@ -42,6 +42,6 @@ public interface IModifyViewItem extends IViewItem{
        public abstract void drawModify();      
        public abstract boolean settingModifyItem(VMPropertyValue value);
 
-       public boolean checkValue();
-       
+       public String getModifyValue(VMPropertyValue value);
+
 }
index 353bbfb..0a00340 100644 (file)
 
 package org.tizen.emulator.manager.ui.detail.item;
 
-import java.util.ArrayList;
-
-import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.vms.VMPropertyValue;
 
 public interface IViewItem {
        public int getCount();
        public void close();
-       public ArrayList<Composite> getCompositeList();
-       public Composite getTopComposite();
-       public Composite getBottomComposite();
+       public void init();
 
-       public abstract void init();
        public abstract void settingStatus(boolean isRefresh);
        public abstract void closeItem();
+
+       public String getItemValue(VMPropertyValue property);
 }
diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/ItemState.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/ItemState.java
new file mode 100644 (file)
index 0000000..3253b5b
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: *
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * Sangho Park<sangho1204.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.detail.item;
+
+import org.eclipse.swt.graphics.Color;
+import org.tizen.emulator.manager.resources.ColorResources;
+
+public class ItemState {
+       public static final int NORMAL = 0;
+       public static final int WARNING = 1;
+       public static final int ERROR = 2;
+
+       private int state = NORMAL;
+       private String msg = "";
+       private boolean isTitleMarked = false;
+
+       public ItemState() {
+
+       }
+
+       public boolean isTitleMarked() {
+               return isTitleMarked;
+       }
+
+       public void setTitleMarked(boolean isTitleMarked) {
+               this.isTitleMarked = isTitleMarked;
+       }
+
+       public Color getCategoryBGColor() {
+               if (state == WARNING) {
+                       return ColorResources.CATEGORY_WARNING_BG.getColor();
+
+               } else if (state == ERROR) {
+                       return ColorResources.CATEGORY_ERROR_BG.getColor();
+
+               } else {
+                       return ColorResources.TEAL.getColor();
+               }
+       }
+
+       public Color getFontColor() {
+               if (state == WARNING) {
+                       return ColorResources.WARNING_FONT.getColor();
+
+               } else if (state == ERROR) {
+                       return ColorResources.ERROR_FONT.getColor();
+
+               } else {
+                       return ColorResources.DETAIL_TITILE_FONT_COLOR.
+                                       getColor();
+               }
+       }
+
+       public Color getStatusFontColor() {
+               if (state == WARNING) {
+                       return ColorResources.STATUS_WARNING_FONT.getColor();
+
+               } else if (state == ERROR) {
+                       return ColorResources.ERROR_FONT.getColor();
+
+               } else {
+                       return ColorResources.DETAIL_TITILE_FONT_COLOR.
+                                       getColor();
+               }
+       }
+
+       public Color getBGColor() {
+               if (state == WARNING) {
+                       return ColorResources.CATEGORY_WARNING_BG.getColor();
+
+               } else if (state == ERROR) {
+                       return ColorResources.CATEGORY_ERROR_BG.getColor();
+
+               } else {
+                       return ColorResources.DETAIL_MIDDLE_COLOR.getColor();
+               }
+       }
+
+       public static ItemState CreateNormalState() {
+               return new ItemState();
+       }
+
+       public ItemState(int state) {
+               this.state = state;
+       }
+
+       public ItemState(int state, String msg) {
+               this.state = state;
+               this.msg = msg;
+       }
+
+       public void updateState(int state, String msg) {
+               this.state = state;
+               this.msg = msg;
+       }
+
+       public void updateState(ItemState state) {
+               this.state = state.getState();
+               this.msg = state.getMsg();
+       }
+
+       public int getState() {
+               return state;
+       }
+
+       public String getMsg() {
+               return msg;
+       }
+
+       public String getDisplayMsg() {
+               if (msg == null) {
+                       return "";
+
+               } else {
+                       if (isWarning()) {
+                               return "* (Warning) " + msg;
+
+                       } else if (isError()) {
+                               return "* " + msg;
+
+                       } else {
+                               return msg;
+                       }
+               }
+       }
+
+
+       public boolean isNormal() {
+               return state == NORMAL ;
+       }
+
+       public boolean isWarning() {
+               return state == WARNING;
+       }
+
+       public boolean isError() {
+               return state == ERROR;
+       }
+
+       public void setWarning(String msg) {
+               this.state = WARNING;
+               this.msg = msg;
+       }
+
+       public void setError(String msg) {
+               this.state = ERROR;
+               this.msg = msg;
+       }
+
+       public void setNormal() {
+               this.state = NORMAL;
+               this.msg = "";
+       }
+}
diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/ItemValidator.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/ItemValidator.java
new file mode 100644 (file)
index 0000000..e89de8d
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 20114 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Minkee Lee <minkee.lee@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.detail.item;
+
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+
+public abstract class ItemValidator implements IModifyViewItem {
+
+       protected ItemState itemState = ItemState.CreateNormalState();
+
+       public ItemState getItemState() {
+               return itemState;
+       }
+
+       // This changes item state in UI.
+       // And this can be overridden for each Item.
+       public abstract void updateItemUI();
+
+       // This tells that this item is being mentioned in status bar.
+       public abstract void setItemMarked(boolean marked);
+
+       // This should be overridden for each item if needed.
+       public ItemState checkValue() {
+               itemState.setNormal();
+               return itemState;
+       }
+
+       public void fillBackground(GC gc, int x, int y, int width, int height) {
+               gc.setBackground(itemState.getBGColor());
+               // gc.setAlpha(200);
+               gc.fillRectangle(x, y, width, height);
+       }
+
+       public void fillBackground(GC gc, Rectangle rect, int alpha) {
+               gc.setBackground(itemState.getBGColor());
+               gc.setAlpha(alpha);
+               gc.fillRectangle(rect);
+       }
+
+}
index b0d14f6..286db7f 100644 (file)
@@ -56,11 +56,8 @@ public class LineLabelViewItem extends DetailViewItem{
 
        private Map<String, AdvancedViewItem> itemMap = new HashMap<String, AdvancedViewItem>();
 
-       public LineLabelViewItem() {
-               this.title = "Advanced Options";
-       }
        public LineLabelViewItem(Item template) {
-               this.title = template.getTitle();
+               super(template);
        }
 
        public void addItem(String name, AdvancedViewItem item) {
@@ -158,6 +155,8 @@ public class LineLabelViewItem extends DetailViewItem{
 
                });
 
+               initStateLabel();
+
        }
 
        private static boolean isShareMinMode = false;
@@ -233,9 +232,14 @@ public class LineLabelViewItem extends DetailViewItem{
                // TODO Auto-generated method stub
                return false;
        }
-
        @Override
-       public boolean checkValue() {
-               return true;
+       public String getItemValue(VMPropertyValue property) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+       @Override
+       public String getModifyValue(VMPropertyValue value) {
+               // TODO Auto-generated method stub
+               return null;
        }
 }
diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/ViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/ViewItem.java
new file mode 100644 (file)
index 0000000..18a3cc7
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * minkee Lee <minkee.lee@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.detail.item;
+
+import java.util.List;
+
+import org.tizen.emulator.manager.vms.VMPropertyValue;
+import org.tizen.emulator.manager.vms.xml.template.Option;
+
+public abstract class ViewItem extends ItemValidator implements IInfoViewItem {
+
+       protected String name;
+       protected String title;
+       private Boolean modifyEnable = null;
+       protected boolean useDefaultOnCreate = false;
+       protected String defaultOnCreate = null;
+       protected boolean spreadOnStart = true;
+
+       public ViewItem() {
+               
+       }
+
+       public ViewItem(String name, String title) {
+               this.name = name;
+               this.title = title;
+       }
+
+       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 Boolean getModifyEnable() {
+               return modifyEnable;
+       }
+
+       public boolean isModifyEnable() {
+               if (modifyEnable == null) {
+                       return true;
+
+               } else {
+                       return modifyEnable;
+               }
+       }
+
+       public void setModifyEnable(boolean enable){
+               modifyEnable = enable;
+       }
+
+       public void setEnabled(boolean enabled) {}
+
+       public void setItemEnabled() {
+               if (modifyEnable != null) {
+                       setEnabled(modifyEnable);
+               }
+       }
+
+       protected void parseOption(List<Option> optionList) {
+               for (Option option : optionList) {
+                       if (option.getName().equals(OptionType.DEFAULT_ON_CREATE.getName())) {
+                               useDefaultOnCreate = true;
+                               defaultOnCreate = option.getValue();
+
+                       } else if (option.getName().equals(OptionType.MODIFY_ENABLE.getName())) {
+                               if (option.getValue().equals(OptionType.VALUE_FALSE)) {
+                                       modifyEnable = false;
+
+                               } else if (option.getValue().equals(OptionType.VALUE_TRUE)) {
+                                       modifyEnable = true;
+                               }
+
+                       } else if (option.getName().equals(OptionType.SPREAD_ON_START.getName())) {
+                               if(option.getValue().equals(OptionType.VALUE_FALSE)){
+                                       this.spreadOnStart = false;
+                               }
+                       }
+               }
+       }
+
+       @Override
+       public String getModifyValue(VMPropertyValue value) {
+               if (isCreateMode() && useDefaultOnCreate) {
+                       return defaultOnCreate;
+
+               } else {
+                       return getItemValue(value);
+               }
+       }
+
+}
index c372384..257e02d 100644 (file)
@@ -44,6 +44,7 @@ import org.tizen.emulator.manager.resources.ImageResources;
 import org.tizen.emulator.manager.resources.PatchImageResources;
 import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.ui.MainDialog;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
 import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.FileViewItem;
 import org.tizen.emulator.manager.ui.dialog.MessageDialog;
@@ -122,7 +123,7 @@ public class BaseImageViewItem extends FileViewItem {
                                        filePathLabel.setText(newPathName);
                                        filePathLabel.redraw();
                                        isSelected = true;
-                                       getListener().changeConfirmButton();
+                                       getListener().changeCreateConfirmButton();
 
                                        // TODO
                                        //arm image
@@ -198,7 +199,7 @@ public class BaseImageViewItem extends FileViewItem {
                        selectFileButton.setEnabled(false);
                }
                if(isCreateMode()) {
-                       getListener().changeConfirmButton();
+                       getListener().changeCreateConfirmButton();
                }
 
                return false;
@@ -211,8 +212,20 @@ public class BaseImageViewItem extends FileViewItem {
        }
 
        @Override
-       public boolean checkValue() {
-               return isSelected;
+       public ItemState checkValue() {
+               itemState.setNormal();
+
+               if (isSelected) {
+                       File f = new File(newPath);
+                       if (!f.exists()) {
+                               itemState.setError("Base image file is not exist.");
+                       }
+
+               } else {
+                       itemState.setError("Please select base image file.");
+               }
+
+               return itemState;
        }
 
 
index f76a7fb..3131e9f 100644 (file)
@@ -36,7 +36,7 @@ import java.util.List;
 
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
-import org.tizen.emulator.manager.ui.detail.item.template.ISubViewItem;
+import org.tizen.emulator.manager.ui.detail.item.template.DetailSubViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.LabelViewItem;
 import org.tizen.emulator.manager.vms.RESOLUTION;
 import org.tizen.emulator.manager.vms.xml.template.Item;
@@ -63,9 +63,9 @@ public class DisplayViewItem extends LabelViewItem {
                }
        }
 
-       protected List<ISubViewItem> getSubItemList() {
+       protected List<DetailSubViewItem> getSubItemList() {
                if (subItemList == null) {
-                       subItemList = new ArrayList<ISubViewItem>();
+                       subItemList = new ArrayList<DetailSubViewItem>();
 
                        List<Item> itemList = template.getItem();
                        int i=0;
index 472c209..43cffb5 100644 (file)
@@ -71,8 +71,12 @@ public class FileShareOnOffSubViewItem extends OnOffSubViewItem {
                                        buttonLabel.setText(StringResources.SUPPORTED);
                                        fileShareItem.setFileShareOn();
                                }
-                               if (!parentItem.isCreateMode()) {
-                                       parentItem.getListener().ChangeValue(parentItem.getThis());
+                               if (parentItem.isCreateMode()) {
+                                       parentItem.getListener().changeCreateConfirmButton();
+
+                               } else {
+                                       parentItem.getListener().changeModifyConfirmButton(
+                                                       parentItem.getThis());
                                }
                        }
 
index 237b591..07707d7 100644 (file)
 
 package org.tizen.emulator.manager.ui.detail.item.property;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
 import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
-import org.tizen.emulator.manager.ui.detail.item.template.ISubViewItem;
+import org.tizen.emulator.manager.ui.detail.item.template.DetailSubViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.LabelViewItem;
 import org.tizen.emulator.manager.vms.xml.template.Item;
 
@@ -45,21 +47,23 @@ public class FileShareViewItem extends LabelViewItem {
        public static String ITEM_DIR = "directory";
 
        FileShareDialogSubViewItem dialogItem;
+       FileShareOnOffSubViewItem shareOnOffItem;
 
        public FileShareViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
                super(template, lineLabelViewItem);
        }
 
-       protected List<ISubViewItem> getSubItemList() {
+       protected List<DetailSubViewItem> getSubItemList() {
                if (subItemList == null) {
-                       subItemList = new ArrayList<ISubViewItem>();
+                       subItemList = new ArrayList<DetailSubViewItem>();
 
                        List<Item> itemList = template.getItem();
                        int i=0;
                        for (Item item : itemList) {
                                String itemName = item.getName();
                                if (itemName.equals(ITEM_SHARE)) {
-                                       subItemList.add(new FileShareOnOffSubViewItem(this, compList.get(i++), item));
+                                       shareOnOffItem = new FileShareOnOffSubViewItem(this, compList.get(i++), item);
+                                       subItemList.add(shareOnOffItem);
 
                                } else if (itemName.equals(ITEM_DIR)) {
                                        dialogItem = new FileShareDialogSubViewItem(this, compList.get(i++), item);
@@ -103,4 +107,23 @@ public class FileShareViewItem extends LabelViewItem {
                }
        }
 
+       @Override
+       public ItemState checkValue() {
+               itemState.setNormal();
+
+               if (shareOnOffItem.getValue() == true) {
+                       String sharePath = dialogItem.getValue();
+                       if (sharePath == null || sharePath.isEmpty()) {
+                               itemState.setError("Please select file sharing path.");
+
+                       } else {
+                               File f = new File(sharePath);
+                               if (!f.exists()) {
+                                       itemState.setError("Sharing file path is Not exist.");
+                               }
+                       }
+               }
+               return itemState;
+       }
+
 }
index 3faae9c..9522a3d 100644 (file)
@@ -34,11 +34,13 @@ package org.tizen.emulator.manager.ui.detail.item.property;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
+import org.tizen.emulator.manager.EmulatorManager;
 import org.tizen.emulator.manager.resources.ColorResources;
 import org.tizen.emulator.manager.resources.FontResources;
 import org.tizen.emulator.manager.resources.ImageResources;
 import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.tool.CheckVirtualization;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
 import org.tizen.emulator.manager.ui.detail.item.template.LabelViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.OnOffSubViewItem;
 import org.tizen.emulator.manager.ui.widgets.ImageButton;
@@ -59,6 +61,13 @@ public class GPUSupportSubViewItem extends OnOffSubViewItem {
                super(parentItem, comp, template);
        }
 
+       public final String GALLIUM_WARNING_MSG =
+                       "You are using invalid graphic card driver for the emulator."
+                       +" If you continue launching emulator, it may not work properly."
+                       + " You have to use the lastest vendor-provided graphic card driver."
+                       + " For more information, see under ubuntu driver help page."
+                       + " (https://help.ubuntu.com/community/BinaryDriverHowto/) ";
+
        @Override
        protected void makeModifyWidget() {
                onOffButton = new ImageButton(comp, SWT.TOGGLE);
@@ -128,4 +137,16 @@ public class GPUSupportSubViewItem extends OnOffSubViewItem {
 
                return true;
        }
+
+       @Override
+       public ItemState checkValue() {
+               itemState.setNormal();
+
+               if (CheckVirtualization.getInstance().isGallium()
+                               && EmulatorManager.isLinux() && getValue() == true) {
+                       itemState.setWarning(GALLIUM_WARNING_MSG);
+               }
+
+               return itemState;
+       }
 }
index 7450ebf..d68724c 100644 (file)
@@ -35,7 +35,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
-import org.tizen.emulator.manager.ui.detail.item.template.ISubViewItem;
+import org.tizen.emulator.manager.ui.detail.item.template.DetailSubViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.LabelViewItem;
 import org.tizen.emulator.manager.vms.xml.template.Item;
 
@@ -49,9 +49,9 @@ public class HWSupportViewItem extends LabelViewItem {
        }
 
 
-       protected List<ISubViewItem> getSubItemList() {
+       protected List<DetailSubViewItem> getSubItemList() {
                if (subItemList == null) {
-                       subItemList = new ArrayList<ISubViewItem>();
+                       subItemList = new ArrayList<DetailSubViewItem>();
 
                        List<Item> itemList = template.getItem();
                        int i=0;
@@ -82,4 +82,5 @@ public class HWSupportViewItem extends LabelViewItem {
                }
                return count;
        }
+
 }
index 4ff67cb..92ef425 100644 (file)
 package org.tizen.emulator.manager.ui.detail.item.property;
 
 import org.tizen.emulator.manager.logging.EMLogger;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
 import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.TextViewItem;
 import org.tizen.emulator.manager.vms.VMPropertyValue;
-import org.tizen.emulator.manager.vms.helper.HelperClass;
 import org.tizen.emulator.manager.vms.xml.template.Item;
 
 public class MaxTouchViewItem extends TextViewItem {
@@ -64,7 +64,7 @@ public class MaxTouchViewItem extends TextViewItem {
                        newValue = String.valueOf(value.maxTouchCount);
                }
 
-               if (modifyEnable) {
+               if (isModifyEnable()) {
                        text.setText(newValue);
 
                } else {
@@ -81,26 +81,25 @@ public class MaxTouchViewItem extends TextViewItem {
        }
 
        @Override
-       public boolean checkValue() {
-               if (!modifyEnable) {
-                       return true;
-               }
+       public ItemState checkValue() {
+               if (!isModifyEnable()) {
+                       itemState.setNormal();
 
-               boolean result = true;
-               String errMsg = null;
-               try {
-                       int val = Integer.parseInt(newValue);
-                       if (val <= 0) {
-                               errMsg = "Max touch value should be positive integer.";
-                               result = false;
-                       }
+               } else {
+                       String errMsg = "";
+                       try {
+                               int val = Integer.parseInt(newValue);
+                               if (val <= 0) {
+                                       itemState.setError("Max touch value should be positive integer.");
 
-               } catch(NumberFormatException e) {
-                       result = false;
-                       errMsg = "Max touch value should be integer number.";
-               }
+                               } else {
+                                       itemState.setNormal();
+                               }
 
-               HelperClass.setStatusBar(errMsg);
-               return result;
+                       } catch(NumberFormatException e) {
+                               itemState.setError("Max touch value should be integer number.");
+                       }
+               }
+               return itemState;
        }
 }
index 20aec44..61c21f1 100644 (file)
@@ -83,10 +83,10 @@ public class NetConnectTypeViewItem extends ComboViewItem {
                                }
 
                                if (isCreateMode()) {
-                                       getListener().changeConfirmButton();
+                                       getListener().changeCreateConfirmButton();
 
                                } else {
-                                       getListener().changeConfirmButton(getThis());
+                                       getListener().changeModifyConfirmButton(getThis());
                                }
                        }
 
index daac3d3..e20d9e6 100644 (file)
@@ -39,6 +39,7 @@ import org.tizen.emulator.manager.tool.TapUtil;
 import org.tizen.emulator.manager.ui.detail.item.AdvancedViewItem;
 import org.tizen.emulator.manager.ui.detail.item.CommonItemListFactory;
 import org.tizen.emulator.manager.ui.detail.item.ItemChangeState;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
 import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.TextViewItem;
 import org.tizen.emulator.manager.vms.VMPropertyValue;
@@ -118,9 +119,9 @@ public class NetDnsViewItem extends TextViewItem {
                                newValue = text.getText();
 
                                if (isCreateMode()) {
-                                       getListener().changeConfirmButton();
+                                       getListener().changeCreateConfirmButton();
                                } else {
-                                       getListener().changeConfirmButton(getThis());
+                                       getListener().changeModifyConfirmButton(getThis());
                                }
                        }
                });
@@ -145,8 +146,14 @@ public class NetDnsViewItem extends TextViewItem {
        }
 
        @Override
-       public boolean checkValue() {
-               return TapUtil.checkIPString(text.isEnabled(), newValue, title);
+       public ItemState checkValue() {
+               String msg =  TapUtil.checkIPString(text.isEnabled(), newValue, title);
+               if (msg.isEmpty()) {
+                       itemState.setNormal();
+               } else {
+                       itemState.setError(msg);
+               }
+               return itemState;
        }
 
 }
index 454e5b4..188a12a 100644 (file)
@@ -35,7 +35,7 @@ import org.eclipse.swt.widgets.Composite;
 import org.tizen.emulator.manager.ui.detail.item.AdvancedViewItem;
 import org.tizen.emulator.manager.ui.detail.item.CommonItemListFactory;
 import org.tizen.emulator.manager.ui.detail.item.template.CheckSubViewItem;
-import org.tizen.emulator.manager.ui.detail.item.template.ISubViewItem;
+import org.tizen.emulator.manager.ui.detail.item.template.DetailSubViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.LabelViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.TextSubViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.TextViewItem;
@@ -51,7 +51,7 @@ public class NetIPInfoDHCPSubViewItem extends CheckSubViewItem {
        }
 
        public void resetCheckbox(String connectType) {
-               if (modifyEnable == true) { // config from template.
+               if (isModifyEnable()) { // config from template.
                        if (connectType.equals(NetConnectTypeViewItem.VALUE_NAT)) {
                                setCheckBox(false);
                                setEnabled(false);
@@ -79,7 +79,7 @@ public class NetIPInfoDHCPSubViewItem extends CheckSubViewItem {
                        setEnabled(true);
                }
 
-               setItemState();
+               setItemEnabled();
 
                AdvancedViewItem item = parentItem.getLineLabelViewItem().getItem(
                                CommonItemListFactory.ITEM_NET_CONNECT_TYPE);
@@ -89,7 +89,7 @@ public class NetIPInfoDHCPSubViewItem extends CheckSubViewItem {
                }
 
                // Set checkbox state.
-               if (modifyEnable) {
+               if (isModifyEnable()) {
                        modifyCheckBox.setChecked(newValue);
                }
                setIPInfoEnabled(newValue ? false : true); // Disabled if "checked".
@@ -113,9 +113,9 @@ public class NetIPInfoDHCPSubViewItem extends CheckSubViewItem {
                                }
 
                                if (parentItem.isCreateMode()) {
-                                       parentItem.getListener().changeConfirmButton();
+                                       parentItem.getListener().changeCreateConfirmButton();
                                } else {
-                                       parentItem.getListener().changeConfirmButton(
+                                       parentItem.getListener().changeModifyConfirmButton(
                                                        parentItem.getThis());
                                }
                        }
@@ -131,7 +131,7 @@ public class NetIPInfoDHCPSubViewItem extends CheckSubViewItem {
                // Enable/Disable ip setting
                if (parentItem instanceof NetIPInfoViewItem) {
                        NetIPInfoViewItem item = (NetIPInfoViewItem)parentItem;
-                       for (ISubViewItem subItem : item.getSubItemList()) {
+                       for (DetailSubViewItem subItem : item.getSubItemList()) {
                                if (subItem instanceof TextSubViewItem) {
                                        ((TextSubViewItem) subItem).resetText(enabled);
                                }
index 31dd270..82fc430 100644 (file)
@@ -42,6 +42,7 @@ import org.tizen.emulator.manager.tool.TapUtil;
 import org.tizen.emulator.manager.ui.detail.item.AdvancedViewItem;
 import org.tizen.emulator.manager.ui.detail.item.CommonItemListFactory;
 import org.tizen.emulator.manager.ui.detail.item.ItemChangeState;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
 import org.tizen.emulator.manager.ui.detail.item.template.LabelViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.TextSubViewItem;
 import org.tizen.emulator.manager.vms.VMPropertyValue;
@@ -178,9 +179,9 @@ public class NetIPInfoTextSubViewItem extends TextSubViewItem {
                        public void modifyText(ModifyEvent e) {
                                newValue = text.getText();
                                if (parentItem.isCreateMode()) {
-                                       parentItem.getListener().changeConfirmButton();
+                                       parentItem.getListener().changeCreateConfirmButton();
                                } else {
-                                       parentItem.getListener().changeConfirmButton(
+                                       parentItem.getListener().changeModifyConfirmButton(
                                                        parentItem.getThis());
                                }
                        }
@@ -207,12 +208,15 @@ public class NetIPInfoTextSubViewItem extends TextSubViewItem {
                });
        }
 
-       public String getValue() {
-               return newValue;
-       }
+       public ItemState checkValue() {
+               String msg =  TapUtil.checkIPString(text.isEnabled(), newValue, title);
+               if (msg.isEmpty()) {
+                       itemState.setNormal();
+               } else {
+                       itemState.setError(msg);
+               }
+               return itemState;
 
-       public boolean checkValue() {
-               return TapUtil.checkIPString(text.isEnabled(), newValue, title);
        }
 
 }
index 8156195..397e61c 100644 (file)
@@ -33,9 +33,9 @@ package org.tizen.emulator.manager.ui.detail.item.property;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
 import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
-import org.tizen.emulator.manager.ui.detail.item.template.CheckSubViewItem;
-import org.tizen.emulator.manager.ui.detail.item.template.ISubViewItem;
+import org.tizen.emulator.manager.ui.detail.item.template.DetailSubViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.LabelViewItem;
 import org.tizen.emulator.manager.vms.xml.template.Item;
 
@@ -48,7 +48,7 @@ public class NetIPInfoViewItem extends LabelViewItem {
 
        public boolean useDHCP() {
                boolean useDHCP = false;
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        if (subItem.getName().equals(ITEM_USE_DHCP)) {
                                useDHCP = ((NetIPInfoDHCPSubViewItem) subItem).getValue();
                        }
@@ -57,7 +57,7 @@ public class NetIPInfoViewItem extends LabelViewItem {
        }
 
        public void setIPAddress(String ipAddress) {
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        if (subItem.getName().equals(ITEM_IP)) {
                                ((NetIPInfoTextSubViewItem) subItem).setText(ipAddress);
                        }
@@ -65,7 +65,7 @@ public class NetIPInfoViewItem extends LabelViewItem {
        }
 
        public void setSubnet(String subnet) {
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        if (subItem.getName().equals(ITEM_SUBNET)) {
                                ((NetIPInfoTextSubViewItem) subItem).setText(subnet);
                        }
@@ -73,7 +73,7 @@ public class NetIPInfoViewItem extends LabelViewItem {
        }
 
        public void setGateway(String gateway) {
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        if (subItem.getName().equals(ITEM_GATEWAY)) {
                                ((NetIPInfoTextSubViewItem) subItem).setText(gateway);
                        }
@@ -81,7 +81,7 @@ public class NetIPInfoViewItem extends LabelViewItem {
        }
 
        public String getIpAddress() {
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        if (subItem.getName().equals(ITEM_IP)) {
                                return ((NetIPInfoTextSubViewItem) subItem).getValue();
                        }
@@ -90,7 +90,7 @@ public class NetIPInfoViewItem extends LabelViewItem {
        }
 
        public String getSubnet() {
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        if (subItem.getName().equals(ITEM_SUBNET)) {
                                return ((NetIPInfoTextSubViewItem) subItem).getValue();
                        }
@@ -99,7 +99,7 @@ public class NetIPInfoViewItem extends LabelViewItem {
        }
 
        public String getGateway() {
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        if (subItem.getName().equals(ITEM_GATEWAY)) {
                                return ((NetIPInfoTextSubViewItem) subItem).getValue();
                        }
@@ -113,7 +113,7 @@ public class NetIPInfoViewItem extends LabelViewItem {
        }
 
        public void resetSubItems(String connectType) {
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        if (subItem instanceof NetIPInfoTextSubViewItem) {
                                ((NetIPInfoTextSubViewItem) subItem).resetText(connectType);
 
@@ -131,9 +131,9 @@ public class NetIPInfoViewItem extends LabelViewItem {
        }
 
        @Override
-       protected List<ISubViewItem> getSubItemList() {
+       protected List<DetailSubViewItem> getSubItemList() {
                if (subItemList == null) {
-                       subItemList = new ArrayList<ISubViewItem>();
+                       subItemList = new ArrayList<DetailSubViewItem>();
 
                        List<Item> itemList = template.getItem();
                        int i = 0;
@@ -179,21 +179,4 @@ public class NetIPInfoViewItem extends LabelViewItem {
                return count;
        }
 
-       @Override
-       public boolean checkValue() {
-               boolean isValid = true;
-
-               for (ISubViewItem subItem : getSubItemList()) {
-                       if (subItem instanceof NetIPInfoTextSubViewItem) {
-                               isValid = ((NetIPInfoTextSubViewItem) subItem).checkValue();
-                               if (!isValid) {
-                                       break;
-                               }
-                       }
-               }
-
-               return isValid;
-
-       }
-
 }
index 22416e7..2c12d61 100644 (file)
@@ -47,6 +47,7 @@ import org.tizen.emulator.manager.resources.ImageResources;
 import org.tizen.emulator.manager.resources.PatchImageResources;
 import org.tizen.emulator.manager.ui.MainDialog;
 import org.tizen.emulator.manager.ui.detail.item.CommonItemListFactory;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
 import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.ComboViewItem;
 import org.tizen.emulator.manager.ui.widgets.ImageCombo;
@@ -223,10 +224,10 @@ public class NetProxyViewItem extends ComboViewItem {
                                resetAddress();
 
                                if (isCreateMode()) {
-                                       getListener().changeConfirmButton();
+                                       getListener().changeCreateConfirmButton();
 
                                } else {
-                                       getListener().changeConfirmButton(getThis());
+                                       getListener().changeModifyConfirmButton(getThis());
                                }
                        }
 
@@ -243,10 +244,10 @@ public class NetProxyViewItem extends ComboViewItem {
                                settingAddress(ProxyDialog.open(makeDialogValue()));
 
                                if (isCreateMode()) {
-                                       getListener().changeConfirmButton();
+                                       getListener().changeCreateConfirmButton();
 
                                } else {
-                                       getListener().changeConfirmButton(getThis());
+                                       getListener().changeModifyConfirmButton(getThis());
                                }
                        }
 
@@ -292,16 +293,22 @@ public class NetProxyViewItem extends ComboViewItem {
                return true;
        }
 
-       public boolean checkValue() {
-               String errMsg = null;
+       @Override
+       public ItemState checkValue() {
                if (newValue != null && newValue.equals(MODE_MANUAL)) {
                        if (httpProxy.isEmpty() && httpsProxy.isEmpty()
                                        && ftpProxy.isEmpty() && socksProxy.isEmpty()) {
-                               errMsg = "Please set manual proxy address.";
+                               itemState.setError("Please set manual proxy address.");
+
+                       } else {
+                               itemState.setNormal();
                        }
+
+               } else {
+                       itemState.setNormal();
                }
-               HelperClass.setStatusBar(errMsg);
-               return errMsg == null ? true : false;
+
+               return itemState;
        }
 
        private void getProxyValues(VMPropertyValue value) {
index 1333c2d..e1ae7ba 100644 (file)
@@ -46,6 +46,7 @@ import org.tizen.emulator.manager.resources.PatchImageResources;
 import org.tizen.emulator.manager.tool.TapUtil;
 import org.tizen.emulator.manager.ui.detail.item.AdvancedViewItem;
 import org.tizen.emulator.manager.ui.detail.item.CommonItemListFactory;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
 import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.ComboViewItem;
 import org.tizen.emulator.manager.ui.dialog.MessageDialog;
@@ -140,7 +141,7 @@ public class NetTapDeviceViewItem extends ComboViewItem {
 
                                if (!isCreateMode()) {
                                        // getListener().ChangeValue(getThis());
-                                       getListener().changeConfirmButton(getThis());
+                                       getListener().changeModifyConfirmButton(getThis());
                                }
                        }
 
@@ -189,7 +190,7 @@ public class NetTapDeviceViewItem extends ComboViewItem {
                        }
                }
 
-               getListener().changeConfirmButton(getThis());
+               getListener().changeModifyConfirmButton(getThis());
 
                return true;
        }
@@ -259,17 +260,18 @@ public class NetTapDeviceViewItem extends ComboViewItem {
        }
 
        @Override
-       public boolean checkValue() {
+       public ItemState checkValue() {
                if (!combo.isEnabled()) {
-                       return true;
-               }
+                       itemState.setNormal();
+
+               } else if (newValue == null || !newValue.isEmpty()) {
+                       itemState.setNormal();
 
-               if (newValue == null || !newValue.isEmpty()) {
-                       return true;
+               } else {
+                       itemState.setError("At least one Tap device should be created.");
                }
 
-               HelperClass.setStatusBar("At least one Tap device should be created.");
-               return false;
+               return itemState;
        }
 
        private void resetAddress() {
index da4155d..1cc3fd1 100644 (file)
@@ -36,9 +36,9 @@ import java.util.List;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
 import org.tizen.emulator.manager.tool.CheckVirtualization;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
 import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.ComboViewItem;
-import org.tizen.emulator.manager.ui.dialog.MessageDialog;
 import org.tizen.emulator.manager.vms.CPU;
 import org.tizen.emulator.manager.vms.VMPropertyValue;
 import org.tizen.emulator.manager.vms.xml.template.Item;
@@ -76,16 +76,12 @@ public class ProcessorViewItem extends ComboViewItem {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
                                newValue = combo.getText();
+                               if (isCreateMode()) {
+                                       getListener().changeCreateConfirmButton();
 
-                               if (!isCreateMode()) {
+                               } else {
                                        getListener().ChangeValue(getThis());
-                                       getListener().changeConfirmButton(getThis());
-                               }
-
-                               if (checkUGWarning()) {
-                                       String msg = "\nPlease use processors 1 at non-UG platform." +
-                                                       "\nMulti-processors might cause VM slower.";
-                                       new MessageDialog().openWarningDialog("Emulator Manager Warning", msg);
+                                       getListener().changeModifyConfirmButton(getThis());
                                }
                        }
 
@@ -150,18 +146,30 @@ public class ProcessorViewItem extends ComboViewItem {
                return String.valueOf(value.cpu);
        }
 
-       @Override
-       public boolean checkValue() {
-               return true;
-       }
-
        private boolean checkUGWarning() {
                if (CheckVirtualization.getInstance().isNonUG()) {
-                       if (Integer.parseInt(newValue) > 1) {
+                       if (newValue == null) {
+                               return true;
+                       } else if (Integer.parseInt(newValue) > 1) {
                                return true;
                        }
                }
 
                return false;
        }
+
+       @Override
+       // This should be overriden if item validation is needed.
+       public ItemState checkValue() {
+
+               if (checkUGWarning()) {
+                       String msg = "Please use processors 1 at non-UG platform."
+                                       + "Multi-processors might cause VM slower.";
+                       itemState.setWarning(msg);
+
+               } else {
+                       itemState.setNormal();
+               }
+               return itemState;
+       }
 }
index 59ea697..f6855aa 100644 (file)
@@ -109,7 +109,7 @@ public class RamSizeItem extends ComboViewItem{
        }
 
        @Override
-       protected String getItemValue(VMPropertyValue value) {
+       public String getItemValue(VMPropertyValue value) {
                return String.valueOf(value.ramSize);
        }
 
index 1277455..c42e46b 100644 (file)
@@ -42,22 +42,32 @@ 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.widgets.Canvas;
 import org.eclipse.swt.widgets.Text;
+import org.tizen.emulator.manager.logging.EMLogger;
+import org.tizen.emulator.manager.platform.Platform;
+import org.tizen.emulator.manager.platform.PlatformList;
 import org.tizen.emulator.manager.resources.ColorResources;
 import org.tizen.emulator.manager.resources.FontResources;
 import org.tizen.emulator.manager.resources.PatchImageResources;
+import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.ui.VMsMainView;
 import org.tizen.emulator.manager.ui.detail.item.ItemChangeState;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
 import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.TextViewItem;
 import org.tizen.emulator.manager.ui.widgets.ImageLabel;
 import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.VMProperty.FSImageType;
 import org.tizen.emulator.manager.vms.VMPropertyValue;
 import org.tizen.emulator.manager.vms.helper.HelperClass;
 import org.tizen.emulator.manager.vms.xml.template.Item;
 
 public class VMNameViewItem extends TextViewItem{
 
+       Canvas canvas;
+       private boolean isStandard;
+
        public VMNameViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
                super(template, lineLabelViewItem);
        }
@@ -108,7 +118,7 @@ public class VMNameViewItem extends TextViewItem{
                        public void modifyText(ModifyEvent e) {
                                if (isCreateMode()) {
                                        newValue = text.getText();
-                                       getListener().changeConfirmButton();
+                                       getListener().changeCreateConfirmButton();
                                }
                        }
                });
@@ -180,31 +190,22 @@ public class VMNameViewItem extends TextViewItem{
        }
 
        @Override
-       public boolean checkValue() {
+       public ItemState checkValue() {
                if (!isCreateMode()) {
-                       return true;
-               }
-               if (HelperClass.checkImageName(newValue, true)) {
-                       return true;
+                       itemState.setNormal();
+
+               } else {
+                       String msg = checkImageName(newValue);
+                       if (msg.isEmpty()) {
+                               itemState.setNormal();
+
+                       } else {
+                               itemState.setError(msg);
+                       }
                }
-               return false;
-       }
 
-//     private void checkVMName() {
-//             if (HelperClass.checkImageName(newValue, true)) {
-//                     if (isStandard) {
-//                             getListener().ChangeValue(true);
-//                     } else {
-////                           if (isSelected) {
-////                                   getListener().ChangeValue(true);
-////                           } else {
-////                                   getListener().ChangeValue(false);
-////                           }
-//                     }
-//             } else {
-//                     getListener().ChangeValue(false);
-//             }
-//     }
+               return itemState;
+       }
 
        // Generate VMName automatically.
        // ex) "m-0626-1"
@@ -233,4 +234,57 @@ public class VMNameViewItem extends TextViewItem{
                return vmName.toString();
        }
 
+       public static String checkImageName(String newName) {
+               String errorMsg = "";
+               VMProperty prop = null;
+               boolean result = true;
+               if (newName.length() > VMProperty.MAX_NAME_LEN) {
+                       errorMsg = "Max length is 20.";
+                       result = false;
+               } else if (!HelperClass.checkString(newName)) {
+                       errorMsg = "Name has invalid character!";
+                       result = false;
+               } else if ((prop = HelperClass.checkDupulicateName(newName)) != null) {
+                       String platform = prop.getImagePlatform();
+                       errorMsg = "Same name already exists in " + platform + "!";
+
+                       if (!existPlatform(prop)){
+                               errorMsg += " (" + platform + " platform image does not exist.)";
+                               EMLogger.getLogger().info(platform + " platform image does not exist." + StringResources.NEW_LINE
+                                       + "If you do not need this VM(" + newName + "), delete VM folder."
+                                       + StringResources.NEW_LINE + "VM folder path: " + prop.getPropertyFile().getAbsolutePath());
+                       }
+
+                       result = false;
+               } else if (newName.length() == VMProperty.MAX_NAME_LEN) {
+                       errorMsg = "Max length is 20.";
+               } else if (newName.isEmpty()) {
+                       errorMsg = "Please input VM name.";
+                       result = false;
+               }
+
+               return errorMsg;
+       }
+
+       private static boolean existPlatform(VMProperty prop) {
+               boolean existPlatform = false;
+
+               String platform = prop.getImagePlatform();
+
+               for (Platform p : PlatformList.getPlatformList()) {
+                       if (p.getName().equals(platform)) {
+                               existPlatform = true;
+                               break;
+                       }
+               }
+
+               if (!existPlatform) {
+                       if (prop.getImageType() == FSImageType.custom) {
+                               existPlatform = true;
+                       }
+               }
+
+               return existPlatform;
+       }
+
 }
index 65a37b5..d12068e 100644 (file)
@@ -60,7 +60,9 @@ public class CheckLabelViewItem extends LabelViewItem {
                }
        }
 
-       protected void parseOption(List<Option> optionList) {
+       @Override
+       public void parseOption(List<Option> optionList) {
+               super.parseOption(optionList);
                for (Option option : optionList) {
                        if (option.getName().equals(OptionType.HIDE_LABEL.getName())) {
                                if(option.getValue().equals("on")) {
@@ -79,9 +81,9 @@ public class CheckLabelViewItem extends LabelViewItem {
        }
 
        @Override
-       protected List<ISubViewItem> getSubItemList() {
+       protected List<DetailSubViewItem> getSubItemList() {
                if (subItemList == null) {
-                       subItemList = new ArrayList<ISubViewItem>();
+                       subItemList = new ArrayList<DetailSubViewItem>();
 
                        List<Item> itemList = template.getItem();
                        int i = this.hideLabel ? -1 : 0;
@@ -127,8 +129,11 @@ public class CheckLabelViewItem extends LabelViewItem {
        @Override
        public void drawModify() {
                makeModifyWidget();
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        subItem.drawModify();
+                       if (subItem.getModifyEnable() == null) {
+                               subItem.setModifyEnable(isModifyEnable()); // Set sub item's state as parent's.
+                       }
                }
        }
 
@@ -156,7 +161,7 @@ public class CheckLabelViewItem extends LabelViewItem {
                                        isChecked = true;
 
                                }
-                               for (ISubViewItem subItem : getSubItemList()) {
+                               for (DetailSubViewItem subItem : getSubItemList()) {
                                        if (subItem instanceof CheckSubViewItem) {
                                                ((CheckSubViewItem)subItem).setCheckBox(isChecked);
                                        }
@@ -201,7 +206,7 @@ public class CheckLabelViewItem extends LabelViewItem {
        @Override
        public boolean settingModifyItem(VMPropertyValue value) {
                checkBox.setSelection(true);
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        subItem.settingModifyItem(value);
                }
                if (!isCreateMode()) {
index 1cdf738..605eeb8 100644 (file)
@@ -56,7 +56,7 @@ import org.tizen.emulator.manager.vms.VMPropertyValue;
 import org.tizen.emulator.manager.vms.xml.template.Item;
 import org.tizen.emulator.manager.vms.xml.template.Option;
 
-public class CheckSubViewItem extends SubViewItem {
+public class CheckSubViewItem extends DetailSubViewItem {
 
 //     protected String name;
 //     protected String title;
@@ -244,9 +244,9 @@ public class CheckSubViewItem extends SubViewItem {
                                }
 
                                if (parentItem.isCreateMode()) {
-                                       parentItem.getListener().changeConfirmButton();
+                                       parentItem.getListener().changeCreateConfirmButton();
                                } else {
-                                       parentItem.getListener().changeConfirmButton(
+                                       parentItem.getListener().changeModifyConfirmButton(
                                                        parentItem.getThis());
                                }
                        }
@@ -292,7 +292,7 @@ public class CheckSubViewItem extends SubViewItem {
                // Set checkbox state.
                modifyCheckBox.setChecked(newValue);
                modifyCheckBox.notifyListeners(SWT.Selection, new Event());
-               setItemState();
+               setItemEnabled();
                return false;
        }
 
@@ -318,9 +318,9 @@ public class CheckSubViewItem extends SubViewItem {
                        modifyCheckBox.setSelection(checked);
 
                        if (parentItem.isCreateMode()) {
-                               parentItem.getListener().changeConfirmButton();
+                               parentItem.getListener().changeCreateConfirmButton();
                        } else {
-                               parentItem.getListener().changeConfirmButton(
+                               parentItem.getListener().changeModifyConfirmButton(
                                                parentItem.getThis());
                        }
                }
index 8ba7129..48ff65e 100644 (file)
@@ -50,7 +50,7 @@ import org.tizen.emulator.manager.vms.VMPropertyValue;
 import org.tizen.emulator.manager.vms.xml.template.Item;
 import org.tizen.emulator.manager.vms.xml.template.Option;
 
-public class ComboSubViewItem extends SubViewItem {
+public class ComboSubViewItem extends DetailSubViewItem {
 
        protected String oldValue;
        protected String newValue;
@@ -61,6 +61,10 @@ public class ComboSubViewItem extends SubViewItem {
        protected Image INPUTBOX_ON_IMAGE = null;
        protected static int COMBO_WIDTH = 105;
 
+       public String getValue() {
+               return newValue;
+       }
+
        public ComboSubViewItem(LabelViewItem parentItem, Composite comp, Item template) {
                super(parentItem, comp, template);
                parseOption(template.getOption());
@@ -168,7 +172,7 @@ public class ComboSubViewItem extends SubViewItem {
                        }
                }
 
-               setItemState();
+               setItemEnabled();
                return true;
        }
 
index d1e2d63..cd1b2bd 100644 (file)
@@ -55,8 +55,6 @@ import org.tizen.emulator.manager.vms.xml.template.Option;
 
 public class ComboViewItem extends AdvancedViewItem{
 
-       protected String name;
-
        protected String oldValue;
        protected String newValue;
 
@@ -71,6 +69,7 @@ public class ComboViewItem extends AdvancedViewItem{
        protected Image INPUTBOX_OFF_IMAGE = null;
        protected int COMBOBOX_WIDTH = 175;
 
+
        protected boolean useDefaultOnCreate = false;
        protected String defaultOnCreate = null;
 
@@ -80,19 +79,18 @@ public class ComboViewItem extends AdvancedViewItem{
        }
 
        public ComboViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
-               super(lineLabelViewItem);
+               super(template, lineLabelViewItem);
                if (lineLabelViewItem == null) {
                        INDENT = 0;
                }
 
-               name = template.getName();
-               title = template.getTitle();
                count = 1;
 
                parseOption(template.getOption());
        }
 
        protected void parseOption(List<Option> optionList) {
+               super.parseOption(optionList);
                for (Option option : optionList) {
                        if (option.getName().equals(OptionType.COMBO_LIST.getName())) {
                                String[] split = option.getValue().split(",");
@@ -100,11 +98,6 @@ public class ComboViewItem extends AdvancedViewItem{
                                        comboOptions.add(s.trim());
                                }
                        }
-
-                       if (option.getName().equals(OptionType.DEFAULT_ON_CREATE.getName())) {
-                               useDefaultOnCreate = true;
-                               defaultOnCreate = option.getValue();
-                       }
                }
        }
 
@@ -241,18 +234,9 @@ public class ComboViewItem extends AdvancedViewItem{
                return true;
        }
 
-       protected String getItemValue(VMPropertyValue value) {
-               return value.getAdvancedOptionValue(name);
-       }
-
-
-       @Override
-       public boolean checkValue() {
-               return true;
-       }
-
        public void resetCombo() {
 
        }
 
+
 }
@@ -31,8 +31,6 @@
 
 package org.tizen.emulator.manager.ui.detail.item.template;
 
-import java.util.List;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.FormAttachment;
@@ -40,18 +38,21 @@ import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.widgets.Composite;
 import org.tizen.emulator.manager.resources.ColorResources;
 import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.ui.detail.item.OptionType;
+import org.tizen.emulator.manager.ui.detail.item.DetailViewItemChangeListener;
+import org.tizen.emulator.manager.ui.detail.item.IInfoViewItem;
+import org.tizen.emulator.manager.ui.detail.item.IModifyViewItem;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
+import org.tizen.emulator.manager.ui.detail.item.ViewItem;
 import org.tizen.emulator.manager.ui.widgets.ImageLabel;
+import org.tizen.emulator.manager.ui.widgets.ItemCategoryLabel;
 import org.tizen.emulator.manager.vms.VMPropertyValue;
 import org.tizen.emulator.manager.vms.xml.template.Item;
-import org.tizen.emulator.manager.vms.xml.template.Option;
 
-public abstract class SubViewItem implements ISubViewItem {
+public abstract class DetailSubViewItem extends ViewItem {
+
        // for category
-       protected String name;
-       protected ImageLabel category;
+       protected ItemCategoryLabel category;
        protected Image CATEGORYBOX_IMAGE;
-       protected String title;
        protected ImageLabel valueLabel;
        protected Image INPUTBOX_OFF_IMAGE;
 
@@ -63,38 +64,10 @@ public abstract class SubViewItem implements ISubViewItem {
        protected static int LABEL_WIDTH = 105;
        protected static int TOP_GAP    = 3;
 
-       protected boolean useDefaultOnCreate = false;
-       protected String defaultOnCreate = null;
-       protected Boolean modifyEnable = null;
-
-
-       public SubViewItem(LabelViewItem parentItem, Composite comp, Item template) {
+       public DetailSubViewItem(LabelViewItem parentItem, Composite comp, Item template) {
+               super(template.getName(), template.getTitle());
                this.parentItem = parentItem;
                this.comp = comp;
-               this.name = template.getName();
-               this.title = template.getTitle();
-       }
-
-       protected void parseOption(List<Option> optionList) {
-               for (Option option : optionList) {
-                       if (option.getName().equals(OptionType.DEFAULT_ON_CREATE.getName())) {
-                               useDefaultOnCreate = true;
-                               defaultOnCreate = option.getValue();
-
-                       } else if (option.getName().equals(OptionType.MODIFY_ENABLE.getName())) {
-                               if (option.getValue().equals(OptionType.VALUE_FALSE)) {
-                                       modifyEnable = false;
-
-                               } else if (option.getValue().equals(OptionType.VALUE_TRUE)) {
-                                       modifyEnable = true;
-                               }
-                       }
-               }
-       }
-
-       @Override
-       public String getName() {
-               return name;
        }
 
        @Override
@@ -118,7 +91,7 @@ public abstract class SubViewItem implements ISubViewItem {
        }
 
        protected void makeCategory() {
-               category = new ImageLabel(comp, SWT.NONE);
+               category = new ItemCategoryLabel(comp, SWT.NONE, itemState);
                if (CATEGORYBOX_IMAGE == null) {
                        CATEGORYBOX_IMAGE = PatchImageResources.getCategoryBox(CATEGORY_WIDTH);
                }
@@ -133,6 +106,7 @@ public abstract class SubViewItem implements ISubViewItem {
                category.setLayoutData(data);
        }
 
+
        @Override
        public void closeItem() {
                if (category != null) {
@@ -150,37 +124,77 @@ public abstract class SubViewItem implements ISubViewItem {
        }
 
        @Override
-       public void setEnabled(boolean enabled) {}
+       public String getItemValue(VMPropertyValue value) {
+               return value.getAdvancedOptionSubValue(parentItem.getName(), name);
+       }
+
+
+       @Override
+       public void close() {
+               closeItem();
+       }
+
+       @Override
+       public int getCount() {
+               return 1;
+       }
 
        @Override
-       public Boolean getModifyEnable() {
-               return modifyEnable;
+       public boolean isCreateMode() {
+               return parentItem.isCreateMode();
        }
 
        @Override
-       public void setModifyEnable(boolean enable){
-               modifyEnable = enable;
+       public ItemState checkValue() {
+               itemState.setNormal();
+               return itemState;
        }
 
-       public void setItemState() {
-               if (modifyEnable != null) {
-                       setEnabled(modifyEnable);
+       @Override
+       public void updateItemUI() {
+               if (category != null) {
+                       category.redraw();
                }
        }
 
        @Override
-       public String getItemValue(VMPropertyValue value) {
-               return value.getAdvancedOptionSubValue(parentItem.getName(), name);
+       public void setItemMarked(boolean marked) {
+               // TODO Auto-generated method stub
        }
 
        @Override
-       public String getModifyValue(VMPropertyValue value) {
-               if (parentItem.isCreateMode() && useDefaultOnCreate) {
-                       return defaultOnCreate;
+       public void setCreateMode(boolean isCreateMode) {
+               // TODO Auto-generated method stub
+       }
 
-               } else {
-                       return getItemValue(value);
-               }
+       @Override
+       public void initItem(Composite parent, IInfoViewItem upperItem) {
+               // TODO Auto-generated method stub
+       }
+
+       @Override
+       public void setViewMode(boolean isViewMode) {
+               // TODO Auto-generated method stub
+       }
+
+       @Override
+       public void init() {
+               // TODO Auto-generated method stub
+       }
+
+       @Override
+       public void settingStatus(boolean isRefresh) {
+               // TODO Auto-generated method stub
+       }
+
+       @Override
+       public void initItem(Composite parent, IModifyViewItem upperItem) {
+               // TODO Auto-generated method stub
+       }
+
+       @Override
+       public void setListener(DetailViewItemChangeListener listener) {
+               // TODO Auto-generated method stub
        }
 
 }
index 167945d..18dd5cd 100644 (file)
@@ -55,7 +55,7 @@ import org.tizen.emulator.manager.vms.VMPropertyValue;
 import org.tizen.emulator.manager.vms.xml.template.Item;
 import org.tizen.emulator.manager.vms.xml.template.Option;
 
-public class FileSubViewItem extends SubViewItem {
+public class FileSubViewItem extends DetailSubViewItem {
 
        protected String oldValue;
        protected String newValue;
@@ -102,6 +102,10 @@ public class FileSubViewItem extends SubViewItem {
                }
        }
 
+       public String getValue() {
+               return newValue;
+       }
+
        @Override
        public void drawModify() {
                makeModifyWidget();
@@ -181,8 +185,13 @@ public class FileSubViewItem extends SubViewItem {
                                                filePathLabel.setToolTipText(newValue);
                                        }
                                }
-                               if (!parentItem.isCreateMode()) {
-                                       parentItem.getListener().ChangeValue(parentItem.getThis());
+
+                               if (parentItem.isCreateMode()) {
+                                       parentItem.getListener().changeCreateConfirmButton();
+
+                               } else {
+                                       parentItem.getListener().changeModifyConfirmButton(
+                                                       parentItem.getThis());
                                }
                        }
 
@@ -215,7 +224,7 @@ public class FileSubViewItem extends SubViewItem {
                                .lastIndexOf(File.separator) + 1, newValue.length());
                filePathLabel.setText(fileName);
                filePathLabel.setToolTipText(newValue);
-               setItemState();
+               setItemEnabled();
                return true;
        }
 
index 75535ee..05c7f71 100644 (file)
@@ -58,6 +58,7 @@ public class FileViewItem extends AdvancedViewItem {
 
        protected String name;
 
+       private String oldValue;
        private String newValue;
 
        // for Info view
@@ -74,16 +75,18 @@ public class FileViewItem extends AdvancedViewItem {
        protected List<String> filters = new ArrayList<String>();
 
        public FileViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
-               super(lineLabelViewItem);
+               super(template, lineLabelViewItem);
                if (lineLabelViewItem == null) {
                        INDENT = 0;
                }
 
-               name = template.getName();
-               title = template.getTitle();
                count = 1;
+               parseOption(template.getOption());
+       }
 
-               List<Option> optionList = template.getOption();
+       @Override
+       public void parseOption(List<Option> optionList) {
+               super.parseOption(optionList);
                for (Option option : optionList) {
                        if (option.getName().equals(OptionType.FILE_FILTER.getName())) {
                                String[] split = option.getValue().split(",");
@@ -232,9 +235,4 @@ public class FileViewItem extends AdvancedViewItem {
                return true;
        }
 
-       @Override
-       public boolean checkValue() {
-               return true;
-       }
-
 }
diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ISubViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ISubViewItem.java
deleted file mode 100644 (file)
index 8ee84d0..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * MunKyu Im <munkyu.im@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * JiHye Kim <jihye1128.kim@samsung.com>
- * Minkee Lee <minkee.lee@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@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.detail.item.template;
-
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public interface ISubViewItem {
-       public void drawDetail();
-       public void drawModify() ;
-       public boolean settingDetailItem(VMPropertyValue value);
-       public void setValue(VMPropertyValue value);
-       public boolean settingModifyItem(VMPropertyValue value);
-       public void closeItem();
-       public String getName();
-       public void setEnabled(boolean enabled);
-       public Boolean getModifyEnable();
-       public void setModifyEnable(boolean enable);
-       public String getItemValue(VMPropertyValue value);
-       public String getModifyValue(VMPropertyValue value);
-}
index 210e4a2..055f9eb 100644 (file)
@@ -35,6 +35,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.tizen.emulator.manager.ui.detail.item.AdvancedViewItem;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
 import org.tizen.emulator.manager.ui.detail.item.ItemType;
 import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
 import org.tizen.emulator.manager.ui.detail.item.OptionType;
@@ -44,21 +45,16 @@ import org.tizen.emulator.manager.vms.xml.template.Option;
 
 public class LabelViewItem extends AdvancedViewItem{
 
-       protected String name;
-       protected List<ISubViewItem> subItemList;
+       protected List<DetailSubViewItem> subItemList;
        protected Item template;
        boolean isDeviceItem;
-       boolean spreadOnStart = true;
-       protected boolean modifyEnable = true;
 
        public LabelViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
-               super(lineLabelViewItem);
+               super(template, lineLabelViewItem);
                if (lineLabelViewItem == null) {
                        INDENT = 0;
                }
 
-               title = template.getTitle();
-               name = template.getName();
 //             count = template.getItem().size();
                count = getSubItemCount(template);
                if (count == 0) {
@@ -69,19 +65,15 @@ public class LabelViewItem extends AdvancedViewItem{
                parseOption(template.getOption());
        }
 
-       private void parseOption(List<Option> optionList) {
+       public void parseOption(List<Option> optionList) {
+               super.parseOption(optionList);
                for (Option option : optionList) {
-                       if (option.getName().equals(OptionType.SPREAD_ON_START.getName())) {
-                               if(option.getValue().equals(OptionType.VALUE_FALSE)){
-                                       this.spreadOnStart = false;
-                               }
-
-                       } else if (option.getName().equals(OptionType.MODIFY_ENABLE.getName())) {
-                               if (option.getValue().equals(OptionType.VALUE_FALSE)) {
-                                       modifyEnable = false;
-                               }
-                       }
-               }
+                        if (option.getName().equals(OptionType.SPREAD_ON_START.getName())) {
+                                if(option.getValue().equals(OptionType.VALUE_FALSE)){
+                                        this.spreadOnStart = false;
+                                }
+                        }
+                }
        }
 
 
@@ -91,14 +83,14 @@ public class LabelViewItem extends AdvancedViewItem{
 
        @Override
        public void drawDetail() {
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        subItem.drawDetail();
                }
        }
 
        @Override
        public boolean settingDetailItem(VMPropertyValue value) {
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        subItem.settingDetailItem(value);
                }
                return true;
@@ -139,31 +131,31 @@ public class LabelViewItem extends AdvancedViewItem{
 
        @Override
        public void closeItem() {
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        subItem.closeItem();
                }
        }
 
        @Override
        public void setValue(VMPropertyValue value) {
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        subItem.setValue(value);
                }
        }
 
        @Override
        public void drawModify() {
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        subItem.drawModify();
                        if (subItem.getModifyEnable() == null) {
-                               subItem.setModifyEnable(modifyEnable);
+                               subItem.setModifyEnable(isModifyEnable()); // Set sub item's state as parent's.
                        }
                }
        }
 
        @Override
        public boolean settingModifyItem(VMPropertyValue value) {
-               for (ISubViewItem subItem : getSubItemList()) {
+               for (DetailSubViewItem subItem : getSubItemList()) {
                        subItem.settingModifyItem(value);
                }
                if (!isCreateMode()) {
@@ -173,9 +165,9 @@ public class LabelViewItem extends AdvancedViewItem{
        }
 
 
-       protected List<ISubViewItem> getSubItemList() {
+       protected List<DetailSubViewItem> getSubItemList() {
                if (subItemList == null) {
-                       subItemList = new ArrayList<ISubViewItem>();
+                       subItemList = new ArrayList<DetailSubViewItem>();
 
                        List<Item> itemList = template.getItem();
                        int i=0;
@@ -224,8 +216,33 @@ public class LabelViewItem extends AdvancedViewItem{
        }
 
        @Override
-       public boolean checkValue() {
-               return true;
+       public ItemState checkValue() {
+               DetailSubViewItem errorItem = null;
+               for (DetailSubViewItem subItem : getSubItemList()) {
+                       subItem.checkValue();
+                       subItem.updateItemUI();
+
+                       if (subItem.getItemState().isError()) {
+                               if (errorItem == null || !errorItem.getItemState().isError()) {
+                                       errorItem = subItem;
+                               }
+
+                       } else if (subItem.getItemState().isWarning()) {
+                               if (errorItem == null || errorItem.getItemState().isNormal()) {
+                                       errorItem = subItem;
+                               }
+                       }
+               }
+
+               if (errorItem == null) {
+                       itemState.setNormal();
+
+               } else {
+                       itemState.updateState(errorItem.getItemState());
+               }
+
+               return itemState;
        }
 
+
 }
index 556f59e..c3c88ea 100644 (file)
@@ -46,7 +46,7 @@ import org.tizen.emulator.manager.ui.widgets.ImageButton;
 import org.tizen.emulator.manager.vms.VMPropertyValue;
 import org.tizen.emulator.manager.vms.xml.template.Item;
 
-public class OnOffSubViewItem extends SubViewItem{
+public class OnOffSubViewItem extends DetailSubViewItem{
 
        protected boolean oldValue;
        protected boolean newValue;
@@ -66,6 +66,10 @@ public class OnOffSubViewItem extends SubViewItem{
                super(parentItem, comp, template);
        }
 
+       public boolean getValue() {
+               return newValue;
+       }
+
        @Override
        public void drawModify() {
                makeCategory();
@@ -126,8 +130,13 @@ public class OnOffSubViewItem extends SubViewItem{
                                        newValue = true;
                                        buttonLabel.setText(StringResources.SUPPORTED);
                                }
-                               if (!parentItem.isCreateMode()) {
-                                       parentItem.getListener().ChangeValue(parentItem.getThis());
+
+                               if (parentItem.isCreateMode()) {
+                                       parentItem.getListener().changeCreateConfirmButton();
+
+                               } else {
+                                       parentItem.getListener().changeModifyConfirmButton(
+                                                       parentItem.getThis());
                                }
                        }
 
@@ -167,7 +176,7 @@ public class OnOffSubViewItem extends SubViewItem{
                        onOffButton.setSelection(true);
                        buttonLabel.setText(StringResources.NOT_SUPPORTED);
                }
-               setItemState();
+               setItemEnabled();
                return true;
        }
 
index 2d531a7..db24691 100644 (file)
@@ -53,6 +53,7 @@ public class OnOffViewItem extends AdvancedViewItem{
 
        protected String name;
 
+       private boolean oldValue;
        private boolean newValue;
 
        public static String VALUE_ON = "on";
@@ -68,15 +69,13 @@ public class OnOffViewItem extends AdvancedViewItem{
 
 
        public OnOffViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
-               super(lineLabelViewItem);
+               super(template, lineLabelViewItem);
                if (lineLabelViewItem == null) {
                        INDENT = 0;
                }
-
-               name = template.getName();
-               title = template.getTitle();
                count = 1;
 
+               parseOption(template.getOption());
        }
 
        @Override
@@ -204,9 +203,4 @@ public class OnOffViewItem extends AdvancedViewItem{
                return true;
        }
 
-       @Override
-       public boolean checkValue() {
-               return true;
-       }
-
 }
index 49a1d90..4aead85 100644 (file)
@@ -50,7 +50,7 @@ import org.tizen.emulator.manager.ui.widgets.ImageLabel;
 import org.tizen.emulator.manager.vms.VMPropertyValue;
 import org.tizen.emulator.manager.vms.xml.template.Item;
 
-public class SpinnerSubViewItem extends SubViewItem {
+public class SpinnerSubViewItem extends DetailSubViewItem {
 
        protected int oldValue;
        protected int newValue;
@@ -67,6 +67,10 @@ public class SpinnerSubViewItem extends SubViewItem {
                // TODO Auto-generated constructor stub
        }
 
+       public int getValue() {
+               return newValue;
+       }
+
        @Override
        public void drawModify() {
                makeCategory();
index c2f58df..e1c346c 100644 (file)
@@ -51,7 +51,7 @@ import org.tizen.emulator.manager.vms.VMProperty;
 import org.tizen.emulator.manager.vms.VMPropertyValue;
 import org.tizen.emulator.manager.vms.xml.template.Item;
 
-public class TextSubViewItem extends SubViewItem {
+public class TextSubViewItem extends DetailSubViewItem {
 
        protected String oldValue;
        protected String newValue;
@@ -65,6 +65,11 @@ public class TextSubViewItem extends SubViewItem {
                super(parentItem, comp, template);
        }
 
+       public String getValue() {
+               return newValue;
+       }
+
+
        public void drawModify() {
                makeCategory();
 
@@ -150,7 +155,7 @@ public class TextSubViewItem extends SubViewItem {
        public boolean settingModifyItem(VMPropertyValue value) {
                newValue = getModifyValue(value);
                text.setText(newValue);
-               setItemState();
+               setItemEnabled();
                return false;
        }
 
index 66099e3..a4927d0 100644 (file)
 
 package org.tizen.emulator.manager.ui.detail.item.template;
 
-import java.util.List;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.KeyAdapter;
 import org.eclipse.swt.events.KeyEvent;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
+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.widgets.Canvas;
 import org.eclipse.swt.widgets.Text;
 import org.tizen.emulator.manager.resources.ColorResources;
 import org.tizen.emulator.manager.resources.FontResources;
@@ -49,17 +52,13 @@ import org.tizen.emulator.manager.resources.PatchImageResources;
 import org.tizen.emulator.manager.ui.detail.item.AdvancedViewItem;
 import org.tizen.emulator.manager.ui.detail.item.ItemChangeState;
 import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
-import org.tizen.emulator.manager.ui.detail.item.OptionType;
 import org.tizen.emulator.manager.ui.widgets.ImageLabel;
 import org.tizen.emulator.manager.vms.VMProperty;
 import org.tizen.emulator.manager.vms.VMPropertyValue;
 import org.tizen.emulator.manager.vms.xml.template.Item;
-import org.tizen.emulator.manager.vms.xml.template.Option;
 
 public class TextViewItem extends AdvancedViewItem{
 
-       protected String name;
-
        protected String oldValue = "";
        protected String newValue = "";
 
@@ -72,37 +71,17 @@ public class TextViewItem extends AdvancedViewItem{
        protected Image INPUTBOX_ON_IMAGE = null;
        protected Image INPUTBOX_OFF_IMAGE = null;
 
-       protected boolean modifyEnable = true;
-       protected boolean useDefaultOnCreate = false;
-       protected String defaultOnCreate = null;
-
        protected String VALUE_FALSE = "false";
 
        public TextViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
-               super(lineLabelViewItem);
+               super(template, lineLabelViewItem);
                if (lineLabelViewItem == null) {
                        INDENT = 0;
                }
-               name = template.getName();
-               title = template.getTitle();
                count = 1;
                parseOption(template.getOption());
        }
 
-       protected void parseOption(List<Option> optionList) {
-               for (Option option : optionList) {
-                       if (option.getName().equals(OptionType.DEFAULT_ON_CREATE.getName())) {
-                               useDefaultOnCreate = true;
-                               defaultOnCreate = option.getValue();
-
-                       } else if (option.getName().equals(OptionType.MODIFY_ENABLE.getName())) {
-                               if (option.getValue().equals(VALUE_FALSE)) {
-                                       modifyEnable = false;
-                               }
-                       }
-               }
-       }
-
        @Override
        public void drawDetail() {
                if (INPUTBOX_OFF_IMAGE == null) {
@@ -121,7 +100,7 @@ public class TextViewItem extends AdvancedViewItem{
 
        @Override
        public void drawModify() {
-               if (modifyEnable) {
+               if (isModifyEnable()) {
                        if (INPUTBOX_ON_IMAGE == null) {
                                INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(INPUTBOX_WIDTH);
                        }
@@ -193,10 +172,10 @@ public class TextViewItem extends AdvancedViewItem{
                                newValue = text.getText();
 
                                if (isCreateMode()) {
-                                       getListener().changeConfirmButton();
+                                       getListener().changeCreateConfirmButton();
 
                                } else {
-                                       getListener().changeConfirmButton(getThis());
+                                       getListener().changeModifyConfirmButton(getThis());
                                }
                        }
                });
@@ -249,7 +228,7 @@ public class TextViewItem extends AdvancedViewItem{
                        newValue = value.getAdvancedOptionValue(name);
                }
 
-               if (modifyEnable) {
+               if (isModifyEnable()) {
                        text.setText(newValue);
 
                } else {
@@ -259,11 +238,6 @@ public class TextViewItem extends AdvancedViewItem{
        }
 
        @Override
-       public boolean checkValue() {
-               return true;
-       }
-
-       @Override
        public void setEnabled(boolean enabled) {
                valueLabel.setEnabled(enabled);
                text.setEnabled(enabled);
index 2dac04a..f0f4840 100644 (file)
@@ -42,16 +42,18 @@ import org.eclipse.swt.widgets.Canvas;
 import org.eclipse.swt.widgets.Composite;
 import org.tizen.emulator.manager.resources.ColorResources;
 import org.tizen.emulator.manager.resources.FontResources;
+import org.tizen.emulator.manager.ui.UIHelper;
 
 public class ImageLabel extends Canvas{
-       private WSTATE state = WSTATE.NORMAL;
-       private Image enableImage;
-       private Image disableImage;
-       private Font font;
-       private Color enableFontColor;
-       private Color disableFontColor;
-       private Point fontPoint;
-       private String text;
+       protected WSTATE state = WSTATE.NORMAL;
+       protected Image enableImage;
+       protected Image disableImage;
+       protected Font font;
+       protected Color enableFontColor;
+       protected Color disableFontColor;
+       protected Point fontPoint;
+       protected String text;
+       protected String displayText;
        public ImageLabel(Composite parent, int style) {
                super(parent, style);
 
@@ -59,67 +61,57 @@ public class ImageLabel extends Canvas{
                setEnableFontColor(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
                setDisableFontColor(ColorResources.DETAIL_DISABLE_FONT_COLOR.getColor());
 
-               this.addPaintListener(labelPaintListener);
+               addPaintListener();
        }
 
-       private PaintListener labelPaintListener = new PaintListener() {
+       public void drawImage(PaintEvent e) {
+               Image image = (state == WSTATE.NORMAL
+                               ? enableImage : disableImage);
+               if (image == null) {
+                       return;
+               }
 
-               @Override
-               public void paintControl(PaintEvent e) {
-                       Image image = (state == WSTATE.NORMAL
-                                       ? enableImage : disableImage);
-                       if (image == null) {
-                               return;
-                       }
+               Rectangle rect = ((Canvas)e.widget).getClientArea();
+               GC gc = e.gc;
+               gc.drawImage(image, rect.x, rect.y);
+       }
 
-                       Rectangle rect = ((Canvas)e.widget).getClientArea();
-                       GC gc = e.gc;
-                       gc.drawImage(image, rect.x, rect.y);
-                       drawText(gc, rect);
+       public void drawText(PaintEvent e) {
+               Rectangle rect = ((Canvas)e.widget).getClientArea();
+               GC gc = e.gc;
+               Point p = null;
+               if (text != null) {
+                       if (font == null) {
+                               font = FontResources.DETAIL_LABEL_FONT.getFont();
+                               setFont(font);
+                       }
+                       gc.setFont(font);
+                       gc.setForeground((state == WSTATE.NORMAL ? enableFontColor : disableFontColor));
+
+                       int x = 0, y = 0;
+                       if (fontPoint == null) {
+                               text = UIHelper.shortenText(gc, text, rect);
+                               p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
+                               x = (rect.width - p.x) / 2;
+                               y = (rect.height - p.y) / 2;
+                       } else {
+                               x = fontPoint.x;
+                               y = fontPoint.y;
+                       }
+                       gc.drawText(text, x, y, true);
                }
+       }
+
+       public void addPaintListener() {
+               this.addPaintListener(new PaintListener() {
 
-               private void drawText(GC gc, Rectangle rect) {
-                       Point p = null;
-
-                       if (text != null) {
-                               if (font == null) {
-                                       font = FontResources.DETAIL_LABEL_FONT.getFont();
-                                       setFont(font);
-                               }
-                               gc.setFont(font);
-                               gc.setForeground((state == WSTATE.NORMAL ? enableFontColor : disableFontColor));
-
-                               int x = 0, y = 0;
-                               int offset = 0;
-                               if (fontPoint == null) {
-                                       p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
-                                       x = (rect.width - p.x) / 2;
-                                       y = (rect.height - p.y) / 2;
-                                       if(x < 0) {  // shorten text and add "..."
-                                               String subStr = null;
-                                               String ellipsis = "...";
-                                               int fixedWidth;
-                                               for(int i = text.length() ; i > 0 ; i--){
-                                                       subStr = text.substring(0, i).trim();
-                                                       subStr += ellipsis;
-                                                       fixedWidth = gc.textExtent(subStr, SWT.DRAW_MNEMONIC).x;
-                                                       if(fixedWidth < rect.width){
-                                                               break;
-                                                       }
-                                               }
-                                               text = subStr;
-                                               x = 2;   //     x = (x < 0) ? 2 : x;
-                                       }
-                                       offset = 0;
-                               } else {
-                                       x = fontPoint.x;
-                                       y = fontPoint.y;
-                               }
-
-                               gc.drawText(text, x + offset , y, true);
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               drawImage(e);
+                               drawText(e);
                        }
-               }
-       };
+               });
+       }
 
        public void setText(String text) {
                this.text = text;
diff --git a/common-project/src/org/tizen/emulator/manager/ui/widgets/ItemCategoryLabel.java b/common-project/src/org/tizen/emulator/manager/ui/widgets/ItemCategoryLabel.java
new file mode 100644 (file)
index 0000000..40128a4
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: *
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * Sangho Park<sangho1204.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.widgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.resources.FontResources;
+import org.tizen.emulator.manager.ui.UIHelper;
+import org.tizen.emulator.manager.ui.detail.item.ItemState;
+
+public class ItemCategoryLabel extends ImageLabel {
+
+       private ItemState itemState;
+
+       public ItemCategoryLabel(Composite parent, int style, ItemState itemState) {
+               super(parent, style);
+               this.itemState = itemState;
+       }
+
+       @Override
+       public void drawImage(PaintEvent e) {
+               Rectangle rect = ((Canvas)e.widget).getClientArea();
+               GC gc = e.gc;
+
+               if (itemState.isNormal()) {
+                       Image image = (state == WSTATE.NORMAL
+                                       ? enableImage : disableImage);
+                       if (image == null) {
+                               return;
+                       }
+                       gc.drawImage(image, rect.x, rect.y);
+
+               } else {
+                       // Fill Background by state
+                       gc.setBackground(itemState.getCategoryBGColor());
+                       gc.setAntialias(SWT.ON);
+                       gc.fillRoundRectangle(rect.x, rect.y, rect.width, rect.height, 8, 4);
+               }
+       }
+
+       @Override
+       public void drawText(PaintEvent e) {
+               Rectangle rect = ((Canvas)e.widget).getClientArea();
+               GC gc = e.gc;
+
+               Point p = null;
+               if (text != null) {
+                       if (font == null) {
+                               font = FontResources.DETAIL_LABEL_FONT.getFont();
+                               setFont(font);
+                       }
+                       gc.setFont(font);
+                       Color fontColor = null;
+                       if (state == WSTATE.NORMAL) {
+                               if (itemState.isNormal()) {
+                                       fontColor = enableFontColor; // use ImageLabel's font color.
+//
+                               } else {
+                                       fontColor = enableFontColor;
+//                                     fontColor = itemState.getFontColor();
+                               }
+
+                       } else {
+                               fontColor = disableFontColor;
+                       }
+
+                       gc.setForeground(fontColor);
+
+                       int x = 0, y = 0;
+                       if (fontPoint == null) {
+                               text = UIHelper.shortenText(gc, text, rect);
+                               p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
+                               x = (rect.width - p.x) / 2;
+                               y = (rect.height - p.y) / 2;
+                       } else {
+                               x = fontPoint.x;
+                               y = fontPoint.y;
+                       }
+                       gc.drawText(text, x, y, true);
+                       ((Canvas)e.widget).setToolTipText(itemState.getDisplayMsg());
+               }
+       }
+
+
+}
index f65293a..fab80c9 100644 (file)
@@ -46,71 +46,12 @@ import java.util.List;
 
 import org.tizen.emulator.manager.EmulatorManager;
 import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.platform.Platform;
-import org.tizen.emulator.manager.platform.PlatformList;
-import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.ui.MainDialog;
 import org.tizen.emulator.manager.vms.EmulatorVMList;
 import org.tizen.emulator.manager.vms.VMProperty;
 import org.tizen.emulator.manager.vms.VMProperty.FSImageType;
 
 public class HelperClass {
-       public static boolean checkImageName(String newName, boolean showStatus) {
-               String errorMsg = "";
-               VMProperty prop = null;
-               boolean result = true;
-               if (newName.length() > VMProperty.MAX_NAME_LEN) {
-                       errorMsg = "Max length is 20.";
-                       result = false;
-               } else if (!checkString(newName)) {
-                       errorMsg = "Name has invalid character!";
-                       result = false;
-               } else if ((prop = checkDupulicateName(newName)) != null) {
-                       String platform = prop.getImagePlatform();
-                       errorMsg = "Same name already exists in " + platform + "!";
-
-                       if (!existPlatform(prop)){
-                               errorMsg += " (" + platform + " platform image does not exist.)";
-                               EMLogger.getLogger().info(platform + " platform image does not exist." + StringResources.NEW_LINE
-                                       + "If you do not need this VM(" + newName + "), delete VM folder."
-                                       + StringResources.NEW_LINE + "VM folder path: " + prop.getPropertyFile().getAbsolutePath());
-                       }
-
-                       result = false;
-               } else if (newName.length() == VMProperty.MAX_NAME_LEN) {
-                       errorMsg = "Max length is 20.";
-               } else if (newName.isEmpty()) {
-                       result = false;
-               }
-               if (showStatus) {
-                       if (errorMsg.isEmpty()) {
-                               MainDialog.getStatusBar().reset();
-                       } else {
-                               MainDialog.getStatusBar().error(errorMsg);
-                       }
-               }
-               return result;
-       }
-       private static boolean existPlatform(VMProperty prop) {
-               boolean existPlatform = false;
-
-               String platform = prop.getImagePlatform();
-
-               for (Platform p : PlatformList.getPlatformList()) {
-                       if (p.getName().equals(platform)) {
-                               existPlatform = true;
-                               break;
-                       }
-               }
-
-               if (!existPlatform) {
-                       if (prop.getImageType() == FSImageType.custom) {
-                               existPlatform = true;
-                       }
-               }
-
-               return existPlatform;
-       }
 
        public static boolean checkString(String t) {
                for(char ch : t.toCharArray()) {