import org.tizen.emulator.manager.plugin.PluginStringResources;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.template.ITemplate;
+import org.tizen.emulator.manager.template.renewal.VmItem;
import org.tizen.emulator.manager.template.renewal.VmTemplate;
import org.tizen.emulator.manager.template.renewal.VmTemplateUtil;
import org.tizen.emulator.manager.ui.renewal.dialoghandler.VMModifyHandler;
// for custom base image
private List<VMProperty> emulatorList = new ArrayList<VMProperty>();
+ // It contains available item list (experimental checked, os version checked,,,)
+ private List<VmItem> vmItemList = null;
+
protected BaseImage() {
}
EMLogger.getLogger().info("Use CommonOptionFactory.");
}
- VmTemplate template = platform.findTemplate(imageName);
- if (template == null) {
- EMLogger.getLogger().warning("No template found");
- return;
+ optionList = f.makeOptionList(getVmItemList());
+ }
+
+
+ public List<VmItem> getVmItemList() {
+ if (vmItemList == null) {
+ VmTemplate template = platform.findTemplate(imageName);
+ if (template == null) {
+ EMLogger.getLogger().warning("No template found");
+ vmItemList = new ArrayList<VmItem>();
+ }
+ vmItemList = VmTemplateUtil.getAvailableItemList(template);
}
- optionList = f.makeOptionList(VmTemplateUtil.getAvailableItemList(template));
+
+ return vmItemList;
+
}
@Override
}
private String platformName;
- private String platformPath;
- private File pluginJar;
- private Attributes attr;
+ private final String platformPath;
+ private final File pluginJar;
+ private final Attributes attr;
private URLClassLoader loader;
- private ArrayList<ExtensionItem> exItemList
+ private final ArrayList<ExtensionItem> exItemList
= new ArrayList<ExtensionItem>();
private EMPlugin parentPlugin;
if (item != null) {
exItemList.add(item);
} else {
- EMLogger.getLogger().info("This plugin does not have " + ex //$NON-NLS-1$
- + " extension point."); //$NON-NLS-1$
+ EMLogger.getLogger().info(platform.getName() + "'s plugin does not have " + ex //$NON-NLS-1$
+ + " extension point. "); //$NON-NLS-1$
}
}
return true;
if (f.getName().contains(PlatformStringResources.TEMPLATE)) { // ui template file for detail view
VmTemplate vmTemplate = loadTemplate(f);
if (!checkTemplate(vmTemplate)) {
+ EMLogger.getLogger().info(f.getName() + " is not valid for "+ platform.getName());
continue;
}
+ EMLogger.getLogger().info(f.getName() + " is loaded for "+ platform.getName());
platform.getTemplateList().add(vmTemplate);
// setting default item list
// check default template
if (platform.getDefaultTemplate() == null) {
- EMLogger.getLogger().info("No default template found..");
+ EMLogger.getLogger().info("No default template found for " + platform.getName());
loadBaseTemplate(platform);
}
return;
}
platform.setDefaultTemplate(vmTemplate);
- EMLogger.getLogger().info("Load template from " + f.getAbsolutePath());
+ EMLogger.getLogger().info(platform.getName() + " load template from " + f.getAbsolutePath());
}
private static boolean checkTemplate(VmTemplate template) {
return str;
}
+ @Override
+ public String toString() {
+ return toString("");
+ }
+
// following getter must not be changed.
public String getName() {
return name;
import org.tizen.emulator.manager.platform.BaseImage;
import org.tizen.emulator.manager.platform.Skin;
import org.tizen.emulator.manager.resources.StringResources;
+import org.tizen.emulator.manager.template.renewal.VmItem;
+import org.tizen.emulator.manager.ui.renewal.item.ItemName;
import org.tizen.emulator.manager.vms.xml.OptionType;
this.cpu = value.getCpuCount();
this.ramSize = value.getRamSize();
- // TODO: device -> connectivity, camera
- for (SubDevice subDevice : value.getAdditionalDevices()) {
- for (VMOption option : advancedVMOptionList) {
- if (option.getName().equals(subDevice.getName())) {
- settionOption(subDevice, option);
- }
+
+ // find device-template sub item.
+ List<VmItem> deviceTemplateItems = null;
+ for (VmItem vmItem : baseImage.getVmItemList()) {
+ if (vmItem.getName().equals(ItemName.DEVICE_TEMPLATE)) {
+ deviceTemplateItems = vmItem.getSubItems();
}
}
+ if (deviceTemplateItems == null) {
+ // if device-template sub items not exist..?
+ deviceTemplateItems = baseImage.getVmItemList();
+ }
+
+ // Set addtional VMOptions
+ // TODO: camera
+ for (SubDevice subDevice : value.getAdditionalDevices()) {
+ setAdditionalOptions(deviceTemplateItems, subDevice);
+ }
}
- private void settionOption(SubDevice device, VMOption option) {
- // setting sensor, connectivity
- for (SubDeviceItem item : device.getItems()) {
- for(VMSubOption type : option.getSubOptionList()) {
- if (item.getId().equals(type.getName())) {
- if (item.isSupport()) {
- type.setValue("on");
- } else {
- type.setValue("off");
+
+ private void setAdditionalOptions(List<VmItem> deviceTemplateItems,
+ SubDevice device) {
+ // Set subOptions
+ // if SubDevice is exist in item-template(VmItem list).
+ // (and if SubDeviceItem is in VmItem's sub-item list)
+
+ for (VmItem vmItem : deviceTemplateItems) {
+
+ // if SubDevice is in VmItem list
+ if (vmItem.getName().equals(device.getName())) {
+ String name = device.getName();
+ for (SubDeviceItem subItem : device.getItems()) {
+ for (VmItem subVmItem : vmItem.getSubItems()) {
+
+ // if subDeviceItem is in VmItem's sub-item list
+ if (subVmItem.getName().equals(subItem.getId())) {
+ setAdvancedOptionSub(name, subItem.getId(),
+ subItem.isSupport() ? "on" : "off");
+ }
+ break;
}
- break;
}
+ break;
}
}
}
+
// for plug-in -> will be deleted
@ Deprecated
public OptionType getAdvancedOption(String optionName) {
// for nfc
if (checkOn(property.getPropertyValue().getAdvancedOptionSubValue(
ItemName.CONNECTIVITY, ItemName.NFC))) {
- config.addQemuOption("-device", "virtio-maru-nfc-pci"); //$NON-NLS-1$ //$NON-NLS-2$
+ String nfcOption = isGreaterThanOrEqualTo(property.getImageVersion(), "3.0") ?
+ "virtio-maru-nfc-pci" : "virtio-nfc-pci";
+ config.addQemuOption("-device", nfcOption); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
bw.newLine();
String comment = null;
String var = null;
- for (OPTION_KEY key : OPTION_KEY.values()) {
+ for (OPTION_KEY optionKey : OPTION_KEY.values()) {
+ String key = optionKey.toString();
if ( (comment = varComment.get(key)) != null) {
bw.write(comment);
bw.newLine();
<item name="nfc" title="NFC" type="checkbox" />
<option name="numColumn">2</option>
</item>
- <item name="camera" title="Camera" type="checkLabel">
- <item name="rear" title="Rear" type="checkbox" />
-<!-- <item name="front" title="Front" type="checkbox" /> -->
- <option name="numColumn">2</option>
- </item>
<item name="camera" title="Camera" type="label" >
<!-- <item type="combo" name="frontType" title="Front"/> -->
<!-- <item type="file" name="frontImage" title="(image)"/> -->
<option name="v1.1_v2.0">v1.1 & v2.0</option>
<option name="supportOS">mac</option>
</item>
- <item name="viewer" title="Viewer" type="label" >
- <item name="type" title="Type" type="combo">
- <option name="list">Native, Web</option>
- <option name="experimental">true</option>
- <option name="defaultOnCreate">Native</option>
- </item>
+ <item name="viewer" title="Viewer" type="combo" >
+ <option name="list">Native, Web</option>
+ <option name="experimental">true</option>
+ <option name="defaultOnCreate">Native</option>
+ </item>
+ <item name="displayMode" title="Display Mode" type="combo" >
+ <option name="list">Native, Web</option>
+ <option name="experimental">true</option>
+ <option name="defaultOnCreate">Native</option>
</item>
</itemGroup>