suspend-option: Introduced suspend-option .
authorminkee.lee <minkee.lee@samsung.com>
Mon, 15 Jun 2015 03:04:22 +0000 (12:04 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Mon, 15 Jun 2015 11:49:00 +0000 (20:49 +0900)
- Introduced experimental check logic.

Change-Id: Ibd4c46fce1beb0544f003c68863b6a37c034b241
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
src/org/tizen/emulator/manager/EmulatorManager.java
src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java
src/org/tizen/emulator/manager/ui/detail/item/property/SuspendSupportViewItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/detail/item/template/OnOffViewItem.java

index a177e43..7bf4f44 100755 (executable)
@@ -38,8 +38,6 @@ import java.util.logging.Level;
 
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
-//import org.tizen.emulator.manager.console.Action;
-//import org.tizen.emulator.manager.console.CommandLineParser;
 import org.tizen.emulator.manager.console.Action;
 import org.tizen.emulator.manager.console.CommandLineParser;
 import org.tizen.emulator.manager.job.CheckGPU;
@@ -143,6 +141,13 @@ public class EmulatorManager {
                return mode;
        }
 
+       public static boolean isInhouseMode() {
+               if (mode == ManagerModeType.INHOUSE_MODE) {
+                       return true;
+               }
+               return false;
+       }
+
        public static MainDialog getMainDialog() {
                return mainDialog;
        }
index 9b329a7..8bf2d68 100644 (file)
@@ -37,6 +37,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.tizen.emulator.manager.EmulatorManager;
 import org.tizen.emulator.manager.ui.detail.item.property.BaseImageViewItem;
 import org.tizen.emulator.manager.ui.detail.item.property.DisplayViewItem;
 import org.tizen.emulator.manager.ui.detail.item.property.FileShareViewItem;
@@ -44,6 +45,7 @@ import org.tizen.emulator.manager.ui.detail.item.property.HWSupportViewItem;
 import org.tizen.emulator.manager.ui.detail.item.property.MaxTouchViewItem;
 import org.tizen.emulator.manager.ui.detail.item.property.ProcessorViewItem;
 import org.tizen.emulator.manager.ui.detail.item.property.RamSizeItem;
+import org.tizen.emulator.manager.ui.detail.item.property.SuspendSupportViewItem;
 import org.tizen.emulator.manager.ui.detail.item.property.VMNameViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.CheckLabelViewItem;
 import org.tizen.emulator.manager.ui.detail.item.template.ComboViewItem;
@@ -65,6 +67,7 @@ public abstract class CommonItemListFactory implements IItemListFactory{
        public static String ITEM_DISPLAY = "display";
        public static String ITEM_RAM_SIZE = "ramSize";
        public static String ITEM_MAX_TOUCH = "maxTouch";
+       public static String ITEM_SUSPEND_SUPPORT = "suspendSupport";
        public static String ITEM_FILE_SHARE = "fileShare";
        public static String ITEM_HW_SUPPORT = "hwSupport";
        public static String ITEM_PROCESSORS = "processors";
@@ -98,6 +101,10 @@ public abstract class CommonItemListFactory implements IItemListFactory{
                                        continue;
                                }
 
+                               if (checkExperimental(item) && !EmulatorManager.isInhouseMode()) {
+                                       continue;
+                               }
+
                                if (itemName.equals(ITEM_VM_NAME)) {
                                        itemList.add(new VMNameViewItem(item, currentLineLabel));
 
@@ -116,6 +123,9 @@ public abstract class CommonItemListFactory implements IItemListFactory{
                                } else if (itemName.equals(ITEM_MAX_TOUCH)) {
                                        itemList.add(new MaxTouchViewItem(item, currentLineLabel));
 
+                               } else if (itemName.equals(ITEM_SUSPEND_SUPPORT)) {
+                                       itemList.add(new SuspendSupportViewItem(item, currentLineLabel));
+
                                } else if (itemName.equals(ITEM_FILE_SHARE)) {
                                        itemList.add(new FileShareViewItem(item, currentLineLabel));
 
@@ -372,4 +382,15 @@ public abstract class CommonItemListFactory implements IItemListFactory{
 
                return false;
        }
+
+       private boolean checkExperimental(Item item) {
+               for (Option opt : item.getOption()) {
+                       if (opt.getName().equals(OptionType.EXPERIMENTAL.getName())) {
+                                       if (opt.getValue().equals(OptionType.VALUE_TRUE)) {
+                                               return true;
+                                       }
+                       }
+               }
+               return false;
+       }
 }
diff --git a/src/org/tizen/emulator/manager/ui/detail/item/property/SuspendSupportViewItem.java b/src/org/tizen/emulator/manager/ui/detail/item/property/SuspendSupportViewItem.java
new file mode 100644 (file)
index 0000000..ec137bd
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 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.property;
+
+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.OnOffViewItem;
+import org.tizen.emulator.manager.vms.VMPropertyValue;
+import org.tizen.emulator.manager.vms.xml.template.Item;
+
+public class SuspendSupportViewItem extends OnOffViewItem {
+
+       public SuspendSupportViewItem(Item template,
+                       LineLabelViewItem lineLabelViewItem) {
+               super(template, lineLabelViewItem);
+       }
+
+       @Override
+       public ItemState checkValue() {
+               itemState.setNormal();
+               if (getValue() == true) {
+                       itemState.setWarning("This is incomplete feature. It may not work properly.");
+               }
+               return itemState;
+       }
+
+       @Override
+       public String getItemValue(VMPropertyValue value) {
+               return value.isSupportSuspend ? VALUE_ON : VALUE_OFF;
+       }
+
+       @Override
+       public void setValue(VMPropertyValue value) {
+               value.isSupportSuspend = newValue;
+       }
+
+}
index 6bcc32c..755f58a 100644 (file)
@@ -53,8 +53,8 @@ public class OnOffViewItem extends AdvancedViewItem{
 
        protected String name;
 
-       //private boolean oldValue;
-       private boolean newValue;
+       protected boolean oldValue;
+       protected boolean newValue;
 
        public static String VALUE_ON = "on";
        public static String VALUE_OFF = "off";
@@ -64,8 +64,8 @@ public class OnOffViewItem extends AdvancedViewItem{
        protected int INPUTBOX_WIDTH = 175;
 
        // for Modify view
-       private Label buttonLabel;
-       private ImageButton onOffButton;
+       protected Label buttonLabel;
+       protected ImageButton onOffButton;
 
 
        public OnOffViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
@@ -78,6 +78,10 @@ public class OnOffViewItem extends AdvancedViewItem{
                parseOption(template.getOption());
        }
 
+       public boolean getValue() {
+               return newValue;
+       }
+
        @Override
        public void drawDetail() {
                valueLabel = new ImageLabel(compList.get(0), SWT.NONE);
@@ -94,8 +98,8 @@ public class OnOffViewItem extends AdvancedViewItem{
        // Set string value("on" / "off") in Info view.
        @Override
        public boolean settingDetailItem(VMPropertyValue value) {
-               String onOffVal = value.getAdvancedOptionValue(name).toLowerCase();
-               if (onOffVal.equals(VALUE_ON)) {
+               boolean val = getItemValue(value).equals(VALUE_ON) ? true : false;
+               if (val == true) {
                        valueLabel.setText(StringResources.SUPPORTED);
                } else {
                        valueLabel.setText(StringResources.NOT_SUPPORTED);
@@ -168,8 +172,11 @@ public class OnOffViewItem extends AdvancedViewItem{
                                        newValue = true;
                                        buttonLabel.setText(StringResources.SUPPORTED);
                                }
-                               if (!isCreateMode()) {
-                                       getListener().ChangeValue(getThis());
+                               if (isCreateMode()) {
+                                       getListener().changeCreateConfirmButton();
+
+                               } else {
+                                       getListener().changeModifyConfirmButton(getThis());
                                }
                        }
 
@@ -188,8 +195,7 @@ public class OnOffViewItem extends AdvancedViewItem{
        @Override
        public boolean settingModifyItem(VMPropertyValue value) {
                onOffButton.setEnabled(true);
-               boolean onOff = value.getAdvancedOptionValue(name).toLowerCase().equals(VALUE_ON)
-                               ? true : false;
+               boolean onOff = getItemValue(value).equals(VALUE_ON) ? true : false;
 //             newValue = oldValue = onOff;
                newValue = onOff;
 
@@ -203,4 +209,9 @@ public class OnOffViewItem extends AdvancedViewItem{
                return true;
        }
 
+
+       @Override
+       public String getItemValue(VMPropertyValue value) {
+               return value.getAdvancedOptionValue(name).toLowerCase();
+       }
 }