GL-version: set default value
authorminkee.lee <minkee.lee@samsung.com>
Tue, 22 Dec 2015 11:14:34 +0000 (20:14 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 23 Dec 2015 07:48:39 +0000 (16:48 +0900)
Default value is applied when create VM.

Change-Id: If94598efa1c114703add581c18acd17a28c77db4
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
src/org/tizen/emulator/manager/template/renewal/VMTemplateUtil.java
src/org/tizen/emulator/manager/ui/renewal/item/CommonItemListFactory.java
src/org/tizen/emulator/manager/ui/renewal/item/OptionName.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ComboItem.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/GLVersionItem.java
xsd/x86-standard-template-v2.xml

index 6798327..06c1872 100644 (file)
@@ -219,6 +219,15 @@ public class VMTemplateUtil {
                return optionMap;
        }
 
+       public static String getCreateDefault(List<VMItemOption> optionList) {
+               for (VMItemOption option : optionList) {
+                       if (option.getName().equals(OptionName.CREATE_DEFAULT)) {
+                               return option.getValue();
+                       }
+               }
+               return null;
+       }
+
 
        public static List<String> getOptionList(List<VMItemOption> optionList) {
                List<String> resultList = new ArrayList<String>();
index 403f073..6ba603b 100644 (file)
@@ -252,7 +252,8 @@ public class CommonItemListFactory implements IItemListFactory{
 
                } else if (name.equals(ItemName.GL_VERSION)) {
                        itemList.add(new GLVersionItem(name, title,
-                                       VMTemplateUtil.getOptionMap(item.getOptions())));
+                                       VMTemplateUtil.getOptionMap(item.getOptions()),
+                                       VMTemplateUtil.getCreateDefault(item.getOptions())));
 
                } else if (name.equals(ItemName.OCI_DEVICE)) {
                        // TODO this may be moved to tv plugin.
index 2acaf65..282698e 100644 (file)
@@ -48,4 +48,6 @@ public class OptionName {
        public static final String WIN = "win"; //$NON-NLS-1$
        public static final String MAC = "mac"; //$NON-NLS-1$
 
+       public static final String CREATE_DEFAULT = "createDefault";
+
 }
index 5e5c8f2..5b66570 100644 (file)
@@ -44,6 +44,8 @@ import org.tizen.emulator.manager.ui.renewal.widgets.WSTATE;
 public abstract class ComboItem extends ModifyDialogItem {
 
        protected ComboBox comboBox;
+       protected String createDefault;
+       protected String comboValue;
 
        public static final int COMBO_WIDTH = 124;
 
@@ -51,6 +53,15 @@ public abstract class ComboItem extends ModifyDialogItem {
                super(name, title);
        }
 
+       public ComboItem(String name, String title, String createDefault) {
+               super(name, title);
+               this.createDefault = createDefault;
+       }
+
+       protected boolean useCreateDefault() {
+               return getItemListComp().isCreateMode() &&
+                               (createDefault != null && !createDefault.isEmpty());
+       }
 
        protected void addComboItem(String item) {
                comboBox.addItem(item);
index 4453392..9d76aa3 100644 (file)
@@ -49,10 +49,10 @@ public class GLVersionItem extends ComboItem {
        private final Map<String, String> optionMap;
        String glVersion = "";
 
-       public GLVersionItem(String name, String title, Map<String, String> optionMap) {
-               super(name, title);
+       public GLVersionItem(String name, String title, Map<String, String> optionMap,
+                       String createDefault) {
+               super(name, title, createDefault);
                this.optionMap = optionMap;
-
        }
 
 
@@ -124,9 +124,6 @@ public class GLVersionItem extends ComboItem {
                if (optionMap.get(VER2_VER3) != null) {
                        addComboItem(optionMap.get(VER2_VER3), VER2_VER3);
                }
-
-               // select item
-               selectItem();
        }
 
        private void selectItem() {
@@ -134,6 +131,10 @@ public class GLVersionItem extends ComboItem {
                        return;
                }
 
+               if (useCreateDefault()) {
+                       glVersion = createDefault;
+               }
+
                int index = -1;
                for (int i=0 ; i < getComboItemList().size() ; i++) {
                        if (getComboItemList().get(i).equals(optionMap.get(glVersion))) {
@@ -146,6 +147,7 @@ public class GLVersionItem extends ComboItem {
                        index = 0;
                        glVersion = (String)getCobmoData(0);
                }
+
                selectComboItem(index, false);
                comboSelected();
        }
@@ -176,7 +178,7 @@ public class GLVersionItem extends ComboItem {
 
        @Override
        public ModifyDialogItem cloneItem() {
-               return new GLVersionItem(getName(), getTitle(), optionMap);
+               return new GLVersionItem(getName(), getTitle(), optionMap, createDefault);
        }
 
        @Override
index d7a4944..cdc63fb 100644 (file)
@@ -78,6 +78,7 @@
                        <option name="v2.0_v3.0">v2.0 &amp; v3.0</option>
                        <option name="v1.1_v2.0">v1.1 &amp; v2.0</option>
                        <option name="supportOS">mac</option>
+                       <option name="createDefault">v2.0_v3.0</option>
                </item>
                <item name="network" title="Network" type="label">
                        <item name="proxy" title="Proxy" type="combo" >