device-template: install dialog XML files.
authorminkee.lee <minkee.lee@samsung.com>
Mon, 19 Oct 2015 05:59:48 +0000 (14:59 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Mon, 19 Oct 2015 06:38:24 +0000 (15:38 +0900)
- install dialog XML files to "tools/emulator/data"

Change-Id: I0fbaf1197c2ca065fe84ead3d64608739f5313f4
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
package/build.common [new file with mode: 0755]
package/build.linux
package/build.macos-64
package/build.windows
src/org/tizen/emulator/manager/resources/FilePathResources.java
src/org/tizen/emulator/manager/ui/renewal/dialoghandler/DeviceTemplateDialogHandler.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/DisplayItem.java
xsd/devicetemplate-dialog-mobile.xml [moved from xsd/devicetemplate-ui-mobile.xml with 100% similarity]
xsd/devicetemplate-dialog-tv.xml [moved from xsd/devicetemplate-ui-tv.xml with 100% similarity]
xsd/devicetemplate-dialog-wearable.xml [moved from xsd/devicetemplate-ui-wearable.xml with 97% similarity]

diff --git a/package/build.common b/package/build.common
new file mode 100755 (executable)
index 0000000..8eebf31
--- /dev/null
@@ -0,0 +1,8 @@
+copy_devicetemplate_ui_xml()
+{
+       echo "copy device-template dialog xml files"
+       mkdir -p "$BIN_DIR/data"
+       cp "$SRCDIR/data/devicetemplate-ui-mobile.xml" "$BINDIR/data"
+       cp "$SRCDIR/data/devicetemplate-ui-wearable.xml" "$BINDIR/data"
+       cp "$SRCDIR/data/devicetemplate-ui-mobile.xml" "$BINDIR/data"
+}
index 923f0ff..b1dc6c7 100755 (executable)
@@ -28,6 +28,9 @@ install()
        cp "$SRCDIR/supplement/emulator-manager.sh" "$BIN_DIR/bin/emulator-manager"
        cp "$SRCDIR/supplement/em-cli.sh" "$BIN_DIR/bin/em-cli"
        cp "$SRCDIR/resource/res/em.ico" "$BIN_DIR/icons"
+
+       . "$SRCDIR/packages/build.common"
+       copy_devicetemplate_ui_xml
 }
 
 [ "$1" = "clean" ] && clean
index 78648b0..19813a7 100755 (executable)
@@ -51,6 +51,9 @@ install()
         fi
 
        mv "$SRCDIR/emulator-manager.app" "$BIN_DIR/bin"
+
+       . "$SRCDIR/packages/build.common"
+       copy_devicetemplate_ui_xml
 }
 
 [ "$1" = "clean" ] && clean
index 0a395b0..abfe125 100755 (executable)
@@ -84,6 +84,10 @@ install()
        cp "$MSYS_SRCDIR/emulator-manager.exe" "$BIN_DIR/bin/emulator-manager.exe"
        cp "$MSYS_SRCDIR/supplement/em-cli.bat" "$BIN_DIR/bin/em-cli.bat"
        cp "$MSYS_SRCDIR/resource/res/em.ico" "$BIN_DIR/icons"
+
+       SRCDIR=$MSYS_SRCDIR
+       . "$SRCDIR/packages/build.common"
+       copy_devicetemplate_ui_xml
 }
 
 [ "$1" = "clean" ] && clean
index 6b88412..ffb275f 100644 (file)
@@ -104,6 +104,7 @@ public class FilePathResources {
        private static String toolEmulatorEtcPath;
        private static String toolEmulatorRemotePath;
        private static String toolEmulatorDevicePath;
+       private static String toolEmulatorDataPath;
 
        // Platform
        private static String platformSkinsPath;
@@ -193,6 +194,7 @@ public class FilePathResources {
                toolEmulatorEtcPath = toolEmulatorPath + etc_suffix;
                toolEmulatorRemotePath = toolEmulatorPath + remote_suffix;
                toolEmulatorDevicePath = toolEmulatorPath + device_suffix;
+               toolEmulatorDataPath = toolEmulatorPath + data_suffix;
 
                sdkDataSdcardPath = toolEmulatorPath + storages_suffix + sdcard_suffix;
                sdkDataSwapPath = toolEmulatorPath + storages_suffix + swap_suffix;
@@ -367,6 +369,10 @@ public class FilePathResources {
                return toolEmulatorDevicePath;
        }
 
+       public static String getToolEmulatorDataPath() {
+               return toolEmulatorDataPath;
+       }
+
        // emulator common check tool
        public static String getEmulatorCheckToolPath() {
                return getToolEmulatorBinPath();
index 5348b96..5aaae86 100644 (file)
@@ -41,6 +41,7 @@ import java.util.Map;
 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.ui.renewal.MainDialog;
 import org.tizen.emulator.manager.ui.renewal.dialog.DIALOG_MODE;
@@ -67,6 +68,13 @@ public class DeviceTemplateDialogHandler {
        public static final String TITLE_DETAIL = "Detail Information";
        public static Map<String, List<ModifyDialogItem>> itemListMap;
 
+       private static final String DIALOG_XML_FILE_PREFIX = "devicetemplate-dialog-";
+       public static final String DIALOG_XML_FILE_MOBILE = DIALOG_XML_FILE_PREFIX + "mobile.xml";
+       public static final String DIALOG_XML_FILE_WEABLE = DIALOG_XML_FILE_PREFIX + "wearable.xml";
+       public static final String DIALOG_XML_FILE_TV = DIALOG_XML_FILE_PREFIX + "tv.xml";
+
+
+
        public static void detail(DeviceTemplateValue value) {
                if (value == null) {
                        return;
@@ -290,21 +298,22 @@ public class DeviceTemplateDialogHandler {
 
        private static List<ModifyDialogItem> loadItemList(String profile) {
 
-               // 1. use real xml.
+               // 1. use xml in deploy path.
                String filePath = getTemplatePath(profile);
                ItemList2 itemList2 = loadItemList(new File(filePath));
-               if (itemList2 != null) {
-                       return ItemListUtil.getDeviceTemplateItemList(itemList2);
+               if (itemList2 == null) {
+                       // 2. use default xml. (in source)
+                       filePath = getDefaultTemplatePath(profile);
+                       itemList2 = loadItemList(new File(filePath));
                }
 
-               // 2. use default xml. (in source)
-               filePath = getDefaultTemplatePath(profile);
-               itemList2 = loadItemList(new File(filePath));
                if (itemList2 != null) {
+                       EMLogger.getLogger().info("Device-template dialog file loaded : " + filePath);
                        return ItemListUtil.getDeviceTemplateItemList(itemList2);
                }
 
                // 3. return default item list.
+               EMLogger.getLogger().info("Load Default device-template item-list : " + profile);
                return getDefaultItemList();
        }
 
@@ -318,25 +327,33 @@ public class DeviceTemplateDialogHandler {
 
 
        private static String getTemplatePath(String profile) {
-               // TODO return real xml path.
-               return "";
+               return FilePathResources.getToolEmulatorDataPath() + File.separator
+                               + getTemplateFileName(profile);
        }
 
 
        private static String getDefaultTemplatePath(String profile) {
-               //
-               String filePath = "";
+               return "xsd" + File.separator
+                               + getTemplateFileName(profile);
+
+       }
+
+
+       private static String getTemplateFileName(String profile) {
+               String fileName = "";
                if (profile.equals("tv")) {
-                       filePath = "xsd" + File.separator + "devicetemplate-ui-tv.xml";
+                       fileName += DIALOG_XML_FILE_TV;
 
                } else if (profile.equals("wearable")) {
-                       filePath = "xsd" + File.separator + "devicetemplate-ui-wearable.xml";
+                       fileName += DIALOG_XML_FILE_WEABLE;
 
                } else {
-                       filePath = "xsd" + File.separator + "devicetemplate-ui-mobile.xml";
+                       fileName += DIALOG_XML_FILE_MOBILE;
                }
-               return filePath;
+               return fileName;
        }
+
+
        // default.
        public static List<ModifyDialogItem> getDefaultItemList() {
                List<ModifyDialogItem> itemList = new ArrayList<ModifyDialogItem>();
index 6f36d7b..fa3122f 100644 (file)
@@ -88,7 +88,9 @@ public class DisplayItem extends ModifyDialogItem {
        @Override
        public ModifyDialogItem cloneItem() {
                List<RESOLUTION> resList = new ArrayList<RESOLUTION>();
-               resList.addAll(this.resList);
+               if (this.resList != null) {
+                       resList.addAll(this.resList);
+               }
                return new DisplayItem(resList);
        }
 
similarity index 97%
rename from xsd/devicetemplate-ui-wearable.xml
rename to xsd/devicetemplate-dialog-wearable.xml
index 8afce0e..c19f5ec 100644 (file)
@@ -48,7 +48,7 @@
                        <option name="numColumn">3</option>
                </item>
                <item name="camera" title="Camera" type="checkLabel">
-<!--                   <item name="rear" title="Rear" type="checkbox" /> -->
+                       <item name="rear" title="Rear" type="checkbox" />
                        <item name="front" title="Front" type="checkbox" />
                        <option name="numColumn">2</option>
                </item>