--- /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 <sangho1206.park@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.option;
+
+import java.util.List;
+
+import org.tizen.emulator.manager.ui.detail.item.ItemName;
+import org.tizen.emulator.manager.vms.xml.template.DeviceList;
+import org.tizen.emulator.manager.vms.xml.template.Item;
+import org.tizen.emulator.manager.vms.xml.template.ItemList;
+import org.tizen.emulator.manager.vms.xml.template.PropertyList;
+
+public abstract class CommonOptionFactroy implements IOptionFactory {
+ // Override if need.
+ public void makeCommonOptionList(List<IOption> list, ItemList itemTemplate) {
+ PropertyList propertyList = itemTemplate.getPropertyList();
+ DeviceList deviceList = itemTemplate.getDeviceList();
+
+ IOption option;
+ for (Item item : propertyList.getItem()) {
+ option = findProeprtyOption(item);
+ if (option != null) {
+ list.add(option);
+ }
+ }
+
+ for (Item item : deviceList.getItem()) {
+ option = findDeviceOption(item);
+ if (option != null) {
+ list.add(option);
+ }
+ }
+ }
+
+ // Override if need
+ public IOption findProeprtyOption(Item item) {
+ if (item == null) {
+ return null;
+ }
+ String name = item.getName();
+ if (name.equals(ItemName.VM_NAME)) {
+ return Option.getInstance(VMNameOption.class);
+
+ } else if (name.equals(ItemName.BASE_IMAGE)) {
+ return Option.getInstance(BaseImageOption.class);
+
+ } else if (name.equals(ItemName.DISPLAY)) {
+ return Option.getInstance(DisplayOption.class);
+
+ } else if (name.equals(ItemName.PROCESSORS)) {
+ return Option.getInstance(ProcessorOption.class);
+
+ } else if (name.equals(ItemName.RAM_SIZE)) {
+ return Option.getInstance(RamSizeOption.class);
+
+ } else if (name.equals(ItemName.SUSPEND_SUPPORT)) {
+ return Option.getInstance(SuspendSupportOption.class);
+
+ } else if (name.equals(ItemName.FILE_SHARE)) {
+ return Option.getInstance(FileShareOption.class);
+
+ } else if (name.equals(ItemName.HW_SUPPORT)) {
+ return Option.getInstance(HWSupportOption.class);
+
+ }
+
+ return null;
+ }
+
+ // Override if need
+ public IOption findDeviceOption(Item item) {
+ if (item == null) {
+ return null;
+ }
+ String name = item.getName();
+
+ if (name.equals(ItemName.NET_CONFIG)) {
+ return Option.getInstance(NetworkOption.class);
+
+ } else if (name.equals(ItemName.NET_PROXY)) {
+ return Option.getInstance(NetProxyOption.class);
+
+ } else if (name.equals(ItemName.CAMERA)) {
+ return Option.getInstance(CameraOption.class);
+ }
+
+ return null;
+ }
+
+}