From: minkee.lee Date: Mon, 15 Jun 2015 03:04:22 +0000 (+0900) Subject: suspend-option: Introduced suspend-option . X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b35e910473bff26edea2747d194933b25b4836d2;p=sdk%2Femulator%2Femulator-manager.git suspend-option: Introduced suspend-option . - Introduced experimental check logic. Change-Id: Ibd4c46fce1beb0544f003c68863b6a37c034b241 Signed-off-by: minkee.lee --- diff --git a/src/org/tizen/emulator/manager/EmulatorManager.java b/src/org/tizen/emulator/manager/EmulatorManager.java index a177e43..7bf4f44 100755 --- a/src/org/tizen/emulator/manager/EmulatorManager.java +++ b/src/org/tizen/emulator/manager/EmulatorManager.java @@ -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; } diff --git a/src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java b/src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java index 9b329a7..8bf2d68 100644 --- a/src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java +++ b/src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java @@ -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 index 0000000..ec137bd --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/detail/item/property/SuspendSupportViewItem.java @@ -0,0 +1,65 @@ +/* + * Emulator Manager + * + * Copyright (C) 2015 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.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; + } + +} diff --git a/src/org/tizen/emulator/manager/ui/detail/item/template/OnOffViewItem.java b/src/org/tizen/emulator/manager/ui/detail/item/template/OnOffViewItem.java index 6bcc32c..755f58a 100644 --- a/src/org/tizen/emulator/manager/ui/detail/item/template/OnOffViewItem.java +++ b/src/org/tizen/emulator/manager/ui/detail/item/template/OnOffViewItem.java @@ -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(); + } }