From: minkee.lee Date: Thu, 22 Jan 2015 12:56:26 +0000 (+0900) Subject: UI: Improved warning/error indication. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6c9811c5176a29d78c9ddd79e06e73e845b60113;p=sdk%2Femulator%2Femulator-manager.git UI: Improved warning/error indication. - 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 --- diff --git a/common-project/src/org/tizen/emulator/manager/resources/ColorResources.java b/common-project/src/org/tizen/emulator/manager/resources/ColorResources.java index 2aa3eb2..1f8cc8b 100644 --- a/common-project/src/org/tizen/emulator/manager/resources/ColorResources.java +++ b/common-project/src/org/tizen/emulator/manager/resources/ColorResources.java @@ -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; diff --git a/common-project/src/org/tizen/emulator/manager/resources/FontResources.java b/common-project/src/org/tizen/emulator/manager/resources/FontResources.java index 312744c..df667d4 100644 --- a/common-project/src/org/tizen/emulator/manager/resources/FontResources.java +++ b/common-project/src/org/tizen/emulator/manager/resources/FontResources.java @@ -1,175 +1,177 @@ -/* - * Emulator Manager - * - * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * JiHye Kim - * SeokYeon Hwang - * YeongKyoon Lee - * - * 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_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)), - - // * 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; - } +/* + * Emulator Manager + * + * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * JiHye Kim + * SeokYeon Hwang + * YeongKyoon Lee + * + * 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 diff --git a/common-project/src/org/tizen/emulator/manager/tool/CheckVirtualization.java b/common-project/src/org/tizen/emulator/manager/tool/CheckVirtualization.java index 26d7003..d8dfb22 100644 --- a/common-project/src/org/tizen/emulator/manager/tool/CheckVirtualization.java +++ b/common-project/src/org/tizen/emulator/manager/tool/CheckVirtualization.java @@ -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(); } } + } diff --git a/common-project/src/org/tizen/emulator/manager/tool/TapUtil.java b/common-project/src/org/tizen/emulator/manager/tool/TapUtil.java index 2923222..dc0a732 100644 --- a/common-project/src/org/tizen/emulator/manager/tool/TapUtil.java +++ b/common-project/src/org/tizen/emulator/manager/tool/TapUtil.java @@ -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) { diff --git a/common-project/src/org/tizen/emulator/manager/ui/MainDialog.java b/common-project/src/org/tizen/emulator/manager/ui/MainDialog.java index d33b705..1e60aee 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/MainDialog.java +++ b/common-project/src/org/tizen/emulator/manager/ui/MainDialog.java @@ -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; diff --git a/common-project/src/org/tizen/emulator/manager/ui/StatusBar.java b/common-project/src/org/tizen/emulator/manager/ui/StatusBar.java index c43e45f..d218132 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/StatusBar.java +++ b/common-project/src/org/tizen/emulator/manager/ui/StatusBar.java @@ -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 index 0000000..2ea8511 --- /dev/null +++ b/common-project/src/org/tizen/emulator/manager/ui/UIHelper.java @@ -0,0 +1,61 @@ +/* + * Emulator Manager + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * minkee Lee + * SeokYeon Hwang + * sangho Park + * + * 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 index 0000000..c83c606 --- /dev/null +++ b/common-project/src/org/tizen/emulator/manager/ui/VMStatusBar.java @@ -0,0 +1,130 @@ +/* + * Emulator Manager + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * minkee Lee + * SeokYeon Hwang + * sangho Park + * + * 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(); + } + } + }); + } +} diff --git a/common-project/src/org/tizen/emulator/manager/ui/VMsDetailView.java b/common-project/src/org/tizen/emulator/manager/ui/VMsDetailView.java index db89a79..ca876dd 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/VMsDetailView.java +++ b/common-project/src/org/tizen/emulator/manager/ui/VMsDetailView.java @@ -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; diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/DetailViewPage.java b/common-project/src/org/tizen/emulator/manager/ui/detail/DetailViewPage.java index 0f258f8..290d666 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/DetailViewPage.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/DetailViewPage.java @@ -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; diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java b/common-project/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java index 1cbc640..8234e00 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java @@ -263,6 +263,7 @@ public class PInfoViewPage extends DetailViewPage { // draw button settingButtonStatus(property); + } private void settingButtonStatus(VMProperty property) { diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java b/common-project/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java index cf098d4..101036c 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java @@ -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) { diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/AdvancedViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/AdvancedViewItem.java index 09015c1..e16f7ca 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/AdvancedViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/AdvancedViewItem.java @@ -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; } diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItem.java index 8be3483..1a5459f 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItem.java @@ -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 compList = new ArrayList(); 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 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); + } } diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItemChangeListener.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItemChangeListener.java index d419787..8bfbfe5 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItemChangeListener.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/DetailViewItemChangeListener.java @@ -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); } diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/IModifyViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/IModifyViewItem.java index 82021db..5c89a86 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/IModifyViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/IModifyViewItem.java @@ -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); + } diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/IViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/IViewItem.java index 353bbfb..0a00340 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/IViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/IViewItem.java @@ -29,18 +29,15 @@ 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 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 index 0000000..3253b5b --- /dev/null +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/ItemState.java @@ -0,0 +1,182 @@ +/* + * Emulator Manager + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: * + * SeokYeon Hwang + * Minkee Lee + * Sangho Park + * + * 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 index 0000000..e89de8d --- /dev/null +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/ItemValidator.java @@ -0,0 +1,68 @@ +/* + * Emulator Manager + * + * Copyright (C) 20114 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * SeokYeon Hwang + * Minkee Lee + * Sangho Park + * + * 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); + } + +} diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/LineLabelViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/LineLabelViewItem.java index b0d14f6..286db7f 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/LineLabelViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/LineLabelViewItem.java @@ -56,11 +56,8 @@ public class LineLabelViewItem extends DetailViewItem{ private Map itemMap = new HashMap(); - 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 index 0000000..18a3cc7 --- /dev/null +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/ViewItem.java @@ -0,0 +1,129 @@ +/* + * Emulator Manager + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * minkee Lee + * SeokYeon Hwang + * Sangho Park + * + * 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