dialog: check default device template is null or not
authorjihye424.kim <jihye424.kim@samsung.com>
Fri, 6 Nov 2015 13:20:58 +0000 (22:20 +0900)
committerjihye424.kim <jihye424.kim@samsung.com>
Fri, 6 Nov 2015 13:20:58 +0000 (22:20 +0900)
- change default device tempalte name
-- mobile(x) -> mobile-x

Change-Id: I77272c921be5ee62fb865f5572c3ba7d90c29a27
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
src/org/tizen/emulator/manager/ui/renewal/dialog/DeviceTemplateModifyDialog.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/common/NameItem.java
src/org/tizen/emulator/manager/vms/helper/HelperClass.java

index b67f978..e5e0173 100644 (file)
@@ -69,17 +69,16 @@ public class DeviceTemplateModifyDialog extends ModifyDialog {
 
        }
 
-
        @Override
        public void changeItemList(String profile) {
 
                Profile prop = ProfileList.getProfile(profile);
                System.out.println("profile: " + prop);
-               if (prop != null) {
+               if (prop != null && prop.getDefaultTemplate() != null) {
                        propertyValue = new PropertyValue(prop.getDefaultTemplate().getValue());
-                       for (ModifyDialogItem item : itemList) {
-                               item.setInitialValue(propertyValue);
-                       }
+               }
+               for (ModifyDialogItem item : itemList) {
+                       item.setInitialValue(propertyValue);
                }
                DeviceTemplateDialogHandler.changeItemList(itemList, profile);
 
index 1949c06..47d7b06 100644 (file)
@@ -38,6 +38,7 @@ import org.tizen.emulator.manager.platform.BaseImage;
 import org.tizen.emulator.manager.renewal.resources.ImageResources;
 import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.ui.Messages;
+import org.tizen.emulator.manager.ui.renewal.dialog.DIALOG_MODE;
 import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
 import org.tizen.emulator.manager.vms.VMProperty;
 import org.tizen.emulator.manager.vms.helper.HelperClass;
@@ -103,7 +104,8 @@ public class NameItem extends TextInputBoxItem {
 //             }
 
                boolean isValid = true;
-               if (getDialog().isModifyMode()) {
+               if (getDialog().getDialogMode() == DIALOG_MODE.MODIFY
+                               || getDialog().getDialogMode() == DIALOG_MODE.DETAIL) {
                        return true;
                }
 
@@ -206,23 +208,22 @@ public class NameItem extends TextInputBoxItem {
 
        @Override
        public void changeItemValue(PropertyValue property) {
-               if (!property.isBaseImageValue()) {
-                       return;
-               }
-               if (value != null && !value.isEmpty()) {
-                       return;
-               }
+               if (property.isBaseImageValue()) {
+                       if (value != null && !value.isEmpty()) {
+                               return;
+                       }
 
-               String path = property.getImageFilePath();
-               if (path != null && !path.isEmpty()) {
-                       String fileName = path.substring(path
-                                       .lastIndexOf(File.separator) + 1, path.length());
-                       if (fileName.contains(".")) {
-                               fileName = fileName.substring(0, fileName.lastIndexOf("."));
+                       String path = property.getImageFilePath();
+                       if (path != null && !path.isEmpty()) {
+                               String fileName = path.substring(path
+                                               .lastIndexOf(File.separator) + 1, path.length());
+                               if (fileName.contains(".")) {
+                                       fileName = fileName.substring(0, fileName.lastIndexOf("."));
+                               }
+                               value = fileName;
+                               textInputBox.setText(value);
+                               textModified();
                        }
-                       value = fileName;
-                       textInputBox.setText(value);
-                       textModified();
                }
        }
 }
index e490d1c..31d6374 100644 (file)
@@ -343,12 +343,12 @@ public class HelperClass {
        // ex) "mobile(1)"
        public static String getDefaultTemplateName(DeviceTemplateValue value) {
                String prefix = value.getProfile();
-               prefix += "(";
+               prefix += "-";
 
                String newName;
                int count=1;
                do {
-                       newName = prefix + Integer.toString(count++) + ")";
+                       newName = prefix + Integer.toString(count++);
                } while (checkDuplicateTemplateName(newName) != null);
 
                return newName;