From: jihye424.kim Date: Thu, 15 Oct 2015 07:15:51 +0000 (+0900) Subject: Device Template: setting device template value using new device configuration X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=05b665981c21860bccf6fbab36dfbf23e99f76c0;p=sdk%2Femulator%2Femulator-manager.git Device Template: setting device template value using new device configuration - add setting DPI value routine when calling setting display value function Change-Id: I2e14a0c80326840d865f255e6aa9931bff9a5b0b Signed-off-by: jihye424.kim --- diff --git a/src/org/tizen/emulator/manager/devices/DeviceTemplate.java b/src/org/tizen/emulator/manager/devices/DeviceTemplate.java index fc284dc..a9e20a9 100644 --- a/src/org/tizen/emulator/manager/devices/DeviceTemplate.java +++ b/src/org/tizen/emulator/manager/devices/DeviceTemplate.java @@ -128,18 +128,12 @@ public class DeviceTemplate { return; } - DeviceConfiguration newConf = settingConfiguration(newValue); - if (newConf != null) { - if (DeviceTemplateList.saveDeviceConfiguration(newConf, templateFile)) { - this.conf = newConf; - this.value = newValue; - } else { - throw new DeviceWorkerException("Failed to modfiy device template" - + StringResources.NEW_LINE - + "Check emulator manager log file: " - + StringResources.NEW_LINE - + FilePathResources.getTizenVmsPath()); - } + if (!saveDeviceConfiguration(newValue)) { + throw new DeviceWorkerException("Failed to modfiy device template" + + StringResources.NEW_LINE + + "Check emulator manager log file: " + + StringResources.NEW_LINE + + FilePathResources.getTizenVmsPath()); } // lock.release } @@ -150,29 +144,41 @@ public class DeviceTemplate { return; } + if (saveDeviceConfiguration(newValue)) { + // TODO + Profile profile = ProfileList.getProfile(value.getProfile()); + profile.addDeviceTemplate(this); + } else { + throw new DeviceWorkerException("Failed to create device template" + + StringResources.NEW_LINE + + "Check emulator manager log file: " + + StringResources.NEW_LINE + + FilePathResources.getTizenVmsPath()); + } + // lock.release + } + + private boolean saveDeviceConfiguration(DeviceTemplateValue newValue) { DeviceConfiguration newConf = settingConfiguration(newValue); - if (newConf != null) { - if (templateFile == null) { - String filePath = FilePathResources.getTizenSdkDataDevicePath() - + File.separator + newValue.getName() + ".xml"; - templateFile = new File(filePath); - } + if (newConf == null) { + return false; + } - if (DeviceTemplateList.saveDeviceConfiguration(newConf, templateFile)) { - this.conf = newConf; - this.value = newValue; - // TODO - Profile profile = ProfileList.getProfile(value.getProfile()); - profile.addDeviceTemplate(this); - } else { - throw new DeviceWorkerException("Failed to create device template" - + StringResources.NEW_LINE - + "Check emulator manager log file: " - + StringResources.NEW_LINE - + FilePathResources.getTizenVmsPath()); - } + if (templateFile == null) { + String filePath = FilePathResources.getTizenSdkDataDevicePath() + + File.separator + newValue.getName() + ".xml"; + templateFile = new File(filePath); + } + + if (DeviceTemplateList.saveDeviceConfiguration(newConf, templateFile)) { + conf = newConf; + value = newValue; + value.settingConfigure(this); + lastModified = templateFile.lastModified(); + return true; + } else { + return false; } - // lock.release } private DeviceConfiguration settingConfiguration(DeviceTemplateValue value) { diff --git a/src/org/tizen/emulator/manager/devices/DeviceTemplateValue.java b/src/org/tizen/emulator/manager/devices/DeviceTemplateValue.java index 4656178..0fd1b01 100644 --- a/src/org/tizen/emulator/manager/devices/DeviceTemplateValue.java +++ b/src/org/tizen/emulator/manager/devices/DeviceTemplateValue.java @@ -301,6 +301,9 @@ public class DeviceTemplateValue implements Cloneable { public void setResolution(RESOLUTION resolution) { this.resolution = resolution; + displayWidth = resolution.getResolution().getWidth(); + displayHeight = resolution.getResolution().getHeight(); + displayDPI = calculatorDPI(); } public int getDisplayWidth() { @@ -309,6 +312,7 @@ public class DeviceTemplateValue implements Cloneable { public void setDisplayWidth(int displayWidth) { this.displayWidth = displayWidth; + displayDPI = calculatorDPI(); } public int getDisplayHeight() { @@ -317,6 +321,7 @@ public class DeviceTemplateValue implements Cloneable { public void setDisplayHeight(int displayHeight) { this.displayHeight = displayHeight; + displayDPI = calculatorDPI(); } public double getDisplaySize() { @@ -325,6 +330,7 @@ public class DeviceTemplateValue implements Cloneable { public void setDisplaySize(double displaySize) { this.displaySize = displaySize; + displayDPI = calculatorDPI(); } public String getDisplaySizeUnit() {