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

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.AdapterMenuItem
All Implemented Interfaces:
HasAttachHandlers, HasBeforeSelectionHandlers<Item>, HasResizeHandlers, HasSelectionHandlers<Item>, HasHandlers, EventListener, 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, HasItemId

public class AdapterMenuItem
extends Item

Allows any widget to be placed in a menu. As of 2.0, any widget can be added directly to a Menu therefore reducing the need for this class. AdapterMenuItem allows arbitrary widgets to be added to Menu and also configured as Items.

For example, when adding a ComboBox to a Menu, the Menu will be closed when a item from the combo drop down list is clicked if the combo is added directly to the Menu. To stop the menu from being closed, an AdapterMenuItem can be used so that @link Item.setHideOnClick(boolean) can be called.


Nested Class Summary
 
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
AdapterMenuItem(Widget widget)
          Creates a new adapter.
 
Method Summary
 XElement getElement()
          Gets a handle to the object's underlying DOM element.
 Widget getWidget()
          Returns the wrapped widget.
 boolean isAttached()
           
 boolean isManageFocus()
          Returns true if the adapter manages focus for the wrapped widget.
 boolean isNeedsIndent()
          Returns true if the widget will be indented.
 void onBrowserEvent(Event event)
           
 void setManageFocus(boolean manageFocus)
          True to move focus to wrapped widget when the enter key is pressed and remove focus of wrapped widget when escape is pressed (defaults to false).
 void setNeedsIndent(boolean needsIndent)
          True to indent the widget to account for the icon space (defaults to true).
 
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, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getShadow, getStateId, getToolTip, hide, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isRendered, isStateful, isVisible, isVisible, mask, mask, 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, 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

AdapterMenuItem

public AdapterMenuItem(Widget widget)
Creates a new adapter.

Parameters:
widget - the widget to be adapted
Method Detail

getElement

public XElement getElement()
Description copied from class: Component
Gets a handle to the object's underlying DOM element. This method should not be overridden. It is non-final solely to support legacy code that depends upon overriding it. If it is overridden, the subclass implementation must not return a different element than was previously set using UIObject.setElement(com.google.gwt.user.client.Element).

Overrides:
getElement in class Component
Returns:
the object's browser element

getWidget

public Widget getWidget()
Returns the wrapped widget.

Returns:
the widget

isAttached

public boolean isAttached()
Specified by:
isAttached in interface HasAttachHandlers
Overrides:
isAttached in class Widget

isNeedsIndent

public boolean isNeedsIndent()
Returns true if the widget will be indented.

Returns:
true if indented

onBrowserEvent

public void onBrowserEvent(Event event)
Specified by:
onBrowserEvent in interface EventListener
Overrides:
onBrowserEvent in class Component

setNeedsIndent

public void setNeedsIndent(boolean needsIndent)
True to indent the widget to account for the icon space (defaults to true).

Parameters:
needsIndent - true to indent

isManageFocus

public boolean isManageFocus()
Returns true if the adapter manages focus for the wrapped widget.

Returns:
true if focus being managed

setManageFocus

public void setManageFocus(boolean manageFocus)
True to move focus to wrapped widget when the enter key is pressed and remove focus of wrapped widget when escape is pressed (defaults to false).

Parameters:
manageFocus - true to manage focus


Copyright © 2012. All Rights Reserved.