|
GWT 2.7.0 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.MenuItem
public class MenuItem
An entry in a
MenuBar. Menu items can either fire a
Scheduler.ScheduledCommand when they are clicked, or open a
cascading sub-menu.
Each menu item is assigned a unique DOM id in order to support ARIA. See
Accessibility for more information.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled |
| Field Summary |
|---|
| Fields inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR |
| Constructor Summary | |
|---|---|
MenuItem(SafeHtml html)
Constructs a new menu item that fires a command when it is selected. |
|
MenuItem(SafeHtml html,
MenuBar subMenu)
Constructs a new menu item that cascades to a sub-menu when it is selected. |
|
MenuItem(SafeHtml html,
Scheduler.ScheduledCommand cmd)
Constructs a new menu item that fires a command when it is selected. |
|
MenuItem(java.lang.String text,
boolean asHTML)
|
|
MenuItem(java.lang.String text,
boolean asHTML,
MenuBar subMenu)
Constructs a new menu item that cascades to a sub-menu when it is selected. |
|
MenuItem(java.lang.String text,
boolean asHTML,
Scheduler.ScheduledCommand cmd)
Constructs a new menu item that fires a command when it is selected. |
|
MenuItem(java.lang.String text,
MenuBar subMenu)
Constructs a new menu item that cascades to a sub-menu when it is selected. |
|
MenuItem(java.lang.String text,
Scheduler.ScheduledCommand cmd)
Constructs a new menu item that fires a command when it is selected. |
|
| Method Summary | |
|---|---|
Command |
getCommand()
Deprecated. use getScheduledCommand() instead |
java.lang.String |
getHTML()
Gets this object's contents as HTML. |
MenuBar |
getParentMenu()
Gets the menu that contains this item. |
Scheduler.ScheduledCommand |
getScheduledCommand()
Gets the scheduled command associated with this item. |
MenuBar |
getSubMenu()
Gets the sub-menu associated with this item. |
java.lang.String |
getText()
Gets this object's text. |
boolean |
isEnabled()
Returns true if the widget is enabled, false if not. |
protected void |
onEnsureDebugId(java.lang.String baseID)
Also sets the Debug IDs of MenuItems in the submenu of this MenuItem if a submenu exists. |
void |
setCommand(Command cmd)
Deprecated. use #setScheduledCommand(ScheduledCommand) instead |
void |
setEnabled(boolean enabled)
Sets whether this widget is enabled. |
void |
setHTML(SafeHtml html)
Sets this object's contents via known-safe HTML. |
void |
setHTML(java.lang.String html)
Sets this object's contents via HTML. |
(package private) void |
setParentMenu(MenuBar parentMenu)
|
void |
setScheduledCommand(Scheduler.ScheduledCommand cmd)
Sets the scheduled command associated with this item. |
protected void |
setSelectionStyle(boolean selected)
|
void |
setSubMenu(MenuBar subMenu)
Sets the sub-menu associated with this item. |
void |
setText(java.lang.String text)
Sets this object's text. |
| 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, replaceElement, 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 |
|---|
public MenuItem(SafeHtml html)
html - the item's html text
public MenuItem(SafeHtml html,
Scheduler.ScheduledCommand cmd)
html - the item's textcmd - the command to be fired when it is selected
public MenuItem(SafeHtml html,
MenuBar subMenu)
html - the item's textsubMenu - the sub-menu to be displayed when it is selected
public MenuItem(java.lang.String text,
boolean asHTML,
Scheduler.ScheduledCommand cmd)
text - the item's textasHTML - true to treat the specified text as htmlcmd - the command to be fired when it is selected
public MenuItem(java.lang.String text,
boolean asHTML,
MenuBar subMenu)
text - the item's textasHTML - true to treat the specified text as htmlsubMenu - the sub-menu to be displayed when it is selected
public MenuItem(java.lang.String text,
Scheduler.ScheduledCommand cmd)
text - the item's textcmd - the command to be fired when it is selected
public MenuItem(java.lang.String text,
MenuBar subMenu)
text - the item's textsubMenu - the sub-menu to be displayed when it is selected
MenuItem(java.lang.String text,
boolean asHTML)
| Method Detail |
|---|
@Deprecated public Command getCommand()
getScheduledCommand() instead
public java.lang.String getHTML()
HasHTML
getHTML in interface HasHTMLpublic MenuBar getParentMenu()
null if none exists.public Scheduler.ScheduledCommand getScheduledCommand()
null if none existspublic MenuBar getSubMenu()
null if none existspublic java.lang.String getText()
HasText
getText in interface HasTextpublic boolean isEnabled()
HasEnabled
isEnabled in interface HasEnabled@Deprecated public void setCommand(Command cmd)
#setScheduledCommand(ScheduledCommand) instead
cmd - the command to be associated with this itempublic void setEnabled(boolean enabled)
HasEnabled
setEnabled in interface HasEnabledenabled - true to enable the widget, false
to disable itpublic void setHTML(SafeHtml html)
HasSafeHtml
The object will behave exactly the same as when a widget's
HasHTML.setHTML(String) method is
invoked; however the SafeHtml passed to this method observes the
contract that it can be used in an HTML context without causing unsafe
script execution. Thus, unlike
HasHTML.setHTML(String), using this
method cannot result in Cross-Site Scripting security vulnerabilities.
setHTML in interface HasSafeHtmlhtml - the object's new HTML, represented as a SafeHtml objectpublic void setHTML(java.lang.String html)
HasHTMLHasText.setText(String) whenever possible.
setHTML in interface HasHTMLhtml - the object's new HTMLpublic void setScheduledCommand(Scheduler.ScheduledCommand cmd)
cmd - the scheduled command to be associated with this itempublic void setSubMenu(MenuBar subMenu)
subMenu - this item's new sub-menupublic void setText(java.lang.String text)
HasText
setText in interface HasTexttext - the object's new textprotected void onEnsureDebugId(java.lang.String baseID)
MenuItem if a submenu exists.
onEnsureDebugId in class UIObjectbaseID - the base ID used by the main elementUIObject.onEnsureDebugId(String)protected void setSelectionStyle(boolean selected)
void setParentMenu(MenuBar parentMenu)
|
GWT 2.7.0 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||