public class MenuItem extends Item implements HasIcon
Item
by adding menu-specific activation and click
handling.Modifier and Type | Class and Description |
---|---|
static interface |
MenuItem.MenuItemAppearance |
Item.ItemAppearance
Modifier and Type | Field and Description |
---|---|
protected SafeHtml |
html |
protected ImageResource |
icon |
protected Menu |
subMenu |
protected Widget |
widget |
canActivate, hideOnClick
adjustSize, allowTextSelection, cacheSizes, disableContextMenu, disabled, disabledStyle, ensureVisibilityOnSizing, height, hidden, lastSize, layer, left, mask, maskMessage, monitorWindowResize, pageX, pageY, resizeHandler, shim, tabIndex, toolTip, toolTipConfig, top, width, windowResizeDelay, windowResizeTask
Constructor and Description |
---|
MenuItem()
Creates a new item.
|
MenuItem(MenuItem.MenuItemAppearance menuItemAppearance)
Creates a menu item with the given appearances.
|
MenuItem(SafeHtml html)
Creates a new item with the given html.
|
MenuItem(SafeHtml html,
<any> handler)
Creates a new item with the given html and selection handler.
|
MenuItem(SafeHtml html,
ImageResource icon)
Creates a new item with the given html and icon.
|
MenuItem(String text,
<any> handler)
Creates a new item with the given text and selection handler.
|
MenuItem(String text,
ImageResource icon)
Creates a new item with the given text and icon.
|
Modifier and Type | Method and Description |
---|---|
protected void |
activate(boolean autoExpand) |
protected void |
deactivate() |
protected void |
doAttachChildren() |
protected void |
doDetachChildren() |
void |
expandMenu()
Expands the item's sub menu.
|
protected void |
expandMenu(boolean autoActivate) |
MenuItem.MenuItemAppearance |
getAppearance() |
String |
getHTML()
Returns the item's html.
|
ImageResource |
getIcon()
Returns the item's icon style.
|
SafeHtml |
getSafeHtml()
Returns the item's html.
|
Menu |
getSubMenu()
Returns the item's sub menu.
|
String |
getText()
Returns the item's text.
|
protected void |
handleClick(NativeEvent be) |
boolean |
hasSubMenu()
Returns true if this has a sub menu.
|
void |
setHTML(SafeHtml html)
Sets the item's html.
|
void |
setIcon(ImageResource icon)
Sets the icon.
|
void |
setSubMenu(Menu menu)
Sets the item's sub menu.
|
void |
setText(String text)
Sets the item's text.
|
void |
setWidget(Widget widget) |
protected boolean |
shouldDeactivate(NativeEvent ce) |
addActivateHandler, addBeforeSelectionHandler, addDeactivateHandler, addSelectionHandler, getHideOnClick, isCanActivate, isHideOnClick, onAttach, onClick, onDisable, onEnable, onEscape, setCanActivate, setHideOnClick
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addGestureRecognizer, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleDependentName, addStyleOnOver, adjustPosition, adjustSize, applyState, assertAfterRender, assertPreRender, blur, clearSizeCache, disable, disableContextMenu, disableEvents, enable, enableEvents, fireCancellableEvent, fireEvent, focus, getData, getElement, getFocusEl, getFocusSupport, getGestureRecognizer, getGestureRecognizerCount, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getPositionEl, getShadow, getShadowPosition, getStateId, getTabIndex, getToolTip, hide, hideShadow, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isMonitorWindowResize, isRendered, isStateful, isVisible, isVisible, mask, mask, notifyHide, notifyShow, onAfterFirstAttach, onBlur, onBrowserEvent, onDetach, onFocus, onHide, onHideContextMenu, onLoad, onPosition, onResize, onRightClick, onShow, onShowContextMenu, onTouch, onUnload, onWindowResize, removeStyleDependentName, removeStyleOnOver, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setMonitorWindowResize, setPagePosition, setPixelSize, setPosition, setShadow, setShadowPosition, setSize, setStateful, setStateId, setStyleDependentName, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmask
protected ImageResource icon
protected Menu subMenu
protected SafeHtml html
protected Widget widget
public MenuItem()
public MenuItem(MenuItem.MenuItemAppearance menuItemAppearance)
menuItemAppearance
- the menu item appearancepublic MenuItem(SafeHtml html)
html
- the item's htmlpublic MenuItem(SafeHtml html, ImageResource icon)
html
- the item's htmlicon
- the item's iconpublic MenuItem(String text, ImageResource icon)
text
- the item's texticon
- the item's iconpublic MenuItem(SafeHtml html, <any> handler)
html
- the item htmlhandler
- the selection handlerpublic MenuItem(String text, <any> handler)
text
- the item texthandler
- the selection handlerpublic void expandMenu()
public MenuItem.MenuItemAppearance getAppearance()
getAppearance
in class Item
public String getText()
getHTML()
public void setText(String text)
text
- the textpublic SafeHtml getSafeHtml()
public String getHTML()
public void setHTML(SafeHtml html)
html
- the htmlpublic ImageResource getIcon()
public void setIcon(ImageResource icon)
HasIcon
public Menu getSubMenu()
public boolean hasSubMenu()
public void setSubMenu(Menu menu)
menu
- the sub menupublic void setWidget(Widget widget)
protected void deactivate()
deactivate
in class Item
protected void doAttachChildren()
protected void doDetachChildren()
protected void expandMenu(boolean autoActivate)
expandMenu
in class Item
protected void handleClick(NativeEvent be)
handleClick
in class Item
protected boolean shouldDeactivate(NativeEvent ce)
shouldDeactivate
in class Item
Copyright © 2018. All rights reserved.