// base information
conf.getBaseInformation().setName(value.getName());
- conf.getBaseInformation().setType(value.getType());
+ conf.getBaseInformation().setType(value.getType().toString());
conf.getBaseInformation().setProfile(value.getProfile());
if (value.getExtenstion() != null && !value.getExtenstion().isEmpty()) {
conf.getBaseInformation().setExtension(value.getExtenstion());
}
conf.getBaseInformation().setVersion(value.getVersion());
- conf.getBaseInformation().setPriority(value.getPriority());
+ conf.getBaseInformation().setPriority(value.getPriority().getValue());
if (value.getManufacturer() != null && !value.getManufacturer().isEmpty()) {
conf.getBaseInformation().setManufacturer(value.getManufacturer());
}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.p@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+
+package org.tizen.emulator.manager.devices;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class DeviceTemplatePriority implements Comparable<Object> {
+ public static DeviceTemplatePriority DEFAULT =
+ new DeviceTemplatePriority(0);
+ public static DeviceTemplatePriority STANDARD =
+ new DeviceTemplatePriority(1);
+ public static DeviceTemplatePriority CUSTOM =
+ new DeviceTemplatePriority(3);
+
+ private static List<DeviceTemplatePriority> priorityList =
+ new ArrayList<DeviceTemplatePriority>();
+ static {
+ priorityList.add(DEFAULT);
+ priorityList.add(STANDARD);
+ priorityList.add(CUSTOM);
+ }
+
+ public static void addPriority(DeviceTemplatePriority priority) {
+ if (priority == null) {
+ return;
+ }
+
+ for (DeviceTemplatePriority p : priorityList) {
+ if (p.getValue() == priority.getValue()) {
+ return;
+ }
+ }
+
+ priorityList.add(priority);
+ }
+
+ public static DeviceTemplatePriority findPriority(int priority) {
+ for (DeviceTemplatePriority p : priorityList) {
+ if (p.getValue() == priority) {
+ return p;
+ }
+ }
+ return null;
+ }
+
+ private int priority = 0;
+ public DeviceTemplatePriority(int priority) {
+ this.priority = priority;
+ }
+
+ public int getValue() {
+ return priority;
+ }
+
+ public void setValue(int priority) {
+ this.priority = priority;
+ }
+
+ @Override
+ public int compareTo(Object o) {
+ int targetPriority = ((DeviceTemplatePriority)o).priority;
+
+ return priority > targetPriority ? -1 : 1;
+ }
+
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.p@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+
+package org.tizen.emulator.manager.devices;
+
+public class DeviceTemplateType {
+ public static DeviceTemplateType STANDARD =
+ new DeviceTemplateType("standard");
+ public static DeviceTemplateType CUSTOM =
+ new DeviceTemplateType("custom");
+
+ private String type = "";
+
+ public DeviceTemplateType(String type) {
+ this.setType(type);
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return type;
+ }
+}
private DeviceTemplate template;
private boolean isStandard = false;
private String name = "";
- private String type = "custom";
+ private DeviceTemplateType type = DeviceTemplateType.CUSTOM;
private String profile = "";
private String extenstion = "";
// standard = 1, custom = 3 (1 > 3)
- private int priority = 3;
+ //private int priority = 3;
+ private DeviceTemplatePriority priority = DeviceTemplatePriority.CUSTOM;
private double version = 1.0;
private String manufacturer = "";
if (conf.getBaseInformation() != null) {
name = conf.getBaseInformation().getName();
- type = conf.getBaseInformation().getType();
- if (type.equals("standard")) {
- isStandard = true;
- }
+ String type = conf.getBaseInformation().getType();
+ setType(type);
+
profile = conf.getBaseInformation().getProfile();
extenstion = conf.getBaseInformation().getExtension();
- priority = conf.getBaseInformation().getPriority();
+ int p = conf.getBaseInformation().getPriority();
+ priority = DeviceTemplatePriority.findPriority(p);
+ if (priority == null) {
+ priority = DeviceTemplatePriority.CUSTOM;
+ }
+
version = conf.getBaseInformation().getVersion();
manufacturer = conf.getBaseInformation().getManufacturer();
}
this.name = name;
}
- public String getType() {
+ public DeviceTemplateType getType() {
return type;
}
public void setType(String type) {
+ if (type.equals(DeviceTemplateType.STANDARD.getType())) {
+ this.type = DeviceTemplateType.STANDARD;
+ isStandard = true;
+ } else {
+ this.type = DeviceTemplateType.CUSTOM;
+ isStandard = false;
+ }
+ }
+
+ public void setType(DeviceTemplateType type) {
this.type = type;
- if (type.equals("standard")) {
+ if (type == DeviceTemplateType.STANDARD) {
isStandard = true;
} else {
isStandard = false;
this.profile = profile;
}
- public int getPriority() {
+ public DeviceTemplatePriority getPriority() {
return priority;
}
- public void setPriority(int priority) {
+ public void setPriority(DeviceTemplatePriority priority) {
this.priority = priority;
}
import org.tizen.emulator.manager.devices.DeviceTemplate;
import org.tizen.emulator.manager.devices.DeviceTemplateList;
+import org.tizen.emulator.manager.devices.DeviceTemplatePriority;
import org.tizen.emulator.manager.resources.FilePathResources;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.vms.EmulatorVMList;
for (int i = 0; i < templateList.size(); i++) {
pairs[i] = new TemplatePair(templateList.get(i));
// setting default template
- if (templateList.get(i).getValue().getPriority() == 0) {
+ if (templateList.get(i).getValue().getPriority() ==
+ DeviceTemplatePriority.DEFAULT) {
defaultTemplate = templateList.get(i);
}
}
import org.eclipse.swt.widgets.Shell;
import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.devices.DeviceTemplate;
+import org.tizen.emulator.manager.devices.DeviceTemplatePriority;
+import org.tizen.emulator.manager.devices.DeviceTemplateType;
import org.tizen.emulator.manager.devices.DeviceTemplateValue;
import org.tizen.emulator.manager.devices.DeviceWorkerException;
import org.tizen.emulator.manager.logging.EMLogger;
if (newValue == null) {
return;
} else {
- newValue.setType("custom");
+ newValue.setType(DeviceTemplateType.CUSTOM);
+ newValue.setPriority(DeviceTemplatePriority.CUSTOM);
}
ProfileButton pButton = null;