Property: Add base-image(platform) information to Custom VM.
authorminkee.lee <minkee.lee@samsung.com>
Tue, 14 Oct 2014 11:23:00 +0000 (20:23 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Thu, 16 Oct 2014 12:25:38 +0000 (21:25 +0900)
Change-Id: I5d87ad66746b3680ab9cf83e836659b8d87862fa
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
common-project/src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/OptionType.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/property/BaseImageViewItem.java
common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboSubViewItem.java
common-project/src/org/tizen/emulator/manager/vms/Creator.java
common-project/src/org/tizen/emulator/manager/vms/Modifier.java
common-project/src/org/tizen/emulator/manager/vms/VMPropertyValue.java

index cb42c41..39d12db 100644 (file)
@@ -71,7 +71,8 @@ public abstract class CommonItemListFactory implements IItemListFactory{
        public static ObjectFactory factory = new ObjectFactory();
 
        // Override if need.
-       public void makePropertyItemList(List<? extends IViewItem> list, PropertyList propertyList) {
+       public void makePropertyItemList(List<? extends IViewItem> list, PropertyList propertyList,
+                       String profile, boolean isStandard) {
                if (propertyList != null) {
                        List<IViewItem> itemList = (List<IViewItem>)list;
                        List<Item> propertyItemList = propertyList.getItem();
@@ -157,8 +158,9 @@ public abstract class CommonItemListFactory implements IItemListFactory{
                }
 
                if (templateList.size() == 1) {
-                       makePropertyItemList(list, templateList.get(0).getPropertyList());
-                       makeDeviceItemList(list, templateList.get(0).getDeviceList());
+                       ItemList item = templateList.get(0);
+                       makePropertyItemList(list, item.getPropertyList(), item.getProfile(), false);
+                       makeDeviceItemList(list, item.getDeviceList());
                        return;
                }
 
@@ -168,7 +170,7 @@ public abstract class CommonItemListFactory implements IItemListFactory{
                        for (int i=1 ; i < templateList.size() ; i++) {
                                addToBase(base,templateList.get(i));
                        }
-                       makePropertyItemList(list, base.getPropertyList());
+                       makePropertyItemList(list, base.getPropertyList(), base.getProfile(), false);
                        makeDeviceItemList(list, base.getDeviceList());
                }
        }
index 86da2b2..7a3ada5 100644 (file)
@@ -40,7 +40,8 @@ public enum OptionType {
        DISABLE_ON_CREATE("disableOnCreate"),
        HIDE_LABEL("hideLabel"),
        DEFAULT_IF_EMPTY("defaultIfEmpty"),
-       SPREAD_ON_START("spreadOnStart")
+       SPREAD_ON_START("spreadOnStart"),
+       PROFILE("profile")
        ;
 
        private String name;
index ee2f025..bed13d4 100644 (file)
@@ -217,7 +217,7 @@ public class BaseImageViewItem extends FileViewItem {
        }
 
 
-       private boolean checkBaseImageFile(String baseImagePath){
+       public static boolean checkBaseImageFile(String baseImagePath){
                if (baseImagePath == null || baseImagePath.isEmpty()) {
                        return false;
                }
index de7be47..6f2666a 100644 (file)
@@ -62,8 +62,8 @@ public class ComboSubViewItem extends SubViewItem {
        protected Image INPUTBOX_ON_IMAGE = null;
        protected static int COMBO_WIDTH = 105;
 
-       private boolean useDefaultOnCreate = false;
-       private String defaultOnCreate = null;
+       protected boolean useDefaultOnCreate = false;
+       protected String defaultOnCreate = null;
 
        public ComboSubViewItem(LabelViewItem parentItem, Composite comp, Item template) {
                super(parentItem, comp, template);
index 20cc9b9..88b2669 100644 (file)
@@ -283,13 +283,13 @@ public class Creator {
                                // TODO : temp name
                                ec.getBaseInformation().getDiskImage().setVersion("Standard");
                        }
-                       if (newVM.baseName != null) {
-                               ec.getBaseInformation().getDiskImage().setBase(newVM.baseName);
-                       }
                } else {
                        ec.getBaseInformation().getDiskImage().setType("custom");
                        ec.getBaseInformation().setArchitecture(EmulatorVMList.getInstance().CustomArch);
                }
+               if (newVM.baseName != null) {
+                       ec.getBaseInformation().getDiskImage().setBase(newVM.baseName);
+               }
 
                //
                ec.getBaseInformation().getDiskImage().setProfile(newVM.profile);
index ddd41f1..9a9d31b 100644 (file)
@@ -128,6 +128,12 @@ public class Modifier {
                        }
                }
 
+               if (newVM.baseName != null) { // baseName can be modified only in Custom VM.
+                       if (!newVM.baseName.equals(oldVM.baseName)) {
+                               property.getConfiguration().getBaseInformation().getDiskImage().setBase(newVM.baseName);
+                       }
+               }
+
                if (newVM.addOptions != null) {
                        if (oldVM.addOptions == null || !newVM.addOptions.equals(oldVM.addOptions)) {
                                property.getConfiguration().getUsability().setAdvancedOptions(newVM.addOptions);
index 6d649e3..4090f11 100644 (file)
@@ -124,6 +124,7 @@ public class VMPropertyValue implements Cloneable {
                                        if (baseImagePathName == null) {
                                                baseImagePathName = template.getPropertyValue().baseImagePathName;
                                        }
+                                       baseName = template.getConfiguration().getBaseInformation().getDiskImage().getBase();
                                }
                        } else {
                                isStandard = true;
@@ -276,6 +277,17 @@ public class VMPropertyValue implements Cloneable {
                        return false;
                }
 
+               if (this.baseName != null) {
+                       if (dest.baseName == null
+                                       || (dest.baseName != null && !this.baseName.equals(dest.baseName))) {
+                               return false;
+                       }
+               } else {
+                       if (dest.baseName != null) {
+                               return false;
+                       }
+               }
+
                if (this.maxTouchCount != dest.maxTouchCount) {
                        return false;
                }