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.
Item.ItemAppearance
Modifier and Type | Field and Description |
---|---|
protected boolean |
manageFocus |
protected Widget |
widget
The wrapped 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 |
---|
AdapterMenuItem(Widget widget)
Creates a new adapter.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected void |
onAttach() |
void |
onBrowserEvent(Event event) |
protected void |
onClick(NativeEvent be) |
protected void |
onDetach() |
protected void |
onDisable() |
protected void |
onEnable() |
protected boolean |
onEscape() |
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).
|
activate, addActivateHandler, addBeforeSelectionHandler, addDeactivateHandler, addSelectionHandler, deactivate, expandMenu, getAppearance, getHideOnClick, handleClick, isCanActivate, isHideOnClick, setCanActivate, setHideOnClick, shouldDeactivate
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, 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, 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 Widget widget
protected boolean manageFocus
public AdapterMenuItem(Widget widget)
widget
- the widget to be adaptedpublic XElement getElement()
Component
#setElement(com.google.gwt.dom.client.Element)
.getElement
in class Component
public Widget getWidget()
public boolean isAttached()
public boolean isNeedsIndent()
public void onBrowserEvent(Event event)
onBrowserEvent
in class Component
public void setNeedsIndent(boolean needsIndent)
needsIndent
- true to indentpublic boolean isManageFocus()
public void setManageFocus(boolean manageFocus)
manageFocus
- true to manage focusCopyright © 2018. All rights reserved.