From 9799c78f1a51b9aec73842d47506e21124ee09df Mon Sep 17 00:00:00 2001 From: "jihye424.kim" Date: Fri, 6 Nov 2015 22:20:58 +0900 Subject: [PATCH] dialog: check default device template is null or not - change default device tempalte name -- mobile(x) -> mobile-x Change-Id: I77272c921be5ee62fb865f5572c3ba7d90c29a27 Signed-off-by: jihye424.kim --- .../renewal/dialog/DeviceTemplateModifyDialog.java | 9 +++--- .../ui/renewal/item/modify/common/NameItem.java | 33 +++++++++++----------- .../emulator/manager/vms/helper/HelperClass.java | 4 +-- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/org/tizen/emulator/manager/ui/renewal/dialog/DeviceTemplateModifyDialog.java b/src/org/tizen/emulator/manager/ui/renewal/dialog/DeviceTemplateModifyDialog.java index b67f978..e5e0173 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/dialog/DeviceTemplateModifyDialog.java +++ b/src/org/tizen/emulator/manager/ui/renewal/dialog/DeviceTemplateModifyDialog.java @@ -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); diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/NameItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/NameItem.java index 1949c06..47d7b06 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/NameItem.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/common/NameItem.java @@ -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(); } } } diff --git a/src/org/tizen/emulator/manager/vms/helper/HelperClass.java b/src/org/tizen/emulator/manager/vms/helper/HelperClass.java index e490d1c..31d6374 100644 --- a/src/org/tizen/emulator/manager/vms/helper/HelperClass.java +++ b/src/org/tizen/emulator/manager/vms/helper/HelperClass.java @@ -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; -- 2.7.4