Skin (info.ini) is changed to define multiple skin shape.
So, emulator-manager should support it.
Change-Id: If55b12e52c506fd85ee502cc22f651f8a72b4bf2
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
} else {
value.setSkinPath(skinPath);
value.setSkinName(skinName);
- value.setSkinShape(skinShape);
}
+ value.setSkinShape(skinShape);
}
}
if (skin != null) {
sb.append("skin: " + skin.getName() + StringResources.NEW_LINE);
}
+ sb.append("skin shape : " + skinShape.toString() + StringResources.NEW_LINE);
sb.append("size : " + displaySize + StringResources.NEW_LINE);
sb.append("ram : " + ramSize + StringResources.NEW_LINE);
sb.append("processor : " + cpuCount + StringResources.NEW_LINE);
this.skin = skin;
skinName = skin.getName();
skinPath = skin.getPath();
- skinShape = skin.getSkinShape();
}
public void setSkinByManager(Skin skin) {
return false;
}
+ if (skinShape != dest.skinShape) {
+ return false;
+ }
+
// TODO need to check rest variables ?
if (!isAdditionalDeviceEquals(dest.getAdditionalDevices())) {
import org.tizen.emulator.manager.logging.EMLogger;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.vms.RESOLUTION;
-import org.tizen.emulator.manager.vms.SKIN_SHAPE;
import org.tizen.emulator.manager.vms.SKIN_TYPE;
+import org.tizen.emulator.manager.vms.SkinShapeList;
public class Skin {
private String name;
// private SKIN_BUTTON_TYPE buttonType;
private int priorty = 5;
private String profile;
- private SKIN_SHAPE skinShape;
+ private SkinShapeList skinShapeList;
public Skin(File path) throws IOException {
loadProperty(path);
String height = prop.getProperty(StringResources.SKIN_HEIGHT);
priorty = Integer.valueOf(prop.getProperty(StringResources.SKIN_PRIORITY, "5")); //$NON-NLS-1$
profile = prop.getProperty(StringResources.SKIN_PROFILE, StringResources.SKIN_GENERAL);
- skinShape = SKIN_SHAPE.find(prop.getProperty(StringResources.SKIN_SHAPE, "square")); //$NON-NLS-1$
+ skinShapeList = SkinShapeList.create(prop.getProperty(StringResources.SKIN_SHAPE, "square")); //$NON-NLS-1$
String re = ""; //$NON-NLS-1$
if(width.equals(StringResources.SKIN_GENERAL) && height.equals(StringResources.SKIN_GENERAL)) {
this.path = path;
}
- public SKIN_SHAPE getSkinShape() {
- return skinShape;
+ public SkinShapeList getSkinShapeList() {
+ return skinShapeList;
}
@ Override
if (list != null) {
for (Skin skin : list) {
if (skin.getType() == SKIN_TYPE.GENERAL || skin.getResolution().equals(resolution)) {
- if (skinShape == SKIN_SHAPE.NONE || skinShape == skin.getSkinShape()){
+ if (skinShape == SKIN_SHAPE.NONE || skin.getSkinShapeList().hasShape(skinShape)){
returnSkins.add(skin);
}
}
public boolean isResolutionExist(RESOLUTION re) {
+ if (re == null) {
+ return false;
+ }
+
for (RESOLUTION r : resList) {
if (r.getStrValue().equals(re.getStrValue())) {
return true;
public void itemSelected(ComboBox comboBox) {
// This is called when combo item is selected
skinShape = (SKIN_SHAPE)getSelectedData();
+ setValue();
comboSelected();
}
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.TreeItemTitle;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.TreeModifyItem;
import org.tizen.emulator.manager.ui.renewal.widgets.ComboBox;
+import org.tizen.emulator.manager.vms.SKIN_SHAPE;
public class DeviceTemplateItem extends ComboItem {
if (getItemListComp().isDetailMode()) {
createDetailItem();
+ return;
+ }
+ createCombo(treeModifyItem, COMBO_WIDTH);
+
+ if (profile == null) {
+ return;
+ }
- } else {
- createCombo(treeModifyItem, COMBO_WIDTH);
- if (profile != null) {
- // TODO
- for (DeviceTemplate temp : profile.getTemplateList()) {
- comboBox.addItem(temp.getValue().getName(), temp);
- }
+ SKIN_SHAPE imageSkinShape = propertyValue.getImageSkinShape();
+ for (DeviceTemplate temp : profile.getTemplateList()) {
+ if (imageSkinShape == SKIN_SHAPE.NONE ||
+ imageSkinShape == temp.getValue().getSkinShape()) {
+ comboBox.addItem(temp.getValue().getName(), temp);
}
}
+
selectItem(false);
}
public class CreateVMTable {
private Table table;
- private CreateVMTableViewer viewer;
+ private final CreateVMTableViewer viewer;
private BaseImage image;
+ StringResources.NEW_LINE;
message += "\tSkin: " + skin.getName() + StringResources.NEW_LINE
+ "\tSkin Resolution: " + skin.getResolution() + StringResources.NEW_LINE
- + "\tSkin Shape: " + skin.getSkinShape() + StringResources.NEW_LINE
+ + "\tSkin Shape: " + skin.getSkinShapeList().toString() + StringResources.NEW_LINE
+ StringResources.NEW_LINE
+ StringResources.NEW_LINE;
message += "Do you want to use this skin?"
import org.tizen.emulator.manager.vms.exception.VMWorkerException;
public class VMListTable {
- private VMListTableViewer viewer;
+ private final VMListTableViewer viewer;
private Table table;
public VMListTable(VMListTableViewer viewer) {
displayTip = displayTip + StringResources.NEW_LINE + StringResources.NEW_LINE
+ "Skin: " + value.skin.getName()
+ StringResources.NEW_LINE
- + "Skin shape: " + value.skin.getSkinShape().toString();
+ + "Skin shape: " + value.skin.getSkinShapeList().toString();
}
item.setToolTipText(5, displayTip);
// 6 - file sharing
private int BUTTON_Y_OFFSET = 3;
private int TEXT_X_POINT = 50 + BUTTON_X_OFFSET;
private int TEXT_Y_POINT = 36 + BUTTON_Y_OFFSET;
- private int TEXT_Y_GAP = 18;
+ private final int TEXT_Y_GAP = 18;
private int TITLE_X_OFFSET = 9;
private int TITLE_Y_OFFSET = 6;
if (button.getProperty() != null) {
Skin skin = button.getProperty().getPropertyValue().skin;
if (skin != null) {
- skinShape = skin.getSkinShape();
+ skinShape = skin.getSkinShapeList().get(0);
}
}
}
}
- private PaintListener VMButtonPaintListener = new PaintListener() {
+ private final PaintListener VMButtonPaintListener = new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
if (button.getProperty() != null) {
Skin skin = button.getProperty().getPropertyValue().skin;
if (skin != null) {
- skinShape = skin.getSkinShape();
+ skinShape = skin.getSkinShapeList().get(0);
}
// If VM is custom,
}
};
- private Listener mouseListener = new Listener() {
+ private final Listener mouseListener = new Listener() {
@Override
public void handleEvent(Event event) {
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@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.vms;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SkinShapeList {
+
+ private final List<SKIN_SHAPE> list = new ArrayList<SKIN_SHAPE>();
+
+ private SkinShapeList() {}
+
+ // return new instance
+ public static SkinShapeList create(String shapeProperty) {
+ SkinShapeList skinShapeList = new SkinShapeList();
+
+ if (shapeProperty == null) {
+ shapeProperty = SKIN_SHAPE.SQUARE.name();
+ }
+
+ String arr[] = shapeProperty.split(",");
+ for (String str : arr) {
+ skinShapeList.add(SKIN_SHAPE.find(str.trim()));
+ }
+
+ // set default
+ if (skinShapeList.list.size() == 0) {
+ skinShapeList.add(SKIN_SHAPE.SQUARE);
+ }
+
+ return skinShapeList;
+ }
+
+ public void add(SKIN_SHAPE shape) {
+ if (!hasShape(shape)) {
+ list.add(shape);
+ }
+ }
+
+ public SKIN_SHAPE get(int index) {
+ if (list.size() >= index + 1) {
+ return list.get(index);
+ }
+ return null;
+ }
+
+ public int size() {
+ return list.size();
+ }
+
+ public boolean hasShape(SKIN_SHAPE shape) {
+ for (SKIN_SHAPE thisShape : list) {
+ if (thisShape == shape) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ String str = "";
+ for (SKIN_SHAPE shape : list) {
+ str = str.isEmpty() ? shape.toString() : str + ", " + shape.toString();
+ }
+ return str;
+ }
+
+}