From: GiWoong Kim Date: Thu, 11 Jul 2013 08:18:29 +0000 (+0900) Subject: skin: control the popup menu's name and visibility X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~905^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=723c213472b416ae540d76acc2e1516626e6f03e;p=sdk%2Femulator%2Fqemu.git skin: control the popup menu's name and visibility control the popup menu's name and visibility through the XML file. Change-Id: Ia2cb61f633f8d02d2c8889502824d786b02634c4 Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/MenuItemType.java b/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/MenuItemType.java index ceecb7bc83..e79d6b44b4 100644 --- a/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/MenuItemType.java +++ b/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/MenuItemType.java @@ -30,7 +30,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2013.07.11 at 12:12:25 PM KST +// Generated on: 2013.07.11 at 04:55:34 PM KST // @@ -51,7 +51,7 @@ import javax.xml.bind.annotation.XmlType; * <complexType name="menuItemType"> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <attribute name="itemName" type="{http://www.w3.org/2001/XMLSchema}string" default="&Rotate" /> + * <attribute name="itemName" type="{http://www.w3.org/2001/XMLSchema}string" default="" /> * <attribute name="visible" type="{http://www.w3.org/2001/XMLSchema}boolean" default="true" /> * </restriction> * </complexContent> @@ -79,7 +79,7 @@ public class MenuItemType { */ public String getItemName() { if (itemName == null) { - return "&Rotate"; + return ""; } else { return itemName; } diff --git a/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/PopupMenuType.java b/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/PopupMenuType.java index 54025e1eb3..e8828e7e45 100644 --- a/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/PopupMenuType.java +++ b/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/PopupMenuType.java @@ -30,7 +30,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2013.07.11 at 12:12:25 PM KST +// Generated on: 2013.07.11 at 04:55:34 PM KST // @@ -50,10 +50,13 @@ import javax.xml.bind.annotation.XmlType; * <complexType name="popupMenuType"> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="rotationItem" type="{http://www.tizen.org/emulator/skin/dbi}menuItemType" minOccurs="0"/> + * <all> + * <element name="topmostItem" type="{http://www.tizen.org/emulator/skin/dbi}menuItemType" minOccurs="0"/> + * <element name="rotateItem" type="{http://www.tizen.org/emulator/skin/dbi}menuItemType" minOccurs="0"/> + * <element name="scaleItem" type="{http://www.tizen.org/emulator/skin/dbi}menuItemType" minOccurs="0"/> * <element name="keywindowItem" type="{http://www.tizen.org/emulator/skin/dbi}menuItemType" minOccurs="0"/> - * </sequence> + * <element name="shellItem" type="{http://www.tizen.org/emulator/skin/dbi}menuItemType" minOccurs="0"/> + * </all> * </restriction> * </complexContent> * </complexType> @@ -63,36 +66,86 @@ import javax.xml.bind.annotation.XmlType; */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "popupMenuType", propOrder = { - "rotationItem", - "keywindowItem" + }) public class PopupMenuType { - protected MenuItemType rotationItem; + protected MenuItemType topmostItem; + protected MenuItemType rotateItem; + protected MenuItemType scaleItem; protected MenuItemType keywindowItem; + protected MenuItemType shellItem; + + /** + * Gets the value of the topmostItem property. + * + * @return + * possible object is + * {@link MenuItemType } + * + */ + public MenuItemType getTopmostItem() { + return topmostItem; + } + + /** + * Sets the value of the topmostItem property. + * + * @param value + * allowed object is + * {@link MenuItemType } + * + */ + public void setTopmostItem(MenuItemType value) { + this.topmostItem = value; + } /** - * Gets the value of the rotationItem property. + * Gets the value of the rotateItem property. * * @return * possible object is * {@link MenuItemType } * */ - public MenuItemType getRotationItem() { - return rotationItem; + public MenuItemType getRotateItem() { + return rotateItem; } /** - * Sets the value of the rotationItem property. + * Sets the value of the rotateItem property. * * @param value * allowed object is * {@link MenuItemType } * */ - public void setRotationItem(MenuItemType value) { - this.rotationItem = value; + public void setRotateItem(MenuItemType value) { + this.rotateItem = value; + } + + /** + * Gets the value of the scaleItem property. + * + * @return + * possible object is + * {@link MenuItemType } + * + */ + public MenuItemType getScaleItem() { + return scaleItem; + } + + /** + * Sets the value of the scaleItem property. + * + * @param value + * allowed object is + * {@link MenuItemType } + * + */ + public void setScaleItem(MenuItemType value) { + this.scaleItem = value; } /** @@ -119,4 +172,28 @@ public class PopupMenuType { this.keywindowItem = value; } + /** + * Gets the value of the shellItem property. + * + * @return + * possible object is + * {@link MenuItemType } + * + */ + public MenuItemType getShellItem() { + return shellItem; + } + + /** + * Sets the value of the shellItem property. + * + * @param value + * allowed object is + * {@link MenuItemType } + * + */ + public void setShellItem(MenuItemType value) { + this.shellItem = value; + } + } diff --git a/tizen/src/skin/client/skins/emul-general-3btn/default.dbi b/tizen/src/skin/client/skins/emul-general-3btn/default.dbi index af20536742..259092e6c2 100644 --- a/tizen/src/skin/client/skins/emul-general-3btn/default.dbi +++ b/tizen/src/skin/client/skins/emul-general-3btn/default.dbi @@ -66,4 +66,10 @@ + + + + + + diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java index bae5741e7c..1616c11b98 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java @@ -1361,13 +1361,8 @@ public class EmulatorSkin { return listener; }; - public Menu createDiagnosisMenu() { - Menu menu = new Menu(shell, SWT.DROP_DOWN); - - final MenuItem ramdumpItem = new MenuItem(menu, SWT.PUSH); - ramdumpItem.setText("&Ram Dump"); - - ramdumpItem.addSelectionListener(new SelectionAdapter() { + public SelectionAdapter createRamdumpMenu() { + SelectionAdapter listener = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { logger.info("Ram dump menu is selected"); @@ -1378,28 +1373,15 @@ public class EmulatorSkin { RamdumpDialog ramdumpDialog; try { - ramdumpDialog = new RamdumpDialog(EmulatorSkin.this.shell, communicator, config); + ramdumpDialog = new RamdumpDialog(shell, communicator, config); ramdumpDialog.open(); } catch (IOException ee) { logger.log( Level.SEVERE, ee.getMessage(), ee); } } - }); - - /* final MenuItem guestdumpItem = new MenuItem(menu, SWT.PUSH); - guestdumpItem.setText("&Guest Memory Dump"); - - guestdumpItem.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - logger.info("Guest memory dump menu is selected"); - - communicator.setRamdumpFlag(true); - communicator.sendToQEMU(SendCommand.GUEST_DUMP, null); - } - }); */ + }; - return menu; + return listener; } public SelectionAdapter createScreenshotMenu() { diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/PopupMenu.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/PopupMenu.java index 6960f45b16..f70b82bde9 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/PopupMenu.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/PopupMenu.java @@ -46,6 +46,20 @@ import org.tizen.emulator.skin.util.SkinUtil; import org.tizen.emulator.skin.util.SwtUtil; public class PopupMenu { + public static final String TOPMOST_MENUITEM_NAME = "&Always On Top"; + public static final String ROTATE_MENUITEM_NAME = "&Rotate"; + public static final String SCALE_MENUITEM_NAME = "&Scale"; + public static final String KEYWINDOW_MENUITEM_NAME = "&Key Window"; + public static final String ADVANCED_MENUITEM_NAME = "Ad&vanced"; + public static final String SCREENSHOT_MENUITEM_NAME = "&Screen Shot"; + public static final String HOSTKEYBOARD_MENUITEM_NAME = "&Host Keyboard"; + public static final String DIAGNOSIS_MENUITEM_NAME = "&Diagnosis"; + public static final String RAMDUMP_MENUITEM_NAME = "&Ram Dump"; + public static final String ABOUT_MENUITEM_NAME = "&About"; + public static final String FORCECLOSE_MENUITEM_NAME = "&Force Close"; + public static final String SDBSHELL_MENUITEM_NAME = "S&hell"; + public static final String CLOSE_MENUITEM_NAME = "&Close"; + private static Logger logger = SkinLogger.getSkinLogger(PopupMenu.class).getLogger(); @@ -67,11 +81,15 @@ public class PopupMenu { public MenuItem kbdOnItem; public MenuItem kbdOffItem; public MenuItem diagnosisItem; - public MenuItem shellItem; - public MenuItem closeItem; + public MenuItem ramdumpItem; public MenuItem aboutItem; public MenuItem forceCloseItem; + public MenuItem shellItem; + public MenuItem closeItem; + /** + * Constructor + */ public PopupMenu(EmulatorConfig config, EmulatorSkin skin, Shell shell, ImageRegistry imageRegistry) { this.config = config; @@ -93,7 +111,7 @@ public class PopupMenu { private void addMenuItems(final Menu menu) { PopupMenuType itemProperties = config.getDbiContents().getPopupMenu(); - String menuName = ""; + String menuName = "N/A"; /* Emulator detail info menu */ detailInfoItem = new MenuItem(menu, SWT.PUSH); @@ -108,52 +126,74 @@ public class PopupMenu { /* Always on top menu */ if (SwtUtil.isMacPlatform() == false) { /* not supported on mac */ - onTopItem = new MenuItem(menu, SWT.CHECK); - onTopItem.setText("&Always On Top"); - onTopItem.setSelection(skin.isOnTop); + MenuItemType topmostMenuType = (itemProperties != null) ? + itemProperties.getTopmostItem() : null; - SelectionAdapter topMostListener = skin.createTopMostMenu(); - onTopItem.addSelectionListener(topMostListener); + menuName = (topmostMenuType != null && + topmostMenuType.getItemName().isEmpty() == false) ? + topmostMenuType.getItemName() : TOPMOST_MENUITEM_NAME; + + if (topmostMenuType == null || + (topmostMenuType != null && topmostMenuType.isVisible() == true)) { + onTopItem = new MenuItem(menu, SWT.CHECK); + onTopItem.setText(menuName); + onTopItem.setSelection(skin.isOnTop); + + SelectionAdapter topMostListener = skin.createTopMostMenu(); + onTopItem.addSelectionListener(topMostListener); + } } /* Rotate menu */ - MenuItemType rotationItem = (itemProperties != null) ? - itemProperties.getRotationItem() : null; + MenuItemType rotationMenuType = (itemProperties != null) ? + itemProperties.getRotateItem() : null; - menuName = (rotationItem != null) ? - rotationItem.getItemName() : "&Rotate"; + menuName = (rotationMenuType != null && + rotationMenuType.getItemName().isEmpty() == false) ? + rotationMenuType.getItemName() : ROTATE_MENUITEM_NAME; - if (rotationItem == null || - (rotationItem != null && rotationItem.isVisible() == true)) { + if (rotationMenuType == null || + (rotationMenuType != null && rotationMenuType.isVisible() == true)) { rotateItem = new MenuItem(menu, SWT.CASCADE); rotateItem.setText(menuName); rotateItem.setImage(imageRegistry.getIcon(IconName.ROTATE)); - Menu rotateMenu = skin.createRotateMenu(); - rotateItem.setMenu(rotateMenu); + Menu rotateSubMenu = skin.createRotateMenu(); + rotateItem.setMenu(rotateSubMenu); } /* Scale menu */ - scaleItem = new MenuItem(menu, SWT.CASCADE); - scaleItem.setText("&Scale"); - scaleItem.setImage(imageRegistry.getIcon(IconName.SCALE)); + MenuItemType scaleMenuType = (itemProperties != null) ? + itemProperties.getScaleItem() : null; + + menuName = (scaleMenuType != null && + scaleMenuType.getItemName().isEmpty() == false) ? + scaleMenuType.getItemName() : SCALE_MENUITEM_NAME; - Menu scaleMenu = skin.createScaleMenu(); - scaleItem.setMenu(scaleMenu); + if (rotationMenuType == null || + (rotationMenuType != null && rotationMenuType.isVisible() == true)) { + scaleItem = new MenuItem(menu, SWT.CASCADE); + scaleItem.setText(menuName); + scaleItem.setImage(imageRegistry.getIcon(IconName.SCALE)); + + Menu scaleSubMenu = skin.createScaleMenu(); + scaleItem.setMenu(scaleSubMenu); + } new MenuItem(menu, SWT.SEPARATOR); /* Key Window menu */ - MenuItemType keywindowItem = (itemProperties != null) ? + MenuItemType keywindowMenuType = (itemProperties != null) ? itemProperties.getKeywindowItem() : null; - menuName = (keywindowItem != null) ? - keywindowItem.getItemName() : "&Key Window"; + menuName = (keywindowMenuType != null && + keywindowMenuType.getItemName().isEmpty() == false) ? + keywindowMenuType.getItemName() : KEYWINDOW_MENUITEM_NAME; - if (keywindowItem == null || - (keywindowItem != null && keywindowItem.isVisible() == true)) { + if (keywindowMenuType == null || + (keywindowMenuType != null && keywindowMenuType.isVisible() == true)) { keyWindowItem = new MenuItem(menu, SWT.CHECK); - keyWindowItem.setText("&Key Window"); + keyWindowItem.setText(menuName); keyWindowItem.setSelection(skin.isKeyWindow); SelectionAdapter keyWindowListener = skin.createKeyWindowMenu(); @@ -162,85 +202,102 @@ public class PopupMenu { /* Advanced menu */ advancedItem = new MenuItem(menu, SWT.CASCADE); - advancedItem.setText("Ad&vanced"); + advancedItem.setText(ADVANCED_MENUITEM_NAME); advancedItem.setImage(imageRegistry.getIcon(IconName.ADVANCED)); - Menu advancedMenu = new Menu(menu.getShell(), SWT.DROP_DOWN); + Menu advancedSubMenu = new Menu(menu.getShell(), SWT.DROP_DOWN); { /* Screen shot menu */ - screenshotItem = new MenuItem(advancedMenu, SWT.PUSH); - screenshotItem.setText("&Screen Shot"); + screenshotItem = new MenuItem(advancedSubMenu, SWT.PUSH); + screenshotItem.setText(SCREENSHOT_MENUITEM_NAME); screenshotItem.setImage(imageRegistry.getIcon(IconName.SCREENSHOT)); SelectionAdapter screenshotListener = skin.createScreenshotMenu(); screenshotItem.addSelectionListener(screenshotListener); /* VirtIO Keyboard Menu */ - hostKeyboardItem = new MenuItem(advancedMenu, SWT.CASCADE); - hostKeyboardItem.setText("&Host Keyboard"); + hostKeyboardItem = new MenuItem(advancedSubMenu, SWT.CASCADE); + hostKeyboardItem.setText(HOSTKEYBOARD_MENUITEM_NAME); hostKeyboardItem.setImage(imageRegistry.getIcon(IconName.HOST_KEYBOARD)); - Menu hostKeyboardMenu = new Menu(shell, SWT.DROP_DOWN); - - kbdOnItem = new MenuItem(hostKeyboardMenu, SWT.RADIO); - kbdOnItem.setText("On"); - kbdOnItem.setSelection(skin.isOnKbd); + Menu hostKeyboardSubMenu = new Menu(menu.getShell(), SWT.DROP_DOWN); + { + kbdOnItem = new MenuItem(hostKeyboardSubMenu, SWT.RADIO); + kbdOnItem.setText("On"); + kbdOnItem.setSelection(skin.isOnKbd); - kbdOffItem = new MenuItem(hostKeyboardMenu, SWT.RADIO); - kbdOffItem.setText("Off"); - kbdOffItem.setSelection(!skin.isOnKbd); + kbdOffItem = new MenuItem(hostKeyboardSubMenu, SWT.RADIO); + kbdOffItem.setText("Off"); + kbdOffItem.setSelection(!skin.isOnKbd); - SelectionAdapter hostKeyboardListener = skin.createHostKeyboardMenu(); - kbdOnItem.addSelectionListener(hostKeyboardListener); - kbdOffItem.addSelectionListener(hostKeyboardListener); - - hostKeyboardItem.setMenu(hostKeyboardMenu); + SelectionAdapter hostKeyboardListener = skin.createHostKeyboardMenu(); + kbdOnItem.addSelectionListener(hostKeyboardListener); + kbdOffItem.addSelectionListener(hostKeyboardListener); + } + hostKeyboardItem.setMenu(hostKeyboardSubMenu); /* Diagnosis menu */ if (SwtUtil.isLinuxPlatform()) { //TODO: windows - diagnosisItem = new MenuItem(advancedMenu, SWT.CASCADE); - diagnosisItem.setText("&Diagnosis"); + diagnosisItem = new MenuItem(advancedSubMenu, SWT.CASCADE); + diagnosisItem.setText(DIAGNOSIS_MENUITEM_NAME); diagnosisItem.setImage(imageRegistry.getIcon(IconName.DIAGNOSIS)); - Menu diagnosisMenu = skin.createDiagnosisMenu(); - diagnosisItem.setMenu(diagnosisMenu); + Menu diagnosisSubMenu = new Menu(menu.getShell(), SWT.DROP_DOWN); + { + ramdumpItem = new MenuItem(diagnosisSubMenu, SWT.PUSH); + ramdumpItem.setText(RAMDUMP_MENUITEM_NAME); + + SelectionAdapter ramdumpListener = skin.createRamdumpMenu(); + ramdumpItem.addSelectionListener(ramdumpListener); + } + diagnosisItem.setMenu(diagnosisSubMenu); } - new MenuItem(advancedMenu, SWT.SEPARATOR); + new MenuItem(advancedSubMenu, SWT.SEPARATOR); /* About menu */ - aboutItem = new MenuItem(advancedMenu, SWT.PUSH); - aboutItem.setText("&About"); + aboutItem = new MenuItem(advancedSubMenu, SWT.PUSH); + aboutItem.setText(ABOUT_MENUITEM_NAME); aboutItem.setImage(imageRegistry.getIcon(IconName.ABOUT)); SelectionAdapter aboutListener = skin.createAboutMenu(); aboutItem.addSelectionListener(aboutListener); - new MenuItem(advancedMenu, SWT.SEPARATOR); + new MenuItem(advancedSubMenu, SWT.SEPARATOR); /* Force close menu */ - forceCloseItem = new MenuItem(advancedMenu, SWT.PUSH); - forceCloseItem.setText("&Force Close"); + forceCloseItem = new MenuItem(advancedSubMenu, SWT.PUSH); + forceCloseItem.setText(FORCECLOSE_MENUITEM_NAME); forceCloseItem.setImage(imageRegistry.getIcon(IconName.FORCE_CLOSE)); SelectionAdapter forceCloseListener = skin.createForceCloseMenu(); forceCloseItem.addSelectionListener(forceCloseListener); } - advancedItem.setMenu(advancedMenu); + advancedItem.setMenu(advancedSubMenu); /* Shell menu */ - shellItem = new MenuItem(menu, SWT.PUSH); - shellItem.setText("S&hell"); - shellItem.setImage(imageRegistry.getIcon(IconName.SHELL)); + MenuItemType shellMenuType = (itemProperties != null) ? + itemProperties.getShellItem() : null; + + menuName = (shellMenuType != null && + shellMenuType.getItemName().isEmpty() == false) ? + shellMenuType.getItemName() : SDBSHELL_MENUITEM_NAME; - SelectionAdapter shellListener = skin.createShellMenu(); - shellItem.addSelectionListener(shellListener); + if (shellMenuType == null || + (shellMenuType != null && shellMenuType.isVisible() == true)) { + shellItem = new MenuItem(menu, SWT.PUSH); + shellItem.setText(menuName); + shellItem.setImage(imageRegistry.getIcon(IconName.SHELL)); + + SelectionAdapter shellListener = skin.createShellMenu(); + shellItem.addSelectionListener(shellListener); + } new MenuItem(menu, SWT.SEPARATOR); /* Close menu */ closeItem = new MenuItem(menu, SWT.PUSH); - closeItem.setText("&Close"); + closeItem.setText(CLOSE_MENUITEM_NAME); closeItem.setImage(imageRegistry.getIcon(IconName.CLOSE)); SelectionAdapter closeListener = skin.createCloseMenu(); diff --git a/tizen/src/skin/client/xsd/dbi.xsd b/tizen/src/skin/client/xsd/dbi.xsd index 0158c82c09..62ebd8e35a 100644 --- a/tizen/src/skin/client/xsd/dbi.xsd +++ b/tizen/src/skin/client/xsd/dbi.xsd @@ -92,14 +92,17 @@ xmlns:dbi="http://www.tizen.org/emulator/skin/dbi" elementFormDefault="qualified - - + + + + - + + - + \ No newline at end of file