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 ImageResource |
icon |
protected Menu |
subMenu |
protected String |
text |
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(String text)
Creates a new item with the given text.
|
MenuItem(String text,
<any> handler)
Creates a new item.
|
MenuItem(String text,
ImageResource icon)
Creates a new item.
|
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() |
ImageResource |
getIcon()
Returns the item's icon style.
|
Menu |
getSubMenu()
Returns the item's sub menu.
|
String |
getText()
Returns the item's text.
|
void |
setHTML(SafeHtml 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, handleClick, isCanActivate, onAttach, onClick, onDisable, onEnable, onEscape, setCanActivate, setHideOnClick
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, 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, 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, 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 String text
protected Widget widget
public MenuItem()
public MenuItem(MenuItem.MenuItemAppearance menuItemAppearance)
menuItemAppearance
- the menu item appearancepublic MenuItem(String text)
text
- the item's textpublic MenuItem(String text, ImageResource icon)
text
- the item's texticon
- the item's iconpublic MenuItem(String text, <any> handler)
text
- the item texthandler
- the selection handlerpublic void expandMenu()
public MenuItem.MenuItemAppearance getAppearance()
getAppearance
in class Item
public String getHTML()
public ImageResource getIcon()
public Menu getSubMenu()
public String getText()
public void setHTML(SafeHtml html)
public void setIcon(ImageResource icon)
HasIcon
public void setSubMenu(Menu menu)
menu
- the sub menupublic void setText(String text)
text
- the textpublic 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 boolean shouldDeactivate(NativeEvent ce)
shouldDeactivate
in class Item
Copyright © 2018. All rights reserved.