Default value is applied when create VM.
Change-Id: If94598efa1c114703add581c18acd17a28c77db4
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
return optionMap;
}
+ public static String getCreateDefault(List<VMItemOption> optionList) {
+ for (VMItemOption option : optionList) {
+ if (option.getName().equals(OptionName.CREATE_DEFAULT)) {
+ return option.getValue();
+ }
+ }
+ return null;
+ }
+
public static List<String> getOptionList(List<VMItemOption> optionList) {
List<String> resultList = new ArrayList<String>();
} else if (name.equals(ItemName.GL_VERSION)) {
itemList.add(new GLVersionItem(name, title,
- VMTemplateUtil.getOptionMap(item.getOptions())));
+ VMTemplateUtil.getOptionMap(item.getOptions()),
+ VMTemplateUtil.getCreateDefault(item.getOptions())));
} else if (name.equals(ItemName.OCI_DEVICE)) {
// TODO this may be moved to tv plugin.
public static final String WIN = "win"; //$NON-NLS-1$
public static final String MAC = "mac"; //$NON-NLS-1$
+ public static final String CREATE_DEFAULT = "createDefault";
+
}
public abstract class ComboItem extends ModifyDialogItem {
protected ComboBox comboBox;
+ protected String createDefault;
+ protected String comboValue;
public static final int COMBO_WIDTH = 124;
super(name, title);
}
+ public ComboItem(String name, String title, String createDefault) {
+ super(name, title);
+ this.createDefault = createDefault;
+ }
+
+ protected boolean useCreateDefault() {
+ return getItemListComp().isCreateMode() &&
+ (createDefault != null && !createDefault.isEmpty());
+ }
protected void addComboItem(String item) {
comboBox.addItem(item);
private final Map<String, String> optionMap;
String glVersion = "";
- public GLVersionItem(String name, String title, Map<String, String> optionMap) {
- super(name, title);
+ public GLVersionItem(String name, String title, Map<String, String> optionMap,
+ String createDefault) {
+ super(name, title, createDefault);
this.optionMap = optionMap;
-
}
if (optionMap.get(VER2_VER3) != null) {
addComboItem(optionMap.get(VER2_VER3), VER2_VER3);
}
-
- // select item
- selectItem();
}
private void selectItem() {
return;
}
+ if (useCreateDefault()) {
+ glVersion = createDefault;
+ }
+
int index = -1;
for (int i=0 ; i < getComboItemList().size() ; i++) {
if (getComboItemList().get(i).equals(optionMap.get(glVersion))) {
index = 0;
glVersion = (String)getCobmoData(0);
}
+
selectComboItem(index, false);
comboSelected();
}
@Override
public ModifyDialogItem cloneItem() {
- return new GLVersionItem(getName(), getTitle(), optionMap);
+ return new GLVersionItem(getName(), getTitle(), optionMap, createDefault);
}
@Override
<option name="v2.0_v3.0">v2.0 & v3.0</option>
<option name="v1.1_v2.0">v1.1 & v2.0</option>
<option name="supportOS">mac</option>
+ <option name="createDefault">v2.0_v3.0</option>
</item>
<item name="network" title="Network" type="label">
<item name="proxy" title="Proxy" type="combo" >