From: Minkee Lee Date: Tue, 2 Feb 2016 04:21:35 +0000 (+0900) Subject: option: add suspend support option (experimental) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7fb22c540ff810e782019dd5cc9c9ac6c7955ce8;p=sdk%2Femulator%2Femulator-manager.git option: add suspend support option (experimental) Change-Id: I4a07007647d531250149f2fd17c10194f17d147c Signed-off-by: Minkee Lee --- diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/CommonItemListFactory.java b/src/org/tizen/emulator/manager/ui/renewal/item/CommonItemListFactory.java index 8465842..6e45977 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/item/CommonItemListFactory.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/CommonItemListFactory.java @@ -70,6 +70,7 @@ import org.tizen.emulator.manager.ui.renewal.item.modify.vm.NetTapDeviceItem; import org.tizen.emulator.manager.ui.renewal.item.modify.vm.NetTapDeviceItemForWin; import org.tizen.emulator.manager.ui.renewal.item.modify.vm.NetworkItem; import org.tizen.emulator.manager.ui.renewal.item.modify.vm.OCIDeviceItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.vm.SuspendSupportItem; import org.tizen.emulator.manager.ui.renewal.item.modify.vm.TunerCountryItem; import org.tizen.emulator.manager.ui.renewal.item.modify.vm.TunerItem; import org.tizen.emulator.manager.ui.renewal.item.modify.vm.TunerSystemItem; @@ -280,6 +281,9 @@ public class CommonItemListFactory implements IItemListFactory{ itemList.add(new ViewerTypeItem(name, item.getTitle(), VMTemplateUtil.getOptionList(item.getOptions()), VMTemplateUtil.getCreateDefault(item.getOptions()))); + + } else if (name.equals(ItemName.SUSPEND_SUPPORT)) { + itemList.add(new SuspendSupportItem(item.getTitle())); } } diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/CommonOptionFactory.java b/src/org/tizen/emulator/manager/ui/renewal/item/CommonOptionFactory.java index f0b8b00..d893c1d 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/item/CommonOptionFactory.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/CommonOptionFactory.java @@ -110,7 +110,7 @@ public class CommonOptionFactory implements IOptionFactory { } else if (name.equals(ItemName.RAM_SIZE)) { optionList.add(Option.getInstance(RamSizeOption.class));; - } else if (name.equals(ItemName.SUSPEND_SUPPORT)) { // TODO + } else if (name.equals(ItemName.SUSPEND_SUPPORT)) { optionList.add(Option.getInstance(SuspendSupportOption.class)); } else if (name.equals(ItemName.FILE_SHARE)) { diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/OnOffItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/OnOffItem.java index 5804d73..45e169e 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/OnOffItem.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/OnOffItem.java @@ -165,6 +165,10 @@ public abstract class OnOffItem extends ModifyDialogItem { public void setOnOff(boolean isOn) { this.isOn = isOn; + setOnOff(); + } + + public void setOnOff() { button.setSelection(isOn); labelText = getLabelText(isOn); textCanvas.redraw(); diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/PropertyValue.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/PropertyValue.java index c1d3d18..7eb08a5 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/PropertyValue.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/comp/PropertyValue.java @@ -690,6 +690,18 @@ public class PropertyValue { } } + public boolean isSuspendSupport() { + if (isVMValue()) { + return vmValue.isSupportSuspend; + } + return false; + } + + public void setSuspendSupport(boolean isSupport) { + if (isVMValue()) { + vmValue.isSupportSuspend = isSupport; + } + } // public diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/SuspendSupportItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/SuspendSupportItem.java new file mode 100644 index 0000000..c02729b --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/SuspendSupportItem.java @@ -0,0 +1,114 @@ +/* Emulator Manager + * + * Copyright (C) 2016 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Minkee Lee + * Jihye Kim + * 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.renewal.item.modify.vm; + +import org.eclipse.swt.widgets.Composite; +import org.tizen.emulator.manager.ui.Messages; +import org.tizen.emulator.manager.ui.renewal.item.ItemName; +import org.tizen.emulator.manager.ui.renewal.item.ItemState; +import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.common.OnOffItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem; + +public class SuspendSupportItem extends OnOffItem { + + public SuspendSupportItem(String title) { + super(ItemName.SUSPEND_SUPPORT, title); + } + + @Override + public void create(Composite parent) { + item = new ModifyItem(this); + item.init(parent); + item.setItemHeight(ModifyItem.ITEM_HEIGHT); + item.setItemTitle(createItemTitle(item)); + item.create(); + + makeBody(); + + } + + private void makeBody() { + if (getItemListComp().isDetailMode()) { + createDetailItem(getLabelText(isOn)); + return; + } + + // create on off item + createOnOff(); + + // set value + if (getItemListComp().isCreateMode()) { + isOn = false; // default + } + setOnOff(); + + } + + @Override + public void setInitialValue() { + isOn = propertyValue.isSuspendSupport(); + + } + + @Override + public void setValue() { + propertyValue.setSuspendSupport(isOn); + } + + @Override + public ModifyDialogItem cloneItem() { + return new SuspendSupportItem(getTitle()); + } + + @Override + public void changeItem(ModifyDialogItem srcDialogItem) { + if (getItemListComp().isCreateMode()) { + setOnOff(false); + } + } + + @Override + protected void buttonChanged() { + setValue(); + } + + @Override + public boolean isValid() { + String msg = isOn + ? Messages.getString("SuspendSupportViewItem.SuspendWarning.0") + : ""; + + changeItemState(msg.isEmpty() ? ItemState.NORMAL : ItemState.WARNING + ,getContentRight() ,msg); + return true; + } +}