public class Menu extends InsertContainer
Modifier and Type | Class and Description |
---|---|
static interface |
Menu.MenuAppearance |
Modifier and Type | Field and Description |
---|---|
protected Item |
activeItem |
protected BaseEventPreview |
eventPreview |
protected KeyNav |
keyNav |
protected Item |
parentItem |
protected boolean |
plain |
protected boolean |
showSeparator |
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 |
---|
Menu() |
Menu(Menu.MenuAppearance appearance) |
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addBeforeSelectionHandler(<any> 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(<any> handler) |
protected void |
constrainScroll(int y) |
protected void |
createScrollers() |
protected void |
deactivateActiveItem() |
protected void |
doAutoSize() |
protected void |
doPhysicalAttach(Widget child,
int beforeIndex) |
protected void |
doPhysicalDetach(Widget child) |
Menu.MenuAppearance |
getAppearance()
Returns the appearance object for this instance
|
protected XElement |
getContainerTarget() |
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() |
protected void |
onAfterFirstAttach()
Called immediately after the first time the widget becomes attached to the browser's document only the first time.
|
void |
onBrowserEvent(Event event) |
protected void |
onClick(Event ce) |
protected void |
onEscape(NativePreviewEvent pe) |
protected void |
onHide() |
protected void |
onKeyDown(NativeEvent evt) |
protected void |
onKeyEnter(NativeEvent evt) |
protected void |
onKeyLeft(NativeEvent evt) |
protected void |
onKeyRight(NativeEvent evt) |
protected void |
onKeyUp(NativeEvent evt) |
protected void |
onMouseMove(Event ce) |
protected void |
onMouseOut(Event ce) |
protected void |
onMouseOver(Event ce) |
protected void |
onPreviewEvent(NativePreviewEvent pe)
Provides information about external events occurring in the DOM, allow the menu to decide to hide if necessary
|
protected void |
onScroll(ClickRepeaterEvent ce) |
protected void |
onWidgetHide(Widget widget) |
protected void |
onWidgetShow(Widget widget) |
protected void |
onWindowResize(int width,
int height) |
protected void |
scrollMenu(boolean top) |
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(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(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.
|
protected void |
showElement()
Displays the element only.
|
protected Item |
tryActivate(int start,
int step) |
insert, insert, setElement
add, add, addAddHandler, addBeforeAddHandler, addBeforeRemoveHandler, addContainerHandler, addRemoveHandler, adjustIndex, adopt, checkIndexBoundsForInsertion, clear, disable, doAttachChildren, doDetachChildren, enable, ensureGroupingHandlerRegistration, findWidget, getChildren, getItemByItemId, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, iterator, onInsert, onRemove, orphan, remove, remove, remove
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleDependentName, addStyleOnOver, adjustPosition, adjustSize, applyState, assertAfterRender, assertPreRender, blur, clearSizeCache, disableContextMenu, disableEvents, enableEvents, fireCancellableEvent, fireEvent, focus, getData, getElement, getFocusEl, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getPositionEl, getShadow, getShadowPosition, getStateId, getTabIndex, getToolTip, hideShadow, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isMonitorWindowResize, isRendered, isStateful, isVisible, mask, mask, notifyHide, notifyShow, onAttach, onBlur, onDetach, onDisable, onEnable, onFocus, onHideContextMenu, onLoad, onPosition, onResize, onRightClick, onShow, onShowContextMenu, onUnload, 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 BaseEventPreview eventPreview
protected KeyNav keyNav
protected Item parentItem
protected boolean plain
protected boolean showSeparator
protected Item activeItem
public Menu()
public Menu(Menu.MenuAppearance appearance)
public HandlerRegistration addBeforeSelectionHandler(<any> handler)
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(<any> handler)
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 void onBrowserEvent(Event event)
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(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(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(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(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 offsetprotected void showElement()
Menu menu1 = new Menu() {
public void show(Widget widget)
widget
- the align widgetpublic void showAt(int x, int y)
x
- the x coordinatey
- the y coordinateprotected void constrainScroll(int y)
protected void createScrollers()
protected void deactivateActiveItem()
protected void doAutoSize()
protected void doPhysicalAttach(Widget child, int beforeIndex)
doPhysicalAttach
in class Container
protected void doPhysicalDetach(Widget child)
doPhysicalDetach
in class Container
protected XElement getContainerTarget()
getContainerTarget
in class Container
protected void onAfterFirstAttach()
Component
onAfterFirstAttach
in class Component
protected void onPreviewEvent(NativePreviewEvent pe)
protected void onClick(Event ce)
protected void onEscape(NativePreviewEvent pe)
protected void onKeyDown(NativeEvent evt)
protected void onKeyEnter(NativeEvent evt)
protected void onKeyLeft(NativeEvent evt)
protected void onKeyRight(NativeEvent evt)
protected void onKeyUp(NativeEvent evt)
protected void onMouseMove(Event ce)
protected void onMouseOut(Event ce)
protected void onMouseOver(Event ce)
protected void onScroll(ClickRepeaterEvent ce)
protected void onWidgetHide(Widget widget)
onWidgetHide
in class Container
protected void onWidgetShow(Widget widget)
onWidgetShow
in class Container
protected void onWindowResize(int width, int height)
onWindowResize
in class Component
protected void scrollMenu(boolean top)
protected Item tryActivate(int start, int step)
Copyright © 2018. All rights reserved.