org.xwiki.gwt.user.client.ui
Class MenuItem

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.MenuItem
          extended by org.xwiki.gwt.user.client.ui.MenuItem
All Implemented Interfaces:
com.google.gwt.safehtml.client.HasSafeHtml, com.google.gwt.user.client.ui.HasEnabled, com.google.gwt.user.client.ui.HasHTML, com.google.gwt.user.client.ui.HasText, com.google.gwt.user.client.ui.HasVisibility

public class MenuItem
extends com.google.gwt.user.client.ui.MenuItem

Improves the default menu item widget provided by GWT with support for icon and shortcut key label.

Version:
$Id: 8fa56681055a4cd2fba098e7c20d241a3d06e54e $

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
MenuItem(String text, boolean asHTML, com.google.gwt.user.client.Command cmd)
          Constructs a new menu item that fires a command when it is selected.
MenuItem(String text, boolean asHTML, com.google.gwt.user.client.ui.MenuBar subMenu)
          Constructs a new menu item that cascades to a sub-menu when it is selected.
MenuItem(String text, com.google.gwt.user.client.Command cmd)
          Constructs a new menu item that fires a command when it is selected.
MenuItem(String text, com.google.gwt.user.client.ui.MenuBar subMenu)
          Constructs a new menu item that cascades to a sub-menu when it is selected.
 
Method Summary
 String getHTML()
           
 Element getIcon()
           
 String getShortcutKeyLabel()
           
 String getText()
           
 void setHTML(String html)
           
 void setIcon(Element icon)
          Sets the icon of this menu item.
 void setIcon(com.google.gwt.resources.client.ImageResource icon)
          Sets the icon of this menu item using the element created from an AbstractImagePrototype.
 void setShortcutKeyLabel(String text)
          Sets the text representing the shortcut key associated with this menu item.
 void setText(String text)
           
 
Methods inherited from class com.google.gwt.user.client.ui.MenuItem
getCommand, getParentMenu, getScheduledCommand, getSubMenu, isEnabled, onEnsureDebugId, setCommand, setEnabled, setHTML, setScheduledCommand, setSelectionStyle, setSubMenu
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MenuItem

public MenuItem(String text,
                com.google.gwt.user.client.Command cmd)
Constructs a new menu item that fires a command when it is selected.

Parameters:
text - the item's text
cmd - the command to be fired when it is selected

MenuItem

public MenuItem(String text,
                boolean asHTML,
                com.google.gwt.user.client.Command cmd)
Constructs a new menu item that fires a command when it is selected.

Parameters:
text - the item's text
asHTML - true to treat the specified text as html
cmd - the command to be fired when it is selected

MenuItem

public MenuItem(String text,
                com.google.gwt.user.client.ui.MenuBar subMenu)
Constructs a new menu item that cascades to a sub-menu when it is selected.

Parameters:
text - the item's text
subMenu - the sub-menu to be displayed when it is selected

MenuItem

public MenuItem(String text,
                boolean asHTML,
                com.google.gwt.user.client.ui.MenuBar subMenu)
Constructs a new menu item that cascades to a sub-menu when it is selected.

Parameters:
text - the item's text
asHTML - true to treat the specified text as html
subMenu - the sub-menu to be displayed when it is selected
Method Detail

setIcon

public void setIcon(com.google.gwt.resources.client.ImageResource icon)
Sets the icon of this menu item using the element created from an AbstractImagePrototype.

Parameters:
icon - the icon to be displayed on the left of this menu item

setIcon

public void setIcon(Element icon)
Sets the icon of this menu item.

Parameters:
icon - the icon to be displayed on the left of this menu item

getIcon

public Element getIcon()
Returns:
the icon of this menu item

setHTML

public void setHTML(String html)
Specified by:
setHTML in interface com.google.gwt.user.client.ui.HasHTML
Overrides:
setHTML in class com.google.gwt.user.client.ui.MenuItem

getHTML

public String getHTML()
Specified by:
getHTML in interface com.google.gwt.user.client.ui.HasHTML
Overrides:
getHTML in class com.google.gwt.user.client.ui.MenuItem

setText

public void setText(String text)
Specified by:
setText in interface com.google.gwt.user.client.ui.HasText
Overrides:
setText in class com.google.gwt.user.client.ui.MenuItem

getText

public String getText()
Specified by:
getText in interface com.google.gwt.user.client.ui.HasText
Overrides:
getText in class com.google.gwt.user.client.ui.MenuItem

setShortcutKeyLabel

public void setShortcutKeyLabel(String text)
Sets the text representing the shortcut key associated with this menu item.

Parameters:
text - the text used to display the shortcut key

getShortcutKeyLabel

public String getShortcutKeyLabel()
Returns:
the text representing the shortcut key associated with this menu item, null if the shortcut key label hasn't been set


Copyright © 2004-2013 XWiki. All Rights Reserved.