com.sencha.gxt.widget.core.client.menu
Class MenuItem

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.sencha.gxt.widget.core.client.Component
              extended by com.sencha.gxt.widget.core.client.menu.Item
                  extended by com.sencha.gxt.widget.core.client.menu.MenuItem
All Implemented Interfaces:
HasAttachHandlers, HasBeforeSelectionHandlers<Item>, HasResizeHandlers, HasSelectionHandlers<Item>, HasHandlers, HasSafeHtml, EventListener, HasHTML, HasText, HasVisibility, IsWidget, ActivateEvent.HasActivateHandlers<Item>, BeforeHideEvent.HasBeforeHideHandlers, BeforeShowContextMenuEvent.HasBeforeShowContextMenuHandler, BeforeShowEvent.HasBeforeShowHandlers, BlurEvent.HasBlurHandlers, DeactivateEvent.HasDeactivateHandlers<Item>, DisableEvent.HasDisableHandlers, EnableEvent.HasEnableHandlers, FocusEvent.HasFocusHandlers, HideEvent.HasHideHandlers, MoveEvent.HasMoveHandlers, ShowContextMenuEvent.HasShowContextMenuHandler, ShowEvent.HasShowHandlers, HasFocusSupport, HasIcon, HasItemId
Direct Known Subclasses:
CheckMenuItem

public class MenuItem
extends Item
implements HasSafeHtml, HasHTML, HasIcon

A base class for all menu items that require menu-related functionality (like sub-menus) and are not static display items. Item extends the base functionality of Item by adding menu-specific activation and click handling.


Nested Class Summary
static interface MenuItem.MenuItemAppearance
           
 
Nested classes/interfaces inherited from class com.sencha.gxt.widget.core.client.menu.Item
Item.ItemAppearance
 
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
 
Constructor Summary
MenuItem()
          Creates a new item.
MenuItem(MenuItem.MenuItemAppearance appearance)
          Creates a menu item with the given appearance.
MenuItem(MenuItem.MenuItemAppearance menuItemAppearance, Item.ItemAppearance itemAppearance)
          Creates a menu item with the given appearances.
MenuItem(String text)
          Creates a new item with the given text.
MenuItem(String text, ImageResource icon)
          Creates a new item.
MenuItem(String text, SelectionHandler<MenuItem> handler)
          Creates a new item.
 
Method Summary
 void expandMenu()
          Expands the item's sub menu.
 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 setHTML(String 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)
           
 
Methods inherited from class com.sencha.gxt.widget.core.client.menu.Item
addActivateHandler, addBeforeSelectionHandler, addDeactivateHandler, addSelectionHandler, getHideOnClick, isCanActivate, setCanActivate, setHideOnClick
 
Methods inherited from class com.sencha.gxt.widget.core.client.Component
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleOnOver, clearSizeCache, disable, disableEvents, enable, enableEvents, fireEvent, focus, getData, getElement, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getShadow, getStateId, getToolTip, hide, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isRendered, isStateful, isVisible, isVisible, mask, mask, onBrowserEvent, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setPagePosition, setPixelSize, setPosition, setShadow, setSize, setStateful, setStateId, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmask
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

MenuItem

public MenuItem()
Creates a new item.


MenuItem

public MenuItem(MenuItem.MenuItemAppearance appearance)
Creates a menu item with the given appearance.

Parameters:
appearance - the menu item appearance

MenuItem

public MenuItem(MenuItem.MenuItemAppearance menuItemAppearance,
                Item.ItemAppearance itemAppearance)
Creates a menu item with the given appearances.

Parameters:
menuItemAppearance - the menu item appearance
itemAppearance - the underlying base item appearance

MenuItem

public MenuItem(String text)
Creates a new item with the given text.

Parameters:
text - the item's text

MenuItem

public MenuItem(String text,
                ImageResource icon)
Creates a new item.

Parameters:
text - the item's text
icon - the item's icon

MenuItem

public MenuItem(String text,
                SelectionHandler<MenuItem> handler)
Creates a new item.

Parameters:
text - the item text
handler - the selection handler
Method Detail

expandMenu

public void expandMenu()
Expands the item's sub menu.


getHTML

public String getHTML()
Specified by:
getHTML in interface HasHTML

getIcon

public ImageResource getIcon()
Returns the item's icon style.

Specified by:
getIcon in interface HasIcon
Returns:
the icon style

getSubMenu

public Menu getSubMenu()
Returns the item's sub menu.

Returns:
the sub menu

getText

public String getText()
Returns the item's text.

Specified by:
getText in interface HasText
Returns:
the text

setHTML

public void setHTML(SafeHtml html)
Specified by:
setHTML in interface HasSafeHtml

setHTML

public void setHTML(String html)
Specified by:
setHTML in interface HasHTML

setIcon

public void setIcon(ImageResource icon)
Description copied from interface: HasIcon
Sets the icon.

Specified by:
setIcon in interface HasIcon
Parameters:
icon - the icon

setSubMenu

@UiChild(limit=1,
         tagname="submenu")
public void setSubMenu(Menu menu)
Sets the item's sub menu.

Parameters:
menu - the sub menu

setText

public void setText(String text)
Sets the item's text.

Specified by:
setText in interface HasText
Parameters:
text - the text

setWidget

public void setWidget(Widget widget)


Copyright © 2012. All Rights Reserved.