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
}
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) {
public void setResolution(RESOLUTION resolution) {
this.resolution = resolution;
+ displayWidth = resolution.getResolution().getWidth();
+ displayHeight = resolution.getResolution().getHeight();
+ displayDPI = calculatorDPI();
}
public int getDisplayWidth() {
public void setDisplayWidth(int displayWidth) {
this.displayWidth = displayWidth;
+ displayDPI = calculatorDPI();
}
public int getDisplayHeight() {
public void setDisplayHeight(int displayHeight) {
this.displayHeight = displayHeight;
+ displayDPI = calculatorDPI();
}
public double getDisplaySize() {
public void setDisplaySize(double displaySize) {
this.displaySize = displaySize;
+ displayDPI = calculatorDPI();
}
public String getDisplaySizeUnit() {