public class Menu extends InsertContainer implements HasBeforeSelectionHandlers<Item>, HasSelectionHandlers<Item>
Modifier and Type | Class and Description |
---|---|
static interface |
Menu.MenuAppearance |
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
InsertPanel.ForIsWidget
HasWidgets.ForIsWidget
DEBUG_ID_PREFIX
Constructor and Description |
---|
Menu() |
Menu(Menu.MenuAppearance appearance) |
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addBeforeSelectionHandler(BeforeSelectionHandler<Item> handler) |
HandlerRegistration |
addMaximizeHandler(MaximizeEvent.MaximizeHandler handler)
Fires when the
Menu is maximized. |
HandlerRegistration |
addMinimizeHandler(MinimizeEvent.MinimizeHandler handler)
Fires when the
Menu is minimized. |
HandlerRegistration |
addSelectionHandler(SelectionHandler<Item> handler) |
Menu.MenuAppearance |
getAppearance()
Returns the appearance object for this instance
|
String |
getDefaultAlign()
Returns the default alignment.
|
int |
getMaxHeight()
Returns the max height of the menu or -1 if not set.
|
int |
getMinWidth()
Returns the menu's minimum width.
|
Item |
getParentItem()
Returns the menu's parent item.
|
String |
getSubMenuAlign()
Returns the sub menu alignment.
|
void |
hide()
Hides the menu.
|
void |
hide(boolean deep)
Hides this menu and optionally all parent menus
|
boolean |
isConstrainViewport()
Returns true if constrain to viewport is enabled.
|
boolean |
isEnableScrolling()
Returns true if vertical scrolling is enabled.
|
boolean |
isFocusOnShow()
Returns true if the menu will be focused when displayed.
|
boolean |
isVisible() |
void |
onBrowserEvent(Event event) |
void |
setActiveItem(Widget widget,
boolean autoExpand)
Sets the active item.
|
void |
setConstrainViewport(boolean constrainViewport)
Sets whether the menu should be constrained to the viewport when shown.
|
void |
setDefaultAlign(String defaultAlign)
Sets the default
XElement.alignTo(com.google.gwt.dom.client.Element, com.sencha.gxt.core.client.Style.AnchorAlignment, int, int) anchor position value for this menu relative to its element of origin
(defaults to "tl-bl?"). |
void |
setEnableScrolling(boolean enableScrolling)
True to enable vertical scrolling of the children in the menu (defaults to true).
|
void |
setFocusOnShow(boolean focusOnShow)
True to set the focus on the menu when it is displayed.
|
void |
setMaxHeight(int maxHeight)
Sets the max height of the menu (defaults to -1).
|
void |
setMinWidth(int minWidth)
Sets he minimum width of the menu in pixels (defaults to 120).
|
void |
setOnHideFocusElement(Element onHideFocusElement)
Sets the element that should receive focus onHide unless the onHide was triggered by
focusing on a different element.
|
void |
setSubMenuAlign(String subMenuAlign)
The
XElement.alignTo(com.google.gwt.dom.client.Element, com.sencha.gxt.core.client.Style.AnchorAlignment, int, int) anchor position value to use for submenus of this menu (defaults to "tl-tr-?"). |
void |
show(Element elem,
Style.AnchorAlignment alignment)
Displays this menu relative to another element.
|
void |
show(Element elem,
Style.AnchorAlignment alignment,
int offsetX,
int offsetY)
Displays this menu relative to another element.
|
void |
show(Widget widget)
Displays this menu relative to the widget using the default alignment.
|
void |
showAt(int x,
int y)
Displays this menu at a specific xy position.
|
insert, insert
add, add, addAddHandler, addBeforeAddHandler, addBeforeRemoveHandler, addContainerHandler, addRemoveHandler, clear, disable, enable, findWidget, getItemByItemId, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, iterator, remove, remove, remove
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleOnOver, clearSizeCache, disableEvents, enableEvents, fireEvent, focus, getData, getElement, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getShadow, getShadowPosition, getStateId, getTabIndex, getToolTip, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isRendered, isStateful, isVisible, mask, mask, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setPagePosition, setPixelSize, setPosition, setShadow, setShadowPosition, setSize, setStateful, setStateId, setTabIndex, setToolTip, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmask
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
fireEvent
add
add
getWidgetIndex
getWidget, getWidgetCount, getWidgetIndex, remove
public Menu()
public Menu(Menu.MenuAppearance appearance)
public HandlerRegistration addBeforeSelectionHandler(BeforeSelectionHandler<Item> handler)
addBeforeSelectionHandler
in interface HasBeforeSelectionHandlers<Item>
public HandlerRegistration addMaximizeHandler(MaximizeEvent.MaximizeHandler handler)
Menu
is maximized.handler
- sets the MaximizeEvent.MaximizeHandler
HandlerRegistration
.public HandlerRegistration addMinimizeHandler(MinimizeEvent.MinimizeHandler handler)
Menu
is minimized.handler
- sets the MinimizeEvent.MinimizeHandler
.HandlerRegistration
.public HandlerRegistration addSelectionHandler(SelectionHandler<Item> handler)
addSelectionHandler
in interface HasSelectionHandlers<Item>
public Menu.MenuAppearance getAppearance()
public String getDefaultAlign()
public int getMaxHeight()
public int getMinWidth()
public Item getParentItem()
public String getSubMenuAlign()
public void hide(boolean deep)
deep
- true to close all parent menuspublic boolean isConstrainViewport()
public boolean isEnableScrolling()
public boolean isFocusOnShow()
public boolean isVisible()
isVisible
in interface HasVisibility
isVisible
in class Component
public void onBrowserEvent(Event event)
onBrowserEvent
in interface EventListener
onBrowserEvent
in class Component
public void setActiveItem(Widget widget, boolean autoExpand)
Item
to be activated. All other types are ignored.widget
- the widget to set activeautoExpand
- true to auto expand the itempublic void setConstrainViewport(boolean constrainViewport)
showAt(int, int)
.constrainViewport
- true to constrainpublic void setDefaultAlign(String defaultAlign)
XElement.alignTo(com.google.gwt.dom.client.Element, com.sencha.gxt.core.client.Style.AnchorAlignment, int, int)
anchor position value for this menu relative to its element of origin
(defaults to "tl-bl?").defaultAlign
- the default alignpublic void setEnableScrolling(boolean enableScrolling)
enableScrolling
- true to for scrollingpublic void setFocusOnShow(boolean focusOnShow)
focusOnShow
- true to focuspublic void setMaxHeight(int maxHeight)
setEnableScrolling(boolean)
is set to
true.maxHeight
- the max heightpublic void setMinWidth(int minWidth)
minWidth
- the minimum widthpublic void setOnHideFocusElement(Element onHideFocusElement)
onHideFocusElement
- the element to focus on during onHidepublic void setSubMenuAlign(String subMenuAlign)
XElement.alignTo(com.google.gwt.dom.client.Element, com.sencha.gxt.core.client.Style.AnchorAlignment, int, int)
anchor position value to use for submenus of this menu (defaults to "tl-tr-?").subMenuAlign
- the sub alignmentpublic void show(Element elem, Style.AnchorAlignment alignment)
elem
- the element to align toalignment
- the XElement.alignTo(com.google.gwt.dom.client.Element, com.sencha.gxt.core.client.Style.AnchorAlignment, int, int)
anchor position to use in aligning to the element (defaults to
defaultAlign)public void show(Element elem, Style.AnchorAlignment alignment, int offsetX, int offsetY)
elem
- the element to align toalignment
- the XElement.alignTo(com.google.gwt.dom.client.Element, com.sencha.gxt.core.client.Style.AnchorAlignment, int, int)
anchor position to use in aligning to the element (defaults to
defaultAlign)offsetX
- X offsetoffsetY
- Y offsetpublic void show(Widget widget)
widget
- the align widgetpublic void showAt(int x, int y)
x
- the x coordinatey
- the y coordinateCopyright © 2015. All rights reserved.