From 7c58d9fef5769401ff3eb7964d00c70913851b92 Mon Sep 17 00:00:00 2001 From: "minkee.lee" Date: Wed, 2 Dec 2015 21:34:56 +0900 Subject: [PATCH] tuner-option: add tuner option Add tuner option. - Move some common function to CategoryItem. Change-Id: I8994b26fbdda6e4b49e1ecced5fcc251bd81212f Signed-off-by: minkee.lee --- resource/renewal/res/icon_title_tuner.png | Bin 3013 -> 3116 bytes resource/renewal/res/icon_title_tuner_01.png | Bin 0 -> 3013 bytes .../manager/renewal/resources/ImageResources.java | 1 + .../ui/renewal/item/CommonItemListFactory.java | 21 +++ .../emulator/manager/ui/renewal/item/ItemName.java | 1 + .../item/modify/common/ModifyDialogItem.java | 3 + .../ui/renewal/item/modify/vm/CameraItem.java | 13 +- .../ui/renewal/item/modify/vm/CategoryItem.java | 36 ++++- .../ui/renewal/item/modify/vm/NetworkItem.java | 52 ++----- .../renewal/item/modify/vm/TunerCountryItem.java | 173 +++++++++++++++++++++ .../ui/renewal/item/modify/vm/TunerItem.java | 97 ++++++++++++ .../ui/renewal/item/modify/vm/TunerSystemItem.java | 140 +++++++++++++++++ .../ui/renewal/item/modify/vm/TunerTableItem.java | 169 ++++++++++++++++++++ .../manager/ui/renewal/widgets/TextBox.java | 5 +- xsd/x86-standard-template-v2.xml | 14 ++ 15 files changed, 669 insertions(+), 56 deletions(-) create mode 100644 resource/renewal/res/icon_title_tuner_01.png create mode 100644 src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerCountryItem.java create mode 100644 src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerItem.java create mode 100644 src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerSystemItem.java create mode 100644 src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerTableItem.java diff --git a/resource/renewal/res/icon_title_tuner.png b/resource/renewal/res/icon_title_tuner.png index b561c146bd3a1c8bd2b3ac5d0d90a9066e391921..faea9410b667407b47c16b0a629e03fe30e12759 100644 GIT binary patch delta 375 zcmV--0f_#^7pxetzY2c=S4l)cRCwB~lQC`rF%U)HM)66K&Z0mHRhsS6AaMdZq|i85 zU^#<}fJ8@{hzf}&T^g!vM1fpxn@hNGnptGL3nWoSvNW1M^F8xD&O!+Mhh5i>vM!F_ z0ev6`IuhFh@4yBq>qKw#F;QfXzzEoQqw^S0)=hwCU;)fy?5cl-r0b3D0hO|DrL6ms zvjQr?x{})*O~x5{qkGD_0=NNQfhWQ5fq}B_)*C%m)_nk<^_W>LwiE}T0v>?j30;@K zn_QH6ql~c?V~NmOjGBN9xJ8YJ0F?1w$J!9uW-KmJN@lC|0?*lYimXA}k$XqISb} zNTKPXrpmWg#@I%eVh5-QO`F$_pz(_PAACA}UOT=1m#|xW19`*Amd*d4_V+*^0{~ae WGyXz1cDeun000O{MNUMnLSTX}`GKGS diff --git a/resource/renewal/res/icon_title_tuner_01.png b/resource/renewal/res/icon_title_tuner_01.png new file mode 100644 index 0000000000000000000000000000000000000000..b561c146bd3a1c8bd2b3ac5d0d90a9066e391921 GIT binary patch literal 3013 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 Hu0mjfg>9VH literal 0 HcmV?d00001 diff --git a/src/org/tizen/emulator/manager/renewal/resources/ImageResources.java b/src/org/tizen/emulator/manager/renewal/resources/ImageResources.java index ca03805..17ce64b 100644 --- a/src/org/tizen/emulator/manager/renewal/resources/ImageResources.java +++ b/src/org/tizen/emulator/manager/renewal/resources/ImageResources.java @@ -286,6 +286,7 @@ public enum ImageResources { ICON_TITLE_OCI_DEVICE2("icon_title_oci_device"), ICON_TITLE_SENSOR("icon_title_sensor"), ICON_TITLE_TUNER("icon_title_tuner"), + ICON_TITLE_TUNER_01("icon_title_tuner_01"), ICON_TITLE_VERSION("icon_title_version"), ICON_TITLE_PROCESSOR("icon_title_processor"), ICON_TITLE_TREE_EXPANDED("icon_title_tree_expanded"), 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 863d420..76dfb31 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/item/CommonItemListFactory.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/CommonItemListFactory.java @@ -66,6 +66,10 @@ 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.TunerCountryItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.vm.TunerItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.vm.TunerSystemItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.vm.TunerTableItem; public class CommonItemListFactory implements IItemListFactory{ @@ -153,7 +157,19 @@ public class CommonItemListFactory implements IItemListFactory{ } else if (name.equals(ItemName.CAMERA_IMAGE_REAR)) { categoryItem.addSubItems(new CameraImageItem(name, title)); + + } else if (name.equals(ItemName.TUNER_SYSTEM)) { + categoryItem.addSubItems(new TunerSystemItem(title, + VMTemplateUtil.getOptionList(item.getOptions()))); + + } else if (name.equals(ItemName.TUNER_COUNTRY)) { + categoryItem.addSubItems(new TunerCountryItem(title, + VMTemplateUtil.getOptionList(item.getOptions()))); + + } else if (name.equals(ItemName.TUNER_TABLE)) { + categoryItem.addSubItems(new TunerTableItem(title)); } + } @@ -231,6 +247,11 @@ public class CommonItemListFactory implements IItemListFactory{ } else if (name.equals(ItemName.OCI_DEVICE)) { // TODO this may be moved to tv plugin. itemList.add(new OCIDeviceItem(title)); + + } else if (name.equals(ItemName.TUNER)) { + TunerItem tunerItem = new TunerItem(title); + itemList.add(tunerItem); + addSubItems(item.getSubItems(), tunerItem); } } diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/ItemName.java b/src/org/tizen/emulator/manager/ui/renewal/item/ItemName.java index 6d75940..6d6048e 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/item/ItemName.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/ItemName.java @@ -87,6 +87,7 @@ public class ItemName { public static final String TUNER_NUMBER="number"; //$NON-NLS-1$ public static final String TUNER_SYSTEM="system"; //$NON-NLS-1$ public static final String TUNER_COUNTRY="country"; //$NON-NLS-1$ + public static final String TUNER_TABLE = "table"; public static final String TUNER_FILE_PATH="tunerFilePath"; //$NON-NLS-1$ public static final String TUNER_FILE_NAME="tunerFileName"; //$NON-NLS-1$ diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ModifyDialogItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ModifyDialogItem.java index e7b0cc0..089084f 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ModifyDialogItem.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ModifyDialogItem.java @@ -324,6 +324,9 @@ public abstract class ModifyDialogItem implements IModifyDialogItem { protected Canvas createDetailItem(String text) { + if (text == null) { + text = ""; + } item.setBodyLayoutForm(); Canvas canvas = new Canvas(item.getBody(), SWT.NONE) ; canvas.setLayoutData(getDetailItemFormData()); diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CameraItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CameraItem.java index 40138f2..ddbb64a 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CameraItem.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CameraItem.java @@ -97,14 +97,10 @@ public class CameraItem extends CategoryItem { } - private void createSubItems() { - for (ModifyDialogItem item : subItems) { - item.setParentItem(this); - item.setItemListComp(this.getItemListComp()); - item.setInitialValue(this.getItemListComp().getPropertyValue()); - item.create(this.item.getBody()); - item.setVisible(); - } + + @Override + protected void createSubItems() { + super.createSubItems(); if (getItemListComp().isDetailMode()) { return; @@ -226,4 +222,5 @@ public class CameraItem extends CategoryItem { boolean useRear = value.getCheckBoxValue(ItemName.CAMERA, ItemName.CAMERA_REAR); setRearCameraCheck(useRear); } + } diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CategoryItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CategoryItem.java index a14b717..502c1c2 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CategoryItem.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/CategoryItem.java @@ -69,10 +69,6 @@ public abstract class CategoryItem extends ModifyDialogItem { } } - @Override - public void setInitialValue(PropertyValue value) { - // override this if you want. - } protected ModifyDialogItem getSubItemByName(String itemName) { for (ModifyDialogItem subItem : subItems) { @@ -83,5 +79,37 @@ public abstract class CategoryItem extends ModifyDialogItem { return null; } + protected void createSubItems() { + for (ModifyDialogItem item : subItems) { + item.setParentItem(this); + item.setItemListComp(this.getItemListComp()); + item.setInitialValue(this.getItemListComp().getPropertyValue()); + item.create(this.item.getBody()); + item.setVisible(); + } + } + + + @Override + public void setInitialValue(PropertyValue value) { + // nothing to do + } + + + + @Override + public boolean isValid() { + if (getItemListComp().isDetailMode()) { + return true; + } + boolean isValid = true; + for (ModifyDialogItem item : subItems) { + if(!item.isValid()) { + isValid = false; + } + } + return isValid; + } + } diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/NetworkItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/NetworkItem.java index f742077..dedeaad 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/NetworkItem.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/NetworkItem.java @@ -36,7 +36,6 @@ import org.tizen.emulator.manager.renewal.resources.ImageResources; import org.tizen.emulator.manager.ui.renewal.item.ItemName; import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem; import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem; -import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue; public class NetworkItem extends CategoryItem { @@ -74,49 +73,8 @@ public class NetworkItem extends CategoryItem { createSubItems(); } - private void createSubItems() { - for (ModifyDialogItem item : subItems) { - item.setItemListComp(this.getItemListComp()); - item.setInitialValue(this.getItemListComp().getPropertyValue()); - item.setParentItem(this); - item.create(this.item.getBody()); - item.setVisible(); - } - } - - @Override - public void setInitialValue(PropertyValue value) { - for (ModifyDialogItem item : subItems) { - item.setInitialValue(value); - } - } - - - - @Override - public boolean isValid() { - if (getItemListComp().isDetailMode()) { - return true; - } - boolean isValid = true; - for (ModifyDialogItem item : subItems) { - if(!item.isValid()) { - isValid = false; - } - } - return isValid; - } - - @Override - public ModifyDialogItem cloneItem() { - NetworkItem item = new NetworkItem(); - for (ModifyDialogItem subItem : subItems) { - item.addSubItems(subItem.cloneItem()); - } - return item; - } public boolean isNATType() { String connectType = getItemListComp().getPropertyValue(). @@ -221,4 +179,14 @@ public class NetworkItem extends CategoryItem { item.changeItem(srcDialogItem); } } + + @Override + public ModifyDialogItem cloneItem() { + NetworkItem item = new NetworkItem(); + for (ModifyDialogItem subItem : subItems) { + item.addSubItems(subItem.cloneItem()); + } + + return item; + } } diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerCountryItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerCountryItem.java new file mode 100644 index 0000000..bdf28ae --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerCountryItem.java @@ -0,0 +1,173 @@ +/* + * Emulator Manager + * + * Copyright (C) 2015 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 java.util.List; + +import org.eclipse.swt.widgets.Composite; +import org.tizen.emulator.manager.renewal.resources.ColorResources; +import org.tizen.emulator.manager.ui.renewal.item.ItemName; +import org.tizen.emulator.manager.ui.renewal.item.modify.common.ComboItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue; +import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubItemTitle; +import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubModifyItem; +import org.tizen.emulator.manager.ui.renewal.widgets.ComboBox; + +public class TunerCountryItem extends ComboItem { + + List optionList; + private String tunerCountry = ""; + public static String SYSTEM_ATSC = "ATSC"; //$NON-NLS-1$ + + public TunerCountryItem(String title, List optionList) { + super(ItemName.TUNER_COUNTRY, title); + this.optionList = optionList; + } + + @Override + public void create(Composite parent) { + item = new SubModifyItem(this); + item.setItemHeight(SubModifyItem.ITEM_HEIGHT); + item.init(parent); + item.setItemTitle(new SubItemTitle(item.getItemComp(), getTitle(), + ColorResources.WHITE)); + item.create(); + + makeBody(); + } + + private void createDetailItem() { + createDetailItem(tunerCountry); + String tunerSystem = getItemListComp().getPropertyValue().getSubOptionValue( + ItemName.TUNER, ItemName.TUNER_SYSTEM); + + setTitleEnable(SYSTEM_ATSC.equals(tunerSystem)); + } + + + protected void makeBody() { + if (isDetailMode()) { + createDetailItem(); + return; + } + // create combo + createCombo(item, SubModifyItem.BOX_WIDTH); + + // init combo list + initComboList(); + resetCombo(getItemListComp().getPropertyValue().getSubOptionValue( + ItemName.TUNER, ItemName.TUNER_SYSTEM)); + } + + + public void resetCombo(String tunerSystem) { + if (getItemListComp().isCreateMode() + && tunerSystem == null || tunerSystem.isEmpty()) { + tunerSystem = SYSTEM_ATSC; + } + + if (SYSTEM_ATSC.equals(tunerSystem)) { + // enable & init combo + setItemEnable(true); + + // select item + selectItem(); + + } else { + // disable + tunerCountry = ""; + comboBox.setText(""); + setItemEnable(false); + } + } + + + private void initComboList() { + for (String str : optionList) { + addComboItem(str); + } + + selectItem(); + } + + private void selectItem() { + if (comboBox == null || comboBox.isDisposed()) { + return; + } + + int index = -1; + for (int i=0 ; i < getComboItemList().size() ; i++) { + if (getComboItemList().get(i).equals(tunerCountry)) { + index = i; + break; + } + } + + if (index == -1 || getItemListComp().isCreateMode()) { + index = 0; + tunerCountry = getComboItem(index); + } + selectComboItem(index, false); + comboSelected(); + } + + @Override + public void itemSelected(ComboBox comboBox) { + // This is called when combo item is selected + tunerCountry = comboBox.getSelectedItem(); + + comboSelected(); + } + + private void comboSelected() { + getItemListComp().checkValid(); + } + + + @Override + public void setInitialValue(PropertyValue value) { + tunerCountry = value.getSubOptionValue(ItemName.TUNER, getName()); + } + + @Override + public void setValue(PropertyValue value) { + value.setSubOptionValue(ItemName.TUNER, getName(), tunerCountry); + } + + + @Override + public ModifyDialogItem cloneItem() { + return new TunerCountryItem(getTitle(), optionList); + } + +} diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerItem.java new file mode 100644 index 0000000..3dacafc --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerItem.java @@ -0,0 +1,97 @@ +/* + * Emulator Manager + * + * Copyright (C) 2015 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.renewal.resources.ImageResources; +import org.tizen.emulator.manager.ui.renewal.item.ItemName; +import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem; + +public class TunerItem extends CategoryItem { + + public TunerItem(String title) { + super(ItemName.TUNER, title); + // TODO Auto-generated constructor stub + } + + @Override + public void create(Composite parent) { + int itemHeight = 0; + if (subItems.size() == 0) { + itemHeight = ModifyItem.ITEM_HEIGHT; + + } else { + subItems.get(subItems.size()-1).setDrawBottomLine(false); + itemHeight = getItemHeight(); + } + + for (ModifyDialogItem subItem : subItems) { + subItem.setDrawBottomLine(false); + } + + item = new ModifyItem(this); +// item.setItemHeight(ModifyItem.ITEM_HEIGHT * subItems.size()); + item.setItemHeight(itemHeight); + item.init(parent); + item.setItemTitle(createIconTitle(item, ImageResources.ICON_TITLE_TUNER)); + item.create(); + + makeBody(); + } + + + private void makeBody() { + item.setBodyLayoutGrid(1, 0); + createSubItems(); + } + + public void resetCountryItem(String tunerSystem) { + TunerCountryItem item = (TunerCountryItem)getSubItemByName(ItemName.TUNER_COUNTRY); + if (item == null) { + return; + } + item.resetCombo(tunerSystem); + } + + + @Override + public ModifyDialogItem cloneItem() { + TunerItem item = new TunerItem(getTitle()); + for (ModifyDialogItem subItem : subItems) { + item.addSubItems(subItem.cloneItem()); + } + + return item; + } + +} diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerSystemItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerSystemItem.java new file mode 100644 index 0000000..8ce35bf --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerSystemItem.java @@ -0,0 +1,140 @@ +/* + * Emulator Manager + * + * Copyright (C) 2015 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 java.util.List; + +import org.eclipse.swt.widgets.Composite; +import org.tizen.emulator.manager.renewal.resources.ColorResources; +import org.tizen.emulator.manager.ui.renewal.item.ItemName; +import org.tizen.emulator.manager.ui.renewal.item.modify.common.ComboItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue; +import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubItemTitle; +import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubModifyItem; +import org.tizen.emulator.manager.ui.renewal.widgets.ComboBox; + +public class TunerSystemItem extends ComboItem { + + private String tunerSystem = ""; + List optionList; + + public TunerSystemItem(String title, List optionList) { + super(ItemName.TUNER_SYSTEM, title); + this.optionList = optionList; + } + + @Override + public void create(Composite parent) { + item = new SubModifyItem(this); + item.setItemHeight(SubModifyItem.ITEM_HEIGHT); + item.init(parent); + item.setItemTitle(new SubItemTitle(item.getItemComp(), getTitle(), + ColorResources.WHITE)); + item.create(); + + makeBody(); + } + + + protected void makeBody() { + if (isDetailMode()) { + createDetailItem(tunerSystem); + return; + } + // create combo + createCombo(item, SubModifyItem.BOX_WIDTH); + + // init combo list + initComboList(); + } + + + private void initComboList() { + for (String str : optionList) { + addComboItem(str); + } + + selectItem(); + } + + private void selectItem() { + if (comboBox == null || comboBox.isDisposed()) { + return; + } + + int index = -1; + for (int i=0 ; i < getComboItemList().size() ; i++) { + if (getComboItemList().get(i).equals(tunerSystem)) { + index = i; + break; + } + } + + if (index == -1 || getItemListComp().isCreateMode()) { + index = 0; + tunerSystem = getComboItem(index); + } + selectComboItem(index, false); + comboSelected(); + } + + @Override + public void itemSelected(ComboBox comboBox) { + // This is called when combo item is selected + tunerSystem = comboBox.getSelectedItem(); + ((TunerItem)getParentItem()).resetCountryItem(tunerSystem); + + comboSelected(); + } + + private void comboSelected() { + getItemListComp().checkValid(); + } + + @Override + public void setInitialValue(PropertyValue value) { + tunerSystem = value.getSubOptionValue(ItemName.TUNER, getName()); + } + + @Override + public void setValue(PropertyValue value) { + value.setSubOptionValue(ItemName.TUNER, getName(), tunerSystem); + } + + @Override + public ModifyDialogItem cloneItem() { + return new TunerSystemItem(getTitle(), optionList); + } + +} diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerTableItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerTableItem.java new file mode 100644 index 0000000..0919d0f --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/TunerTableItem.java @@ -0,0 +1,169 @@ +/* + * Emulator Manager + * + * Copyright (C) 2012 - 2015 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * JiHye Kim + * 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.renewal.item.modify.vm; + +import java.io.File; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; +import org.tizen.emulator.manager.renewal.resources.ColorResources; +import org.tizen.emulator.manager.ui.renewal.MainDialog; +import org.tizen.emulator.manager.ui.renewal.item.ItemName; +import org.tizen.emulator.manager.ui.renewal.item.modify.common.FileDialogItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue; +import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubItemTitle; +import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubModifyItem; + +public class TunerTableItem extends FileDialogItem { + + private String newTableFilePath = ""; + private String newTableFileName = ""; + private static final int BOX_WIDTH = 154; + + private static FileDialog fd; + + public static String TABLE_DEFAULT = "tuner_default.cfg"; //$NON-NLS-1$ + + public TunerTableItem(String title) { + super(ItemName.TUNER_TABLE, title); + } + + @Override + public void create(Composite parent) { + item = new SubModifyItem(this); + item.setItemHeight(SubModifyItem.ITEM_HEIGHT); + item.init(parent); + item.setItemTitle(new SubItemTitle(item.getItemComp(), getTitle(), + ColorResources.WHITE)); + item.create(); + + makeBody(BOX_WIDTH); + + } + + @Override + protected void makeBody(int textBoxWidth) { + item.setBodyLayoutForm(); + if (getItemListComp().isDetailMode()) { + createDetailItem(); + + } else { + createTextBox(textBoxWidth); + createFileDialogButton(); + String text = newTableFilePath.isEmpty() ? newTableFileName + : newTableFilePath; + setTextBox(text); + } + } + + private void createDetailItem() { + item.setBodyLayoutForm(); + Canvas canvas = new Canvas(item.getBody(), SWT.NONE) ; + canvas.setLayoutData(getDetailItemFormData()); + + String text = newTableFilePath.isEmpty() ? newTableFileName + : newTableFilePath; + settingDetailItemPath(text, canvas); + + } + + @Override + public void setInitialValue(PropertyValue value) { + newTableFileName = value.getSubOptionValue(ItemName.TUNER, ItemName.TUNER_FILE_NAME); + newTableFilePath = value.getSubOptionValue(ItemName.TUNER, ItemName.TUNER_FILE_PATH); + + if (newTableFileName.isEmpty()) { + newTableFileName = TABLE_DEFAULT; + newTableFilePath = ""; + } + } + + @Override + public void setValue(PropertyValue value) { + value.setSubOptionValue(ItemName.TUNER, ItemName.TUNER_FILE_NAME, newTableFileName); + value.setSubOptionValue(ItemName.TUNER, ItemName.TUNER_FILE_PATH, newTableFilePath); + + } + + @Override + public ModifyDialogItem cloneItem() { + return new TunerTableItem(getTitle()); + } + + @Override + public void fileSelected() { + newTableFilePath = filePath; + newTableFileName = newTableFilePath.substring(newTableFilePath + .lastIndexOf(File.separator) + 1, newTableFilePath.length()); + getItemListComp().checkValid(); + } + + + @Override + protected String clickFileDialogButon() { + if (fd == null) { + fd = new FileDialog(MainDialog.getShell(), SWT.OPEN); + fd.setText("Select tuner file"); + + String[] filter = null; + String[] filterName = null; + filter = new String[] {"*.cfg", "*"}; + fd.setFilterExtensions(filter); + + filterName = new String[] { + "Tuner config file (*.cfg) ", "All Files"}; + fd.setFilterNames(filterName); + } + + + fd.setFilterPath(getLastDirectoryPath()); + return fd.open(); + } + + @Override + public boolean isValid() { + boolean isValid = true; + String msg = ""; + if (newTableFilePath != null && !newTableFilePath.isEmpty()) { + if (!new File(newTableFilePath).exists()) { + msg = "Tuner file is not exist"; + isValid = false; + } + } + + changeItemState(!isValid, BOX_WIDTH + 37 /* TODO: dialog button width*/, msg); + return isValid; + } +} diff --git a/src/org/tizen/emulator/manager/ui/renewal/widgets/TextBox.java b/src/org/tizen/emulator/manager/ui/renewal/widgets/TextBox.java index 3395b4d..547a4f9 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/widgets/TextBox.java +++ b/src/org/tizen/emulator/manager/ui/renewal/widgets/TextBox.java @@ -118,8 +118,9 @@ public class TextBox extends NinePatchBox { gc.setForeground(ColorResources.DISABLED_TEXT.getColor()); gc.setFont(FontResources.CONTENT.getFont()); + String displayText = WidgetHelper.shortenText(gc, text, ((Composite)e.widget).getClientArea()); int itemHeight = ((Composite)e.widget).getBounds().height; - Point textExt = gc.textExtent(text); + Point textExt = gc.textExtent(displayText); int posY = (itemHeight - textExt.y) / 2; int posX = TEXT_INDENT; @@ -127,7 +128,7 @@ public class TextBox extends NinePatchBox { int itemWidth = ((Composite)e.widget).getBounds().width; posX = (itemWidth - textExt.x)/ 2; } - gc.drawText(text, posX, posY); + gc.drawText(displayText, posX, posY); } }); diff --git a/xsd/x86-standard-template-v2.xml b/xsd/x86-standard-template-v2.xml index 2e8244e..d7a4944 100644 --- a/xsd/x86-standard-template-v2.xml +++ b/xsd/x86-standard-template-v2.xml @@ -112,6 +112,20 @@ + + + + + + + + + + + + + + -- 2.7.4