template: load XML and draw VM-modify dialog.
authorminkee.lee <minkee.lee@samsung.com>
Mon, 2 Nov 2015 12:04:55 +0000 (21:04 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 4 Nov 2015 02:18:32 +0000 (11:18 +0900)
Change-Id: I51aba4508c5c84765676b925f9e9b80f43d4430e
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
34 files changed:
jaxb_src/org/tizen/emulator/manager/vms/xml/template/v2/Information.java [moved from jaxb_src/org/tizen/emulator/manager/vms/xml/template2/Information.java with 96% similarity]
jaxb_src/org/tizen/emulator/manager/vms/xml/template/v2/Item.java [moved from jaxb_src/org/tizen/emulator/manager/vms/xml/template2/Item.java with 97% similarity]
jaxb_src/org/tizen/emulator/manager/vms/xml/template/v2/ItemGroup.java [moved from jaxb_src/org/tizen/emulator/manager/vms/xml/template2/ItemGroup.java with 96% similarity]
jaxb_src/org/tizen/emulator/manager/vms/xml/template/v2/ItemList.java [moved from jaxb_src/org/tizen/emulator/manager/vms/xml/template2/ItemList2.java with 95% similarity]
jaxb_src/org/tizen/emulator/manager/vms/xml/template/v2/ObjectFactory.java [moved from jaxb_src/org/tizen/emulator/manager/vms/xml/template2/ObjectFactory.java with 83% similarity]
jaxb_src/org/tizen/emulator/manager/vms/xml/template/v2/Option.java [moved from jaxb_src/org/tizen/emulator/manager/vms/xml/template2/Option.java with 96% similarity]
jaxb_src/org/tizen/emulator/manager/vms/xml/template/v2/package-info.java [moved from jaxb_src/org/tizen/emulator/manager/vms/xml/template2/package-info.java with 80% similarity]
src/org/tizen/emulator/manager/platform/BaseImage.java
src/org/tizen/emulator/manager/platform/Platform.java
src/org/tizen/emulator/manager/plugin/PluginStringResources.java
src/org/tizen/emulator/manager/resources/FilePathResources.java
src/org/tizen/emulator/manager/resources/StringResources.java
src/org/tizen/emulator/manager/template/Template2.java
src/org/tizen/emulator/manager/template/TemplateLoader.java
src/org/tizen/emulator/manager/template/renewal/TemplateLoader.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/dialog/ItemListUtil.java
src/org/tizen/emulator/manager/ui/renewal/dialoghandler/DeviceTemplateDialogHandler.java
src/org/tizen/emulator/manager/ui/renewal/dialoghandler/VMModifyHandler.java
src/org/tizen/emulator/manager/ui/renewal/item/CommonItemListFactory.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/IItemListFactory.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/ItemName.java
src/org/tizen/emulator/manager/ui/renewal/item/OptionName.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/CheckBoxItem.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ConnectivityItem.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/DisplayItem.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/ProcessorItem.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/RamSizeItem.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/SensorItem.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/template/CameraItem.java
xsd/devicetemplate-dialog-mobile.xml
xsd/em-template-v2.xsd [moved from xsd/em-template2.xsd with 98% similarity]
xsd/template-ui-mobile.xml [deleted file]
xsd/x86-standard-template.xml [new file with mode: 0644]
xsd/x86-standard-template2.xml [deleted file]

@@ -2,11 +2,11 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2015.08.03 at 02:50:57 PM KST 
+// Generated on: 2015.11.02 at 07:56:31 PM KST 
 //
 
 
-package org.tizen.emulator.manager.vms.xml.template2;
+package org.tizen.emulator.manager.vms.xml.template.v2;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -2,11 +2,11 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2015.08.03 at 02:50:57 PM KST 
+// Generated on: 2015.11.02 at 07:56:31 PM KST 
 //
 
 
-package org.tizen.emulator.manager.vms.xml.template2;
+package org.tizen.emulator.manager.vms.xml.template.v2;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -2,11 +2,11 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2015.08.03 at 02:50:57 PM KST 
+// Generated on: 2015.11.02 at 07:56:31 PM KST 
 //
 
 
-package org.tizen.emulator.manager.vms.xml.template2;
+package org.tizen.emulator.manager.vms.xml.template.v2;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -2,11 +2,11 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2015.08.03 at 02:50:57 PM KST 
+// Generated on: 2015.11.02 at 07:56:31 PM KST 
 //
 
 
-package org.tizen.emulator.manager.vms.xml.template2;
+package org.tizen.emulator.manager.vms.xml.template.v2;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -43,8 +43,8 @@ import javax.xml.bind.annotation.XmlType;
     "information",
     "itemGroup"
 })
-@XmlRootElement(name = "ItemList2")
-public class ItemList2 {
+@XmlRootElement(name = "ItemList")
+public class ItemList {
 
     protected Information information;
     protected List<ItemGroup> itemGroup;
@@ -2,11 +2,11 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2015.08.03 at 02:50:57 PM KST 
+// Generated on: 2015.11.02 at 07:56:31 PM KST 
 //
 
 
-package org.tizen.emulator.manager.vms.xml.template2;
+package org.tizen.emulator.manager.vms.xml.template.v2;
 
 import javax.xml.bind.annotation.XmlRegistry;
 
@@ -14,7 +14,7 @@ import javax.xml.bind.annotation.XmlRegistry;
 /**
  * This object contains factory methods for each 
  * Java content interface and Java element interface 
- * generated in the org.tizen.emulator.manager.vms.xml.template2 package. 
+ * generated in the org.tizen.emulator.manager.vms.xml.template.v2 package. 
  * <p>An ObjectFactory allows you to programatically 
  * construct new instances of the Java representation 
  * for XML content. The Java representation of XML 
@@ -30,18 +30,18 @@ public class ObjectFactory {
 
 
     /**
-     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.tizen.emulator.manager.vms.xml.template2
+     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.tizen.emulator.manager.vms.xml.template.v2
      * 
      */
     public ObjectFactory() {
     }
 
     /**
-     * Create an instance of {@link ItemList2 }
+     * Create an instance of {@link ItemList }
      * 
      */
-    public ItemList2 createItemList2() {
-        return new ItemList2();
+    public ItemList createItemList() {
+        return new ItemList();
     }
 
     /**
@@ -2,11 +2,11 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2015.08.03 at 02:50:57 PM KST 
+// Generated on: 2015.11.02 at 07:56:31 PM KST 
 //
 
 
-package org.tizen.emulator.manager.vms.xml.template2;
+package org.tizen.emulator.manager.vms.xml.template.v2;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -2,8 +2,8 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2015.08.03 at 02:50:57 PM KST 
+// Generated on: 2015.11.02 at 07:56:31 PM KST 
 //
 
 @javax.xml.bind.annotation.XmlSchema(namespace = "http://www.tizen.org/em/template", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
-package org.tizen.emulator.manager.vms.xml.template2;
+package org.tizen.emulator.manager.vms.xml.template.v2;
index 3fdfae3..ac5cae7 100644 (file)
@@ -39,15 +39,21 @@ import java.util.logging.Level;
 
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.platform.baseimage.CustomBaseImageWorker;
+import org.tizen.emulator.manager.plugin.ExtensionItem;
 import org.tizen.emulator.manager.plugin.PluginStringResources;
 import org.tizen.emulator.manager.resources.FilePathResources;
 import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.template.ITemplate;
+import org.tizen.emulator.manager.ui.renewal.dialoghandler.VMModifyHandler;
+import org.tizen.emulator.manager.ui.renewal.item.CommonItemListFactory;
+import org.tizen.emulator.manager.ui.renewal.item.IItemListFactory;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
 import org.tizen.emulator.manager.vms.SKIN_SHAPE;
 import org.tizen.emulator.manager.vms.VMProperty;
 import org.tizen.emulator.manager.vms.VMProperty.Architecture;
 import org.tizen.emulator.manager.vms.helper.HelperClass;
 import org.tizen.emulator.manager.vms.option.IOption;
+import org.tizen.emulator.manager.vms.xml.template.v2.ItemList;
 
 public class BaseImage {
        public static BaseImage createCustomBaseImage(Platform platform, String path, String name) {
@@ -88,7 +94,12 @@ public class BaseImage {
        private VMProperty defaultProperty;
        private ITemplate itemTemplate;
 
-       private List<IOption> optionList;
+       protected List<ModifyDialogItem> defaultItemList;
+       protected List<ModifyDialogItem> advancedItemList;
+
+
+
+       protected List<IOption> optionList;
        //private LaunchConfig launchTemplate; // TODO replace xDefaultOption.java
 
        // for custom base image
@@ -252,6 +263,7 @@ public class BaseImage {
                return optionList;
        }
 
+
        public VMProperty getDefaultProperty() {
                return defaultProperty;
        }
@@ -451,4 +463,49 @@ public class BaseImage {
        public void setWorker(CustomBaseImageWorker worker) {
                this.worker = worker;
        }
+
+       public List<ModifyDialogItem> getDefaultItemList() {
+               if (defaultItemList == null) {
+                       makeItemList();
+               }
+
+               return defaultItemList;
+       }
+
+
+       public List<ModifyDialogItem> getAdvancedItemList() {
+               if (advancedItemList == null) {
+                       makeItemList();
+               }
+
+               return advancedItemList;
+       }
+
+
+       private void makeItemList() {
+
+               ItemList template = platform.findTemplate(imageName);
+               if (template == null) {
+                       // load template in {SRC_DIR}/xsd
+                       template = VMModifyHandler.getTmpItemList(profile);
+                       EMLogger.getLogger().warning("Fail to find template. Image : " + imageName);
+                       EMLogger.getLogger().info("Use temp template.");
+               }
+
+               IItemListFactory f = null;
+               ExtensionItem exItem = getPlatform().getPlugin().getExtensionItem(PluginStringResources.ItemFactoryV2);
+               if (exItem != null) {
+                       f = (IItemListFactory)(exItem.getInstance());
+               }
+               if (f == null) {
+                       f = new CommonItemListFactory();
+                       EMLogger.getLogger().warning("Fail to load ItemListFactory2.");
+                       EMLogger.getLogger().info("Use CommonItemListFactory2.");
+               }
+               defaultItemList = f.makeDefaultItemList(template);
+               advancedItemList = f.makeAdvancedItemList(template);
+
+       }
+
+
 }
index b0d507f..0c08e50 100644 (file)
@@ -41,10 +41,11 @@ import org.tizen.emulator.manager.plugin.PluginStringResources;
 import org.tizen.emulator.manager.resources.FilePathResources;
 import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.template.ITemplate;
-import org.tizen.emulator.manager.template.TemplateLoader;
+import org.tizen.emulator.manager.template.renewal.TemplateLoader;
 import org.tizen.emulator.manager.vms.RESOLUTION;
 import org.tizen.emulator.manager.vms.SKIN_SHAPE;
 import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.xml.template.v2.ItemList;
 
 public class Platform {
        public static Platform createInstance(Profile profile, EMPlugin plugin) {
@@ -85,6 +86,10 @@ public class Platform {
        private VMProperty defaultProperty;
        private ITemplate defaultItemTemplate;
 
+       // for new template
+       private final List<ItemList> templateList = new ArrayList<ItemList>();
+       private ItemList defaultTemplate;
+
        // for custom base image
        private ITemplate customItemTemplate;
 
@@ -108,7 +113,6 @@ public class Platform {
 
                loadSkins();
                loadPlugin();
-               TemplateLoader.load(this);
        }
 
        private String makingEmulatorDir() {
@@ -291,4 +295,25 @@ public class Platform {
        public void setCustomItemTemplate(ITemplate customItemTemplate) {
                this.customItemTemplate = customItemTemplate;
        }
+
+       public List<ItemList> getTemplateList() {
+               return templateList;
+       }
+
+       public void setDefaultTemplate(ItemList defaultTemplate) {
+               this.defaultTemplate = defaultTemplate;
+       }
+
+       public ItemList findTemplate(String imageName) {
+               if (templateList.size() == 0) {
+                       TemplateLoader.load(this);
+               }
+
+               for (ItemList template : templateList) {
+                       if (template.getInformation().getImage().equals(imageName)) {
+                               return template;
+                       }
+               }
+               return defaultTemplate;
+       }
 }
index 6ee24c5..861f983 100644 (file)
@@ -35,6 +35,7 @@ public class PluginStringResources {
        // extension point
        // org.tizen.emulator.manager.ui.detail.IItemListFactory
        public final static String ItemFactory = "Item-Factory"; //$NON-NLS-1$
+       public final static String ItemFactoryV2 = "Item-Factory-v2"; //$NON-NLS-1$
        // org.tizen.emulator.manager.ui.widgets.IVMButtonPainter
        public final static String VMButtonPainter = "VMButton-Painter"; //$NON-NLS-1$
        // org.tizen.emulator.manager.vms.IVMWorker
index ffb275f..0910c0b 100644 (file)
@@ -81,7 +81,6 @@ public class FilePathResources {
        private final static String sdcard_suffix = File.separator + "sdcard"; //$NON-NLS-1$
        private final static String skins_suffix = File.separator + "skins"; //$NON-NLS-1$
        private final static String template_suffix = File.separator + "template"; //$NON-NLS-1$
-       private final static String template2_suffix = File.separator + "template2"; //$NON-NLS-1$
        private final static String plugins_suffix = File.separator + "plugins"; //$NON-NLS-1$
 
        private final static String sdkdata_new_emulator_suffix = File.separator
@@ -109,7 +108,6 @@ public class FilePathResources {
        // Platform
        private static String platformSkinsPath;
        private static String platformTemplatePath;
-       private static String platformTemplate2Path;
        private static String platformPluginsPath;
        private static String platformImagesPath;
 
@@ -175,7 +173,6 @@ public class FilePathResources {
 
                platformSkinsPath = resource_suffix + skins_suffix;
                platformTemplatePath = resource_suffix + template_suffix;
-               platformTemplate2Path = resource_suffix + template2_suffix;
                platformPluginsPath = resource_suffix + plugins_suffix;
 
                // SDB path
@@ -497,10 +494,6 @@ public class FilePathResources {
                return platformTemplatePath;
        }
 
-       public static String getPlatformTemplate2Path() {
-               return platformTemplate2Path;
-       }
-
        public static String getPlatformPluginsPath() {
                return platformPluginsPath;
        }
index 77adac4..878ddf5 100644 (file)
@@ -121,4 +121,6 @@ public class StringResources {
        public static final String TOTAL_PROFILE = "all"; //$NON-NLS-1$
 
        public static final String REG_EXP_SPLIT_COMMA = "\\s{0,},\\s{0,}"; //$NON-NLS-1$
+
+       public static final String XML_EXTENSION = ".xml";
 }
index 2b7b92b..f2fcb95 100644 (file)
@@ -36,11 +36,11 @@ import java.util.List;
 import org.tizen.emulator.manager.plugin.EMPlugin;
 import org.tizen.emulator.manager.ui.detail.item.IViewItem;
 import org.tizen.emulator.manager.vms.option.IOption;
-import org.tizen.emulator.manager.vms.xml.template2.ItemList2;
+import org.tizen.emulator.manager.vms.xml.template.v2.ItemList;
 
 public class Template2 implements ITemplate {
 
-       private ItemList2 template;
+       private ItemList template;
 
        @Override
        public String getImageName() {
@@ -81,13 +81,13 @@ public class Template2 implements ITemplate {
 
        @Override
        public Class<?> getXMLObjectType() {
-               return ItemList2.class;
+               return ItemList.class;
        }
 
        @Override
        public void setXMLObject(Object obj) {
-               if (obj instanceof ItemList2) {
-                       template = (ItemList2)obj;
+               if (obj instanceof ItemList) {
+                       template = (ItemList)obj;
                }
        }
 
index 6acff28..7cfcf14 100644 (file)
@@ -85,7 +85,7 @@ public class TemplateLoader {
 
        private static boolean loadTemplateV2(Platform platform) {
                File templateDir = new File(platform.getPlatformPath() + File.separator
-                               + FilePathResources.getPlatformTemplate2Path());
+                               + FilePathResources.getPlatformTemplatePath());
                if (!templateExist(templateDir)) {
                        return false;
                }
diff --git a/src/org/tizen/emulator/manager/template/renewal/TemplateLoader.java b/src/org/tizen/emulator/manager/template/renewal/TemplateLoader.java
new file mode 100644 (file)
index 0000000..6222d2d
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2012 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * 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.template.renewal;
+
+import java.io.File;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.stream.StreamSource;
+
+import org.tizen.emulator.manager.logging.EMLogger;
+import org.tizen.emulator.manager.platform.Platform;
+import org.tizen.emulator.manager.platform.PlatformStringResources;
+import org.tizen.emulator.manager.resources.FilePathResources;
+import org.tizen.emulator.manager.resources.StringResources;
+import org.tizen.emulator.manager.vms.EmulatorVMList;
+import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.xml.template.v2.ItemList;
+
+public class TemplateLoader {
+
+       private static JAXBContext context;
+
+       /** load template for new-ui */
+       public static void load(Platform platform) {
+               // get template dir
+               File templateDir = new File(platform.getPlatformPath() + File.separator
+                               + FilePathResources.getPlatformTemplatePath());
+               if (!templateExist(templateDir)) {
+                       return;
+               }
+
+               // load template file, default file
+               for (File f : templateDir.listFiles()) {
+                       if (!f.getName().endsWith(StringResources.XML_EXTENSION)) {
+                               continue;
+                       }
+                       if (f.getName().contains(PlatformStringResources.TEMPLATE)) { // ui template file for detail view
+                               ItemList template = loadTemplate(f);
+                               if (template != null) {
+                                       if (!checkTemplate(template)) {
+                                               continue;
+                                       }
+                                       platform.getTemplateList().add(template);
+
+                                       // setting default item list
+                                       if (f.getName().contains(PlatformStringResources.STANDARD)) {
+                                               platform.setDefaultTemplate(template);
+                                       }
+
+                               }
+
+                       } else { // property file
+                               EmulatorVMList vmList = EmulatorVMList.getInstance();
+                               VMProperty defaultProperty = vmList.parseXML(f);
+                               if (defaultProperty != null) {
+                                       platform.getPropertyList().add(defaultProperty);
+
+                                       // setting default property
+                                       if (f.getName().contains(PlatformStringResources.STANDARD)) {
+                                               platform.setDefaultProperty(defaultProperty);
+                                       }
+                               }
+                       }
+               }
+       }
+
+       private static boolean checkTemplate(ItemList template) {
+               if (template.getInformation() == null) {
+                       return false;
+               }
+               if (template.getItemGroup() == null) {
+                       return false;
+               }
+               if (template.getVersion() == null) {
+                       return false;
+               }
+               return true;
+       }
+
+       private static boolean templateExist(File template) {
+               if (template == null || !template.exists() || !template.isDirectory()) {
+                       return false;
+               }
+               return true;
+       }
+
+       public static ItemList loadTemplate (File f) {
+               @SuppressWarnings("rawtypes")
+               JAXBElement element = null;
+               JAXBContext context = getContext();
+               if (context != null) {
+                       try {
+                               Unmarshaller unmarshaller = context.createUnmarshaller();
+                               element = unmarshaller.unmarshal(new StreamSource(f), ItemList.class);
+                       } catch (JAXBException e) {
+                               e.printStackTrace();
+                               EMLogger.getLogger().warning("Can not load config file( " //$NON-NLS-1$
+                                                               + f.getName() + ")" + StringResources.NEW_LINE + e.getMessage()); //$NON-NLS-1$
+                               element = null;
+                       }
+                       if (element != null) {
+                               return (ItemList)element.getValue();
+                       }
+               }
+               return null;
+
+       }
+
+
+       private static JAXBContext getContext() {
+               if (context == null) {
+                        try {
+                                context = JAXBContext.newInstance(ItemList.class);
+                        } catch (JAXBException e){
+                                EMLogger.getLogger().warning(e.getMessage());
+                        }
+               }
+               return context;
+       }
+}
index 470c1f0..a48c74f 100644 (file)
@@ -33,6 +33,7 @@ package org.tizen.emulator.manager.ui.renewal.dialog;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.tizen.emulator.manager.EmulatorManager;
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.ui.renewal.item.ItemName;
 import org.tizen.emulator.manager.ui.renewal.item.ItemType;
@@ -49,15 +50,15 @@ import org.tizen.emulator.manager.ui.renewal.item.modify.common.RamSizeItem;
 import org.tizen.emulator.manager.ui.renewal.item.modify.common.SensorItem;
 import org.tizen.emulator.manager.ui.renewal.item.modify.template.CameraItem;
 import org.tizen.emulator.manager.vms.RESOLUTION;
-import org.tizen.emulator.manager.vms.xml.template2.Item;
-import org.tizen.emulator.manager.vms.xml.template2.ItemGroup;
-import org.tizen.emulator.manager.vms.xml.template2.ItemList2;
-import org.tizen.emulator.manager.vms.xml.template2.Option;
+import org.tizen.emulator.manager.vms.xml.template.v2.Item;
+import org.tizen.emulator.manager.vms.xml.template.v2.ItemGroup;
+import org.tizen.emulator.manager.vms.xml.template.v2.ItemList;
+import org.tizen.emulator.manager.vms.xml.template.v2.Option;
 
 public class ItemListUtil {
 
        /** Get UI item for device-template dialog. */
-       public static List<ModifyDialogItem> getDeviceTemplateItemList(ItemList2 itemList2) {
+       public static List<ModifyDialogItem> getDeviceTemplateItemList(ItemList itemList2) {
                if (itemList2 == null) {
                        return null;
                }
@@ -72,6 +73,13 @@ public class ItemListUtil {
                return itemList;
        }
 
+
+       public static List<ModifyDialogItem> getVMTemplateItemList(ItemList itemList2) {
+               List<ModifyDialogItem> itemList = new ArrayList<ModifyDialogItem>();
+               // TODO get plugin, getItemListFactory, makeItemList
+               return itemList;
+       }
+
        private static void addItemList(ItemGroup group, List<ModifyDialogItem> itemList) {
                String name;
                String title;
@@ -90,19 +98,19 @@ public class ItemListUtil {
                                dialogItem = new ProfileItem();
 
                        } else if (name.equals(ItemName.DISPLAY)) {
-                               dialogItem = new DisplayItem(getResolutionList(item));
+                               dialogItem = new DisplayItem(null, getResolutionList(item));
 
                        } else if (name.equals(ItemName.PROCESSORS)) {
-                               dialogItem = new ProcessorItem();
+                               dialogItem = new ProcessorItem(null);
 
                        } else if (name.equals(ItemName.RAM_SIZE)) {
-                               dialogItem = new RamSizeItem();
+                               dialogItem = new RamSizeItem(null);
 
                        } else if (name.equals(ItemName.SENSOR)) {
-                               dialogItem = new SensorItem(getCheckBoxDataList(item));
+                               dialogItem = new SensorItem(null, getCheckBoxDataList(item));
 
                        } else if (name.equals(ItemName.CONNECTIVITY)) {
-                               dialogItem = new ConnectivityItem(getCheckBoxDataList(item));
+                               dialogItem = new ConnectivityItem(null, getCheckBoxDataList(item));
 
                        } else if (name.equals(ItemName.CAMERA)) {
                                dialogItem = new CameraItem(getCheckBoxDataList(item));
@@ -115,7 +123,7 @@ public class ItemListUtil {
                        // check item type
                        if (type.equals(ItemType.CHECK_LABEL)) {
                                dialogItem = new CheckBoxItem(name, title, getCheckBoxNumColumn(item),
-                                               getCheckBoxDataList(item));
+                                               null, getCheckBoxDataList(item));
                        }
                        if (dialogItem != null) {
                                itemList.add(dialogItem);
@@ -123,8 +131,8 @@ public class ItemListUtil {
                }
        }
 
-       private static final int DEFAULT_NUM_COLUMN = 3;
-       private static int getCheckBoxNumColumn(Item item) {
+       public static final int DEFAULT_NUM_COLUMN = 3;
+       public static int getCheckBoxNumColumn(Item item) {
                int numColumn = DEFAULT_NUM_COLUMN;
                String str = getOption(item.getOption(), OptionName.NUM_COLUMN);
                if (str != null) {
@@ -137,7 +145,7 @@ public class ItemListUtil {
                return numColumn;
        }
 
-       private static List<CheckItemData> getCheckBoxDataList(Item item) {
+       public static List<CheckItemData> getCheckBoxDataList(Item item) {
                List<CheckItemData> dataList = new ArrayList<CheckItemData>();
                for (Item subItem : item.getItem()) {
                        dataList.add(new CheckItemData(subItem.getName(), subItem.getTitle()));
@@ -146,7 +154,7 @@ public class ItemListUtil {
 
        }
 
-       private static String getOption(List<Option> options, String optionName) {
+       public static String getOption(List<Option> options, String optionName) {
                String option = null;
                for (Option opt : options) {
                        if (opt.getName().equals(optionName)) {
@@ -156,7 +164,7 @@ public class ItemListUtil {
                return option;
        }
 
-       private static List<RESOLUTION> getResolutionList(Item item) {
+       public static List<RESOLUTION> getResolutionList(Item item) {
                // get sub item(resolution item)
                Item displayItem = getSubItem(item, ItemName.RESOLUTION);
                if (displayItem == null) {
@@ -166,6 +174,9 @@ public class ItemListUtil {
                // get resolution list
                List<RESOLUTION> list = new ArrayList<RESOLUTION>();
                for (Option opt : displayItem.getOption()) {
+                       if (checkExperimentalOption(opt)) {
+                               continue;
+                       }
                        String[] split = opt.getValue().split(","); //$NON-NLS-1$
                        if (split.length == 4) { // name, width, height, dpi
                                RESOLUTION resolution = null;
@@ -188,7 +199,7 @@ public class ItemListUtil {
                return list;
        }
 
-       private static Item getSubItem(Item item, String itemName) {
+       public static Item getSubItem(Item item, String itemName) {
                for (Item subItem : item.getItem()) {
                        if (subItem.getName().equals(itemName)) {
                                return subItem;
@@ -197,4 +208,12 @@ public class ItemListUtil {
                return null;
        }
 
+       public static boolean checkExperimentalOption(Option option) {
+               String attr = option.getAttr();
+               if (attr.equals(OptionName.EXPERIMENTAL) && !EmulatorManager.isInhouseMode() ) {
+                       return true;
+               }
+               return false;
+       }
+
 }
index e817dca..d1e249d 100644 (file)
@@ -42,7 +42,7 @@ import org.eclipse.swt.SWT;
 import org.tizen.emulator.manager.devices.DeviceTemplateValue;
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.resources.FilePathResources;
-import org.tizen.emulator.manager.template.TemplateLoader;
+import org.tizen.emulator.manager.template.renewal.TemplateLoader;
 import org.tizen.emulator.manager.ui.renewal.MainDialog;
 import org.tizen.emulator.manager.ui.renewal.dialog.DIALOG_MODE;
 import org.tizen.emulator.manager.ui.renewal.dialog.DeviceTemplateModifyDialog;
@@ -60,7 +60,7 @@ import org.tizen.emulator.manager.ui.renewal.item.modify.common.SensorItem;
 import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
 import org.tizen.emulator.manager.ui.renewal.item.modify.template.CameraItem;
 import org.tizen.emulator.manager.vms.RESOLUTION;
-import org.tizen.emulator.manager.vms.xml.template2.ItemList2;
+import org.tizen.emulator.manager.vms.xml.template.v2.ItemList;
 
 public class DeviceTemplateDialogHandler {
 
@@ -302,7 +302,7 @@ public class DeviceTemplateDialogHandler {
 
                // 1. use xml in deploy path.
                String filePath = getTemplatePath(profile);
-               ItemList2 itemList2 = loadItemList(new File(filePath));
+               ItemList itemList2 = loadItemList(new File(filePath));
                if (itemList2 == null) {
                        // 2. use default xml. (in source)
                        filePath = getDefaultTemplatePath(profile);
@@ -320,11 +320,11 @@ public class DeviceTemplateDialogHandler {
        }
 
 
-       private static ItemList2 loadItemList(File file) {
+       private static ItemList loadItemList(File file) {
                if (!file.exists()) {
                        return null;
                }
-               return (ItemList2)TemplateLoader.loadTemplate(file, ItemList2.class);
+               return TemplateLoader.loadTemplate(file);
        }
 
 
@@ -362,11 +362,11 @@ public class DeviceTemplateDialogHandler {
 
                itemList.add(new NameItem("name", "Device Name"));
                itemList.add(new ProfileItem());
-               itemList.add(new DisplayItem(new ArrayList<RESOLUTION>()));
-               itemList.add(new RamSizeItem());
-               itemList.add(new ProcessorItem());
-               itemList.add(new SensorItem(new ArrayList<CheckItemData>()));
-               itemList.add(new ConnectivityItem(new ArrayList<CheckItemData>()));
+               itemList.add(new DisplayItem(null, new ArrayList<RESOLUTION>()));
+               itemList.add(new RamSizeItem(null));
+               itemList.add(new ProcessorItem(null));
+               itemList.add(new SensorItem(null, new ArrayList<CheckItemData>()));
+               itemList.add(new ConnectivityItem(null, new ArrayList<CheckItemData>()));
                itemList.add(new CameraItem(new ArrayList<CheckItemData>()));
 
                return itemList;
index 95e61b5..3745d40 100644 (file)
 
 package org.tizen.emulator.manager.ui.renewal.dialoghandler;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.swt.SWT;
+import org.tizen.emulator.manager.platform.BaseImage;
+import org.tizen.emulator.manager.template.renewal.TemplateLoader;
 import org.tizen.emulator.manager.ui.renewal.MainDialog;
 import org.tizen.emulator.manager.ui.renewal.dialog.DIALOG_MODE;
 import org.tizen.emulator.manager.ui.renewal.dialog.VMModifyDialog;
@@ -52,6 +55,7 @@ import org.tizen.emulator.manager.ui.renewal.item.modify.vm.FileSharingItem;
 import org.tizen.emulator.manager.ui.renewal.item.modify.vm.HWSupportItem;
 import org.tizen.emulator.manager.vms.VMProperty;
 import org.tizen.emulator.manager.vms.VMPropertyValue;
+import org.tizen.emulator.manager.vms.xml.template.v2.ItemList;
 
 public class VMModifyHandler {
 
@@ -63,7 +67,6 @@ public class VMModifyHandler {
                VMPropertyValue newValue = property.getPropertyValue().clone();
                dialog.create(newValue, getItemList(property));
 
-               // TODO set display value to dialog
                int retValue = dialog.open();
 
                if (retValue == SWT.OK) {
@@ -74,9 +77,20 @@ public class VMModifyHandler {
        }
 
        private static List<ModifyDialogItem> getItemList(VMProperty property) {
-               // TODO make item list using Image's item-template
-               return getTmpItemList();
+               BaseImage baseImage = property.getPropertyValue().baseImage;
+               if (baseImage == null) {
+                       return getTmpItemList();
+               }
+
+               List<ModifyDialogItem> itemList = new ArrayList<ModifyDialogItem>();
+               if (baseImage.getDefaultItemList() != null) {
+                       itemList.addAll(baseImage.getDefaultItemList());
+               }
+               if (baseImage.getAdvancedItemList() != null) {
+                       itemList.addAll(baseImage.getAdvancedItemList());
+               }
 
+               return itemList;
        }
 
 
@@ -103,5 +117,18 @@ public class VMModifyHandler {
        }
 
 
+       public static ItemList getTmpItemList(String profile) {
+
+               File f = new File("xsd" + File.separator
+                               + "x86-standard-template" + "-" + profile + ".xml");
+               if (!f.exists()) {
+                       f = new File("xsd" + File.separator
+                               + "x86-standard-template.xml");
+               }
+               System.out.println("get temp template xml : " + f.getName());
+
+               return TemplateLoader.loadTemplate(f);
+
+       }
 
 }
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/CommonItemListFactory.java b/src/org/tizen/emulator/manager/ui/renewal/item/CommonItemListFactory.java
new file mode 100644 (file)
index 0000000..88ae9e3
--- /dev/null
@@ -0,0 +1,204 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@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.renewal.item;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.tizen.emulator.manager.EmulatorManager;
+import org.tizen.emulator.manager.resources.StringResources;
+import org.tizen.emulator.manager.ui.detail.item.OptionType;
+import org.tizen.emulator.manager.ui.renewal.dialog.ItemListUtil;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ConnectivityItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.DisplayItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ImageItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.NameItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ProcessorItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ProfileItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.RamSizeItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.SensorItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.TreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.DeviceTemplateItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.FileSharingItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.HWSupportItem;
+import org.tizen.emulator.manager.vms.xml.template.v2.Item;
+import org.tizen.emulator.manager.vms.xml.template.v2.ItemGroup;
+import org.tizen.emulator.manager.vms.xml.template.v2.ItemList;
+import org.tizen.emulator.manager.vms.xml.template.v2.Option;
+
+public class CommonItemListFactory implements IItemListFactory{
+
+       @Override
+       public List<ModifyDialogItem> makeDefaultItemList(ItemList template) {
+               List<ModifyDialogItem> itemList = new ArrayList<ModifyDialogItem>();
+               ItemGroup group = getDefaultItemGroup(template);
+               if (group == null) {
+                       return itemList;
+               }
+
+               addItems(group.getItem(), itemList);
+               return itemList;
+       }
+
+
+       @Override
+       public List<ModifyDialogItem> makeAdvancedItemList(ItemList template) {
+               List<ModifyDialogItem> itemList = new ArrayList<ModifyDialogItem>();
+               ItemGroup group = getAdvancedItemGroup(template);
+               if (group == null) {
+                       return itemList;
+               }
+
+               addItems(group.getItem(), itemList);
+               return itemList;
+       }
+
+       public void addItems(List<Item> items, List<ModifyDialogItem> itemList) {
+               for (Item item : items) {
+                       if (checkExperimental(item)) {
+                               continue;
+                       }
+                       if (!isSupportOS(item)) {
+                               continue;
+                       }
+                       addItem(item, itemList);
+               }
+       }
+
+
+       public ItemGroup getDefaultItemGroup(ItemList template) {
+               for (ItemGroup group : template.getItemGroup()) {
+                       if (group.getName().equals(ItemName.GROUP_DEFAULT)) {
+                               return group;
+                       }
+               }
+               return null;
+       }
+
+       public ItemGroup getAdvancedItemGroup(ItemList template) {
+               for (ItemGroup group : template.getItemGroup()) {
+                       if (group.getName().equals(ItemName.GROUP_ADVANCED)) {
+                               return group;
+                       }
+               }
+               return null;
+       }
+
+
+       /** Subclass in each plugin can should override this
+        *   if they has own item */
+       protected TreeModifyItem treeRoot = null;
+       public void addItem(Item item, List<ModifyDialogItem> itemList) {
+               if (item == null) {
+                       return;
+               }
+
+               String name = item.getName();
+               String title = item.getTitle();
+
+
+               if (name.equals(ItemName.NAME)) {
+                       itemList.add(new NameItem(name, title));
+
+               } else if (name.equals(ItemName.PROFILE)) {
+                       itemList.add(new ProfileItem());
+
+               } else if (name.equals(ItemName.BASE_IMAGE)) {
+                       itemList.add(new ImageItem());
+
+               } else if (name.equals(ItemName.DEVICE_TEMPLATE)) {
+                       DeviceTemplateItem deviceItem = new DeviceTemplateItem();
+                       treeRoot = deviceItem.getTreeRoot();
+                       itemList.add(deviceItem);
+                       // add sub items
+                       addItems(item.getItem(), itemList);
+
+               } else if (name.equals(ItemName.DISPLAY)) {
+                       itemList.add(new DisplayItem(treeRoot, ItemListUtil.getResolutionList(item)));
+
+               } else if (name.equals(ItemName.RAM_SIZE)) {
+                       itemList.add(new RamSizeItem(treeRoot));
+
+               } else if (name.equals(ItemName.PROCESSORS)) {
+                       itemList.add(new ProcessorItem(treeRoot));
+
+               } else if (name.equals(ItemName.SENSOR)) {
+                       itemList.add(new SensorItem(treeRoot, ItemListUtil.getCheckBoxDataList(item)));
+
+               } else if (name.equals(ItemName.CONNECTIVITY)) {
+                       itemList.add(new ConnectivityItem(treeRoot, ItemListUtil.getCheckBoxDataList(item)));
+
+               } else if (name.equals(ItemName.FILE_SHARE)) {
+                       itemList.add(new FileSharingItem());
+
+               } else if (name.equals(ItemName.HW_SUPPORT)) {
+                       itemList.add(new HWSupportItem());
+
+               }
+
+       }
+
+
+       public static boolean checkExperimental(Item item) {
+               boolean isExperimentalItem = false;
+               for (Option opt : item.getOption()) {
+                       if (opt.getName().equals(OptionType.EXPERIMENTAL.getName())) {
+                               if (opt.getValue().equals(OptionType.VALUE_TRUE)) {
+                                       isExperimentalItem = true;
+                               }
+                       }
+               }
+               return isExperimentalItem && !EmulatorManager.isInhouseMode();
+       }
+
+       public static boolean isSupportOS(Item item) {
+               boolean isSupportOS = true;
+               for (Option opt : item.getOption()) {
+                       if (opt.getName().equals(OptionType.SUPPORT_OS.getName())) {
+                               List<String> osList = Arrays.asList(opt.getValue().trim().
+                                               split(StringResources.REG_EXP_SPLIT_COMMA));
+
+                               if (EmulatorManager.isWin() && !osList.contains(OptionType.WIN)) {
+                                       isSupportOS = false;
+                               }
+                               if (EmulatorManager.isLinux() && !osList.contains(OptionType.LINUX)) {
+                                       isSupportOS = false;
+                               }
+                               if (EmulatorManager.isMac() && !osList.contains(OptionType.MAC)) {
+                                       isSupportOS = false;
+                               }
+                       }
+               }
+               return isSupportOS;
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/IItemListFactory.java b/src/org/tizen/emulator/manager/ui/renewal/item/IItemListFactory.java
new file mode 100644 (file)
index 0000000..c5875f6
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@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.renewal.item;
+
+import java.util.List;
+
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
+import org.tizen.emulator.manager.vms.xml.template.v2.ItemList;
+
+public interface IItemListFactory {
+       public List<ModifyDialogItem> makeDefaultItemList(ItemList template);
+       public List<ModifyDialogItem> makeAdvancedItemList(ItemList template);
+}
index ae2ff35..afd4de0 100644 (file)
@@ -31,6 +31,8 @@
 package org.tizen.emulator.manager.ui.renewal.item;
 
 public class ItemName {
+       public static final String GROUP_DEFAULT = "default";
+       public static final String GROUP_ADVANCED = "advanced";
        public static final String NAME = "name"; //$NON-NLS-1$
        public static final String PROFILE = "profile"; //$NON-NLS-1$
        public static final String BASE_IMAGE = "baseImage"; //$NON-NLS-1$
@@ -42,6 +44,7 @@ public class ItemName {
        public static final String FILE_SHARE = "fileShare"; //$NON-NLS-1$
        public static final String HW_SUPPORT = "hwSupport"; //$NON-NLS-1$
        public static final String PROCESSORS = "processors"; //$NON-NLS-1$
+       public static final String DEVICE_TEMPLATE = "deviceTemplate";
 
        public static final String CONNECTIVITY = "connectivity";
        public static final String SENSOR = "sensor"; //$NON-NLS-1$
index 83c6a84..4b69e3d 100644 (file)
@@ -34,5 +34,6 @@ package org.tizen.emulator.manager.ui.renewal.item;
 
 public class OptionName {
        public static final String NUM_COLUMN = "numColumn";
+       public static final String EXPERIMENTAL = "experimental";
 
 }
index 6ee7721..b99e44c 100644 (file)
@@ -64,7 +64,12 @@ public class CheckBoxItem extends ModifyDialogItem {
                super(name, title, ItemType.CHECK_LABEL);
                this.numColumns = numColomn;
                this.dataList = dataList;
-               initSubTreeItem(treeRoot);
+               if (treeRoot == null) {
+                       init();
+
+               } else {
+                       initSubTreeItem(treeRoot);
+               }
        }
 
 
@@ -72,13 +77,6 @@ public class CheckBoxItem extends ModifyDialogItem {
                return dataList;
        }
 
-       public CheckBoxItem(String name, String title, int numColomn,
-                       List<CheckItemData> dataList) {
-               super(name, title, ItemType.CHECK_LABEL);
-               this.numColumns = numColomn;
-               this.dataList = dataList;
-               init();
-       }
 
        private void initSubTreeItem(TreeModifyItem treeRoot) {
                initDataList();
@@ -91,7 +89,7 @@ public class CheckBoxItem extends ModifyDialogItem {
        public ModifyDialogItem cloneItem() {
                List<CheckItemData> dataList = new ArrayList<CheckItemData>();
                dataList.addAll(this.dataList);
-               return new CheckBoxItem(getName(), getTitle(), numColumns, dataList);
+               return new CheckBoxItem(getName(), getTitle(), numColumns, null, dataList);
        }
 
 
index 5004c4b..16c3f5d 100644 (file)
@@ -54,10 +54,6 @@ public class ConnectivityItem extends CheckBoxItem {
                super(NAME, TITLE, NUM_COLUMN, treeRoot, dataList);
        }
 
-       public ConnectivityItem(List<CheckItemData> dataList) {
-               super(NAME, TITLE, NUM_COLUMN, dataList);
-       }
-
 
        @Override
        public void create(Composite parent) {
index 016ed4e..0576f3f 100644 (file)
@@ -81,9 +81,15 @@ public class DisplayItem extends ModifyDialogItem {
        /** constructor for tree sub item */
        public DisplayItem(TreeModifyItem treeRoot, List<RESOLUTION> resList) {
                super(NAME, TITLE);
-               item = new SubTreeModifyItem(this, treeRoot);
-               item.setItemHeight(ROW_HEIGHT * ROW_NUM + ModifyItem.LINE_WIDTH);
-               treeRoot.addSubItem((SubTreeModifyItem)item);
+               if (treeRoot == null) {
+                       item = new ModifyItem();
+                       item.setItemHeight(ROW_HEIGHT * ROW_NUM);
+               } else {
+                       item = new SubTreeModifyItem(this, treeRoot);
+                       item.setItemHeight(ROW_HEIGHT * ROW_NUM + ModifyItem.LINE_WIDTH);
+                       treeRoot.addSubItem((SubTreeModifyItem)item);
+
+               }
 
                resolutionItem = new ResolutionSubItem(this, resList);
                skinItem = new SkinSubItem(this);
@@ -91,22 +97,13 @@ public class DisplayItem extends ModifyDialogItem {
        }
 
 
-       public DisplayItem(List<RESOLUTION> resList) {
-               super(NAME, TITLE);
-               item = new ModifyItem();
-               item.setItemHeight(ROW_HEIGHT * ROW_NUM);
-
-               resolutionItem = new ResolutionSubItem(this, resList);
-               skinItem = new SkinSubItem(this);
-       }
-
        @Override
        public ModifyDialogItem cloneItem() {
                List<RESOLUTION> resList = new ArrayList<RESOLUTION>();
                if (resolutionItem.getResolutionList() != null) {
                        resList.addAll(resolutionItem.getResolutionList());
                }
-               return new DisplayItem(resList);
+               return new DisplayItem(null, resList);
        }
 
 
index daaf7a7..d3e8077 100644 (file)
@@ -62,15 +62,16 @@ public class ProcessorItem extends ComboItem {
        /** constructor for tree sub item */
        public ProcessorItem(TreeModifyItem treeRoot) {
                super(NAME, TITLE);
-               item = new SubTreeModifyItem(this,treeRoot);
-               treeRoot.addSubItem((SubTreeModifyItem)item);
-       }
+               if (treeRoot == null) {
+                       item = new ModifyItem();
 
-       public ProcessorItem() {
-               super(NAME, TITLE);
-               item = new ModifyItem();
+               } else {
+                       item = new SubTreeModifyItem(this,treeRoot);
+                       treeRoot.addSubItem((SubTreeModifyItem)item);
+               }
        }
 
+
        @Override
        public void create(Composite parent) {
                item.init(parent);
@@ -186,7 +187,7 @@ public class ProcessorItem extends ComboItem {
        @Override
        public ModifyDialogItem cloneItem() {
                // TODO ProcessorItem(TreeModifyItem treeRoot) ??
-               return new ProcessorItem();
+               return new ProcessorItem(null);
        }
 
 
index dcc6384..edabbbc 100644 (file)
@@ -60,13 +60,13 @@ public class RamSizeItem extends ComboItem {
        /** constructor for tree sub item */
        public RamSizeItem(TreeModifyItem treeRoot) {
                super(NAME, TITLE);
-               item = new SubTreeModifyItem(this,treeRoot);
-               treeRoot.addSubItem((SubTreeModifyItem)item);
-       }
+               if (treeRoot == null) {
+                       item = new ModifyItem();
 
-       public RamSizeItem() {
-               super(NAME, TITLE);
-               item = new ModifyItem();
+               } else {
+                       item = new SubTreeModifyItem(this,treeRoot);
+                       treeRoot.addSubItem((SubTreeModifyItem)item);
+               }
        }
 
 
@@ -186,7 +186,7 @@ public class RamSizeItem extends ComboItem {
        @Override
        public ModifyDialogItem cloneItem() {
                // TODO RamSizeItem(TreeModifyItem treeRoot) ??
-               return new RamSizeItem();
+               return new RamSizeItem(null);
        }
 
 
index c10440d..dc049e7 100644 (file)
@@ -65,11 +65,6 @@ public class SensorItem extends CheckBoxItem {
        }
 
 
-       public SensorItem(List<CheckItemData> dataList) {
-               super(NAME, TITLE, NUM_COLUMN, dataList);
-       }
-
-
        @Override
        public void create(Composite parent) {
                item.init(parent);
index c16e468..15a6b41 100644 (file)
@@ -52,7 +52,7 @@ public class CameraItem extends CheckBoxItem {
 
 
        public CameraItem(List<CheckItemData> dataList) {
-               super(NAME, TITLE, NUM_COLUMN, dataList);
+               super(NAME, TITLE, NUM_COLUMN, null, dataList);
        }
 
 
index e48e4f4..e2402e8 100644 (file)
@@ -23,7 +23,7 @@
                        <item name="size" title="Size" type="textInput" />
                        <item name="skin" title="Skin" type="combo"/>
                </item>
-               <item name="processors" title="Processorse" type="combo" />
+               <item name="processors" title="Processors" type="combo" />
                <item name="ramSize" title="Ram" type="combo" >
                        <option name="list">512,768,1024</option>
                </item>
similarity index 98%
rename from xsd/em-template2.xsd
rename to xsd/em-template-v2.xsd
index bb6b726..42e6e7f 100644 (file)
@@ -2,7 +2,7 @@
 <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.tizen.org/em/template"
        xmlns:em-template="http://www.tizen.org/em/template" elementFormDefault="qualified">
 
-       <element name="ItemList2">
+       <element name="ItemList">
                <complexType>
                                <sequence>
                                        <element name="information" type="em-template:information" minOccurs="0" maxOccurs="1"/>
diff --git a/xsd/template-ui-mobile.xml b/xsd/template-ui-mobile.xml
deleted file mode 100644 (file)
index 4001635..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-
-<!-- This file describes dialog for device template create/modify -->
-
-<ItemList xmlns="http://www.tizen.org/em/template" version="2.0">
-       <information profile="mobile" />
-
-       <itemGroup name="default">
-               <item name="name" title="Device Name" type="textInput"/>
-               <item name="profile" title="Profile"/>
-               <item name="display" title="Display" type="label">
-                       <item name="resolution" title="Resolution" type="combo">
-                               <!-- name, width, height, dpi -->
-                               <option name="320"> ,320,320,316 </option>
-                               <option name="hvga"> HVGA,320,480,160 </option>
-                               <option name="wvga"> WVGA,480,800,233 </option>
-                               <option name="wsvga"> WSVGA,600,1024,207 </option>
-                               <option name="WSVGA"> WSVGA,600,1024,207 </option>
-                               <option name="qhd"> qHD,540,960,220 </option>
-                               <option name="hd"> HD,720,1280,306 </option>
-                               <option name="WXGA"> WXGA,1280,800,300 </option>
-                               <option name="WQXGA"> WQXGA,2560,1600,301 </option>
-                               <option name="FULLHD"> FULLHD,1080,1920,314 </option>
-                       </item>
-                       <item name="size" title="Size" type="textInput" />
-                       <item name="skin" title="Skin" type="combo"/>
-               </item>
-               <item name="processors" title="Processorse" type="combo" />
-               <item name="ramSize" title="Ram" type="combo" >
-                       <option name="list">512,768,1024</option>
-               </item>
-
-               <item name="sensor" title="Sensor" type="checkLabel" >
-                       <item name="accel" title="Accelerometer" type="checkbox" />
-                       <item name="gyro" title="Gyroscope" type="checkbox" />
-                       <item name="geo" title="Geo-magnetic" type="checkbox" />
-                       <item name="proxi" title="Proximity"  type="checkbox"/>
-                       <item name="light" title="Light" type="checkbox"/>
-                       <item name="haptic" title="Haptic" type="checkbox"/>
-                       <item name="press" title="Pressure" type="checkbox"/>
-                       <item name="uv" title="Ultraviolet" type="checkbox"/>
-                       <item name="hrm" title="Heartbeat Rate" type="checkbox"/>
-                       <item name="test" title="Test"/>
-                       <option name="numColumn">3</option>
-               </item>
-               <item name="connectivity" title="Connectivity" type="checkLabel">
-                       <item name="nfc" title="NFC" type="checkbox" />
-                       <option name="numColumn">3</option>
-               </item>
-               <item name="camera" title="Camera" type="checkLabel">
-                       <item name="rear" title="Rear" type="checkbox" />
-                       <item name="front" title="Front" type="checkbox" />
-                       <option name="numColumn">2</option>
-               </item>
-       </itemGroup>
-
-</ItemList>
-
diff --git a/xsd/x86-standard-template.xml b/xsd/x86-standard-template.xml
new file mode 100644 (file)
index 0000000..dec4ba9
--- /dev/null
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!-- This file describes component of VM property UI in Emulator manager.
+       (VM property UI descriptor)
+       Each element in this file is matched with an item of vm property UI. -->
+
+<ItemList xmlns="http://www.tizen.org/em/template" version="2.0">
+       <information profile="mobile" version="2.4" image="x86-standard"/>
+
+       <itemGroup name="default">
+               <item name="vmName" title="VM Name" type="textInput"/>
+               <item name="profile" title="Profile"/>
+               <item name="baseImage" title="Base Image"/>
+               <item name="deviceTemplate" title="Device" type="treeRoot">
+                       <item type="label" name="display" title="Display">
+                               <item name="resolution" title="Resolution" type="combo" >
+                                       <!-- name, width, height, dpi -->
+                                       <option name="320" attr="experimental"> ,320,320,316 </option>
+                                       <option name="hvga" attr="experimental"> HVGA,320,480,160 </option>
+                                       <option name="wvga"> WVGA,480,800,233 </option>
+                                       <option name="WSVGA" attr="experimental"> WSVGA,600,1024,207 </option>
+                                       <option name="qhd"> qHD,540,960,220 </option>
+                                       <option name="hd"> HD,720,1280,306 </option>
+                                       <option name="WXGA" attr="experimental"> WXGA,1280,800,300 </option>
+                                       <option name="WQXGA" attr="experimental"> WQXGA,2560,1600,301 </option>
+                                       <option name="FULLHD" attr="experimental"> FULLHD,1080,1920,314 </option>
+                               </item>
+                               <item name="size" title="Size" type="textInput" />
+                               <item name="skin" title="Skin" type="combo" />
+                       </item>
+                       <item name="processors" title="Processors" type="combo" />
+                       <item name="ramSize" title="Ram" type="combo" >
+                               <option name="useConfig">false</option>
+                               <option name="list">512,768,1024</option>
+                       </item>
+                       <item name="sensor" title="Sensor" type="checkLabel" >
+                               <item name="accel" title="Accelerometer" type="checkbox" />
+                               <item name="gyro" title="Gyroscope" type="checkbox" />
+                               <item name="geo" title="Geo-magnetic" type="checkbox" />
+                               <item name="proxi" title="Proximity"  type="checkbox"/>
+                               <item name="light" title="Light" type="checkbox"/>
+                               <item name="haptic" title="Haptic" type="checkbox"/>
+                               <item name="press" title="Pressure" type="checkbox"/>
+                               <item name="uv" title="Ultraviolet" type="checkbox"/>
+                               <item name="hrm" title="Heartbeat Rate" type="checkbox"/>
+                               <option name="numColumn">2</option>
+                       </item>
+                       <item name="connectivity" title="Connectivity" type="checkLabel">
+                               <item name="nfc" title="NFC" type="checkbox" />
+                               <option name="numColumn">2</option>
+                       </item>
+                       <item name="camera" title="Camera" type="checkLabel">
+                               <item name="rear" title="Rear" type="checkbox" />
+<!--                           <item name="front" title="Front" type="checkbox" /> -->
+                               <option name="numColumn">2</option>
+                       </item>
+               </item>
+       </itemGroup>
+<!--                   <item type="label" name="camera" title="Camera"> -->
+<!--                   <item type="combo" name="frontType" title="Front"/> -->
+<!--                   <item type="file" name="frontImage" title="(image)"/> -->
+<!--                   <item type="combo" name="rearType" title="Rear"/> -->
+<!--                   <item type="file" name="rearImage" title="(image)"/> -->
+
+
+       <itemGroup name="advanced">
+               <item name="suspendSupport" title="Suspend" type="toggle" >
+                       <option name="experimental">true</option>
+               </item>
+               <item type="combo" name="maxTouch" title="Max Touch Point"/>
+               <item name="fileShare" title="File Sharing" type="file">
+                               <option name="dialogType">directory</option>
+               </item>
+               <item name="network" title="Network" type="label">
+                       <item name="proxy" title="Proxy" type="combo" >
+                               <option name="none">No proxy</option>
+                               <option name="auto">Use host proxy</option>
+                               <option name="manual">Use manual proxy</option>
+                               <option name="defaultOnCreate">auto</option>
+                       </item>
+                       <item name="netConnectType" type="combo" title="Connect Type">
+                               <option name="list">NAT, Bridge</option>
+                       </item>
+                       <item name="netTapDevice" type="combo" title="Base Network">
+                               <option name="supportOS">mac,linux</option>
+                       </item>
+                       <item name="netTapDevice" type="combo" title="Tap Device">
+                               <option name="supportOS">win</option>
+                       </item>
+                       <item name="netIpInfo" title="VM IP info" type="subLabel">
+                               <item name="useDHCP" title="Use DHCP" type="checkbox" >
+                                       <option name="defaultOnCreate">off</option>
+                               </item>
+                               <item name="ipAddr" title="IP Address" type="text" />
+                               <item name="subnet" title="Subnet" type="text"/>
+                               <item name="gateway" title="Gateway" type="text"/>
+                       </item>
+                       <item name="netDns" type="text" title="DNS" />
+                       <item name="netMac" type="text" title="MAC" />
+               </item>
+               <item name="hwSupport" title="HW Support" type="label" >
+                       <item name="cpu" title="CPU VT" type="toggle" />
+                       <item name="gpu" title="GPU" type="toggle" />
+               </item>
+               <item name="glVersion" title="OpenGL ES Ver" type="combo">
+                       <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>
+               </item>
+               <item name="viewer" title="Viewer" type="label" >
+                       <item name="type" title="Type" type="combo">
+                               <option name="list">Native, Web</option>
+                               <option name="experimental">true</option>
+                               <option name="defaultOnCreate">Native</option>
+                       </item>
+               </item>
+       </itemGroup>
+
+</ItemList>
+
diff --git a/xsd/x86-standard-template2.xml b/xsd/x86-standard-template2.xml
deleted file mode 100644 (file)
index 5d1d654..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-
-<!-- This file describes component of VM property UI in Emulator manager.
-       (VM property UI descriptor)
-       Each element in this file is matched with an item of vm property UI. -->
-
-<ItemList xmlns="http://www.tizen.org/em/template" version="2.0">
-       <information profile="mobile" version="2.4" image="x86-standard"/>
-
-       <itemGroup name="default">
-               <item type="text" name="vmName" title="Name"/>
-               <item type="file" name="baseImage" title="Base Image">
-                       <option name="dialogType">file</option>
-               </item>
-               <item type="label" name="display" title="Display">
-                       <item type="combo" name="resolution" title="Resolution">
-                               <!-- name, width, height, dpi -->
-                               <option name="320" attr="experimental"> ,320,320,316 </option>
-                               <option name="hvga" attr="experimental"> HVGA,320,480,160 </option>
-                               <option name="wvga"> WVGA,480,800,233 </option>
-                               <option name="wsvga"> WSVGA,600,1024,207 </option>
-                               <option name="WSVGA" attr="experimental"> WSVGA,600,1024,207 </option>
-                               <option name="qhd"> qHD,540,960,220 </option>
-                               <option name="hd"> HD,720,1280,306 </option>
-                               <option name="WXGA" attr="experimental"> WXGA,1280,800,300 </option>
-                               <option name="WQXGA" attr="experimental"> WQXGA,2560,1600,301 </option>
-                               <option name="FULLHD" attr="experimental"> FULLHD,1080,1920,314 </option>
-                       </item>
-                       <item type="spinner" name="dpi" title="Density"/>
-                       <item type="combo" name="skin" title="Skin"/>
-               </item>
-               <item type="combo" name="processors" title="Processors" />
-               <item type="combo" name="ramSize" title="RAM Size">
-                       <option name="list">512,768,1024</option>
-               </item>
-               <item type="toggle" name="suspendSupport" title="Suspend">
-                       <option name="experimental">true</option>
-               </item>
-<!--           <item type="combo" name="maxTouch" title="Max Touch Point"/> -->
-               <item type="label" name="fileShare" title="File Sharing">
-                       <item type="toggle" name="share" title="Sharing"/>
-                       <item type="file" name="directory" title="Directory">
-                               <option name="dialogType">directory</option>
-                       </item>
-               </item>
-               <item type="label" name="hwSupport" title="HW Support">
-                       <item type="toggle" name="cpu" title="CPU VT"/>
-                       <item type="toggle" name="gpu" title="GPU"/>
-               </item>
-               <item type="combo" name="glVersion" title="OpenGL ES Ver">
-                       <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>
-               </item>
-
-               <item name="kernel" type="hidden"/>
-               <item name="default" type="hidden"/>
-               <item name="remote" type="hidden"/>
-               <item name="maxTouch" type="hidden"/>
-               <item name="power" type="hidden"/>
-       </itemGroup>
-
-<!-- Followings are drawn as check box in Emulator Manager vm property UI.-->
-       <itemGroup name="advanced">
-               <item type="lineLabel" name="advancedOption" title="Advanced Option"/>
-               <item type="label" name="camera" title="Camera">
-<!--                   <item type="combo" name="frontType" title="Front"/> -->
-<!--                   <item type="file" name="frontImage" title="(image)"/> -->
-                       <item type="combo" name="rearType" title="Rear"/>
-                       <item type="file" name="rearImage" title="(image)"/>
-               </item>
-               <item type="checkLabel" name="sensor" title="Sensor">
-                       <item type="checkbox" name="accel" title="Accelerometer"/>
-                       <item type="checkbox" name="gyro" title="Gyroscope"/>
-                       <item type="checkbox" name="geo" title="Geo-magnetic"/>
-                       <item type="checkbox" name="proxi" title="Proximity"/>
-                       <item type="checkbox" name="light" title="Light"/>
-                       <item type="checkbox" name="haptic" title="Haptic"/>
-                       <item type="checkbox" name="press" title="Pressure"/>
-                       <item type="checkbox" name="uv" title="Ultraviolet"/>
-                       <item type="checkbox" name="hrm" title="Heartbeat Rate"/>
-               </item>
-               <item type="checkLabel" name="device" title="Device">
-                       <item type="checkbox" name="nfc" title="NFC"/>
-               </item>
-
-               <!-- Network configuration -->
-               <item name="netConfig" type="lineLabel" title="Network Configuration">
-                       <option name="spreadOnStart">false</option>
-               </item>
-               <item name="proxy" type="combo" title="Proxy">
-                       <option name="none">No proxy</option>
-                       <option name="auto">Use host proxy</option>
-                       <option name="manual">Use manual proxy</option>
-                       <option name="defaultOnCreate">auto</option>
-               </item>
-               <item name="netConnectType" type="combo" title="Connect Type">
-                       <option name="list">NAT, Bridge</option>
-               </item>
-               <item name="netTapDevice" type="combo" title="Base Network">
-                       <option name="supportOS">mac,linux</option>
-               </item>
-               <item name="netTapDevice" type="combo" title="Tap Device">
-                       <option name="supportOS">win</option>
-               </item>
-               <item name="netIpInfo" type="label" title="VM IP info">
-                       <item name="useDHCP" type="checkbox" title="Use DHCP">
-                               <option name="defaultOnCreate">off</option>
-                       </item>
-                       <item name="ipAddr" type="text" title="IP Address" />
-                       <item name="subnet" type="text" title="Subnet" />
-                       <item name="gateway" type="text" title="Gateway" />
-               </item>
-               <item name="netDns" type="text" title="DNS" />
-               <item name="netMac" type="text" title="MAC" />
-
-               <item type="lineLabel" name="experimental" title="Experimental Options"/>
-               <item type="label" name="viewer" title="Viewer">
-                       <item type="combo" name="type" title="Type">
-                               <option name="list">Native, Web</option>
-                               <option name="defaultOnCreate">Native</option>
-                       </item>
-               </item>
-       </itemGroup>
-
-</ItemList>
-