V - The type of the menu items valueT - The type of the class extending from this base classpublic abstract class AbstractMenu<V,T extends AbstractMenu<V,T>> extends BaseDominoElement<elemental2.dom.HTMLDivElement,T>
| Modifier and Type | Class and Description |
|---|---|
static interface |
AbstractMenu.CloseHandler
A handler that will be called when closing the menu
|
static interface |
AbstractMenu.MenuItemSelectionHandler<V>
A functional interface to implement menu items selection handlers
|
static interface |
AbstractMenu.OpenHandler
A handler that will be called when opening the menu
|
BaseDominoElement.ElementHandler<T>, BaseDominoElement.ResizeHandler<T>, BaseDominoElement.StyleEditor<E extends elemental2.dom.HTMLElement,T extends org.jboss.elemento.IsElement<E>>, BaseDominoElement.WavesStyler| Modifier and Type | Field and Description |
|---|---|
protected DominoElement<elemental2.dom.HTMLAnchorElement> |
addMissingElement |
protected boolean |
autoCloseOnSelect |
protected boolean |
caseSensitive |
protected String |
createMissingLabel |
protected FlexItem<elemental2.dom.HTMLDivElement> |
headContainer |
protected boolean |
headerVisible |
protected DominoElement<elemental2.dom.HTMLUListElement> |
itemsContainer |
protected KeyboardNavigation<AbstractMenuItem<V,?>> |
keyboardNavigation |
protected FlexItem<elemental2.dom.HTMLDivElement> |
mainContainer |
protected FlexLayout |
menuElement |
protected MenuHeader<V,T> |
menuHeader |
protected List<AbstractMenuItem<V,?>> |
menuItems |
protected boolean |
searchable |
protected SearchBox |
searchBox |
protected FlexItem<elemental2.dom.HTMLDivElement> |
searchContainer |
protected List<AbstractMenu.MenuItemSelectionHandler<V>> |
selectionHandlers |
protected FlexItem<elemental2.dom.HTMLDivElement> |
subHeaderContainer |
element| Constructor and Description |
|---|
AbstractMenu() |
| Modifier and Type | Method and Description |
|---|---|
T |
addCloseHandler(AbstractMenu.CloseHandler closeHandler)
Adds a close handler to be called when the menu is closed
|
T |
addOpenHandler(AbstractMenu.OpenHandler openHandler)
Adds an open handler to be called when the menu is opened
|
T |
addSelectionHandler(AbstractMenu.MenuItemSelectionHandler<V> selectionHandler)
Adds a global selection handler that will apply to all menu items
|
T |
appendAction(elemental2.dom.HTMLElement element)
Appends an element to menu actions bar, appending an action element will force the header to
show up if not visible
|
T |
appendAction(org.jboss.elemento.IsElement<?> element)
Appends an element to menu actions bar, appending an action element will force the header to
show up if not visible
|
T |
appendChild(AbstractMenuItem<V,?> menuItem)
Appends a menu item to this menu
|
T |
appendSeparator()
Appends a separator item to this menu, separator will show up as a simple border.
|
T |
appendSubHeaderChild(elemental2.dom.HTMLElement element)
Appends a child element to the menu subheader, the subheader will show up below the search and
before the menu items.
|
T |
appendSunHeaderChild(org.jboss.elemento.IsElement<?> element)
Appends a child element to the menu subheader, the subheader will show up below the search and
before the menu items.
|
T |
close()
Close the menu
|
elemental2.dom.HTMLDivElement |
element() |
elemental2.dom.HTMLElement |
getAppendTarget() |
String |
getCreateMissingLabel() |
DropDirection |
getDropDirection() |
protected DropDirection |
getEffectiveDropDirection() |
elemental2.dom.HTMLElement |
getFocusElement() |
FlexItem<elemental2.dom.HTMLDivElement> |
getHeadContainer() |
DominoElement<elemental2.dom.HTMLUListElement> |
getItemsContainer() |
KeyboardNavigation<AbstractMenuItem<V,?>> |
getKeyboardNavigation() |
FlexItem<elemental2.dom.HTMLDivElement> |
getMainContainer() |
MenuHeader<V,T> |
getMenuHeader() |
List<AbstractMenuItem<V,?>> |
getMenuItems() |
DominoElement<elemental2.dom.HTMLLIElement> |
getNoResultElement() |
AbstractMenu<?,?> |
getParent() |
AbstractMenuItem<V,?> |
getParentItem() |
SearchBox |
getSearchBox() |
FlexItem<elemental2.dom.HTMLDivElement> |
getSearchContainer() |
FlexItem<elemental2.dom.HTMLDivElement> |
getSubHeaderContainer() |
elemental2.dom.HTMLElement |
getTargetElement() |
boolean |
isAutoCloseOnSelect() |
boolean |
isCaseSensitive() |
boolean |
isContextMenu() |
boolean |
isDropDown() |
boolean |
isOpened() |
boolean |
isSearchable() |
boolean |
isUseSmallScreensDirection() |
protected void |
onItemSelected(AbstractMenuItem<V,?> item) |
boolean |
onSearch(String token)
If search is enabled, when search is trigger it will call this method.
|
T |
open()
Opens the menu
|
void |
open(boolean focus)
Opens the menu with a boolean to indicate if the first element should be focused
|
T |
openSubMenu(AbstractMenu<V,?> dropMenu)
Opens a sub menu that has this menu as its parent
|
T |
removeCloseHandler(AbstractMenu.CloseHandler closeHandler)
Removes a close handler
|
T |
removeItem(AbstractMenuItem<V,?> menuItem)
Removes a menu item from this menu
|
T |
removeOpenHandler(AbstractMenu.OpenHandler openHandler)
Removes an open handler
|
T |
removeSelectionHandler(AbstractMenu.MenuItemSelectionHandler<V> selectionHandler)
removes a global selection handler that was applied to all menu items
|
T |
select(AbstractMenuItem<V,?> menuItem)
Selects the specified menu item if it is one of this menu items
|
T |
select(AbstractMenuItem<V,?> menuItem,
boolean silent)
Selects the menu item at the specified index if exists
|
T |
selectAt(int index)
Selects the menu item at the specified index if exists
|
T |
selectAt(int index,
boolean silent)
Selects the menu at the specified index if exists
|
T |
selectByKey(String key)
Selects a menu item by its key if exists
|
T |
selectByKey(String key,
boolean silent)
Selects a menu item by its key if exists with ability to avoid triggering change handlers
|
T |
setAppendTarget(elemental2.dom.HTMLElement appendTarget)
set the
HTMLElement to which the menu will be appended to when opened. |
T |
setAutoCloseOnSelect(boolean autoCloseOnSelect) |
T |
setBordered(boolean bordered)
Adds/removes the outer borders of the menu, this will add/remove the menu-bordered style
|
T |
setCaseSensitive(boolean caseSensitive) |
T |
setContextMenu(boolean contextMenu)
Set the menu as a context menu that will open when the target element got a right click instead
of a click
|
T |
setCreateMissingLabel(String createMissingLabel)
Sets the label that will appear when no elements match the search, default is "create"
|
T |
setDropDirection(DropDirection dropDirection)
Sets the
DropDirection of the menu |
T |
setFocusElement(elemental2.dom.HTMLElement focusElement)
Sets a custom element as the default focus element of the menu
|
T |
setFocusElement(org.jboss.elemento.IsElement<? extends elemental2.dom.HTMLElement> focusElement)
Sets a custom element as the default focus element of the menu
|
T |
setHeaderVisible(boolean visible)
Change the visibility of the menu header
|
T |
setIcon(BaseIcon<?> icon)
Set the menu icon in the header, setting the icon will force the header to show up if not
visible
|
T |
setMissingItemHandler(MissingItemHandler<T> missingItemHandler)
Set a handler that will allow the user to handle a search that does not match any existing
items.
|
T |
setNoResultElement(elemental2.dom.HTMLLIElement noResultElement)
Sets a custom element to represent no results when search is applied.
|
T |
setNoResultElement(org.jboss.elemento.IsElement<elemental2.dom.HTMLLIElement> noResultElement)
Sets a custom element to represent no results when search is applied.
|
T |
setSearchable(boolean searchable)
Enable/Disable search
|
T |
setTargetElement(elemental2.dom.HTMLElement targetElement) |
T |
setTargetElement(org.jboss.elemento.IsElement<?> targetElement) |
T |
setTitle(String title)
Set the menu title in the header, setting the title will force the header to show up if not
visible
|
T |
setUseSmallScreensDirection(boolean useSmallScreensDropDirection) |
add, add, addClickListener, addCss, addCss, addEventListener, addEventListener, addEventsListener, addHideListener, addShowListener, alignCenter, alignRight, appendChild, appendChild, apply, attr, blur, childNodes, clearElement, contains, contains, contains, containsCss, css, css, cssClassByIndex, cssClassesCount, cssText, disable, elevate, elevate, enable, firstChild, getAttachObserver, getAttribute, getBoundingClientRect, getChildElementCount, getClickableElement, getCollapsible, getCollapsibleElement, getDetachObserver, getDominoId, getElementsCount, getElevation, getFirstChild, getId, getTextContent, getTooltip, getWavesElement, hasAttribute, hasChildNodes, hasDirectChild, hide, hideOn, id, init, insertAfter, insertAfter, insertAfter, insertAfter, insertBefore, insertBefore, insertBefore, insertBefore, insertFirst, insertFirst, insertFirst, isAttached, isCollapsed, isDisabled, isEmptyElement, isEqualNode, isForceHidden, isHidden, isReadOnly, item, lastChild, length, onAttached, onDetached, onResize, pullLeft, pullRight, querySelector, querySelectorAll, remove, removeAttachObserver, removeAttribute, removeChild, removeChild, removeCss, removeCss, removeCssProperty, removeDetachObserver, removeEventListener, removeEventListener, removeHideListener, removeHideOn, removeShowListener, removeShowOn, removeTooltip, removeWaves, replaceCss, setAlignItems, setAttribute, setAttribute, setAttribute, setBackgroundColor, setBackgroundColor, setBorder, setBorderColor, setBottom, setBottom, setBoxShadow, setCollapseStrategy, setColor, setColor, setContent, setContent, setCssProperty, setCssProperty, setCursor, setCursor, setDisabled, setDisplay, setDisplay, setDropMenu, setFlex, setFloat, setFloat, setFontSize, setFontSize, setForceHidden, setHeight, setHeight, setId, setInnerHtml, setLeft, setLeft, setLineHeight, setLineHeight, setMargin, setMargin, setMarginBottom, setMarginBottom, setMarginLeft, setMarginLeft, setMarginRight, setMarginRight, setMarginTop, setMarginTop, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setOpacity, setOpacity, setOverFlow, setOverFlow, setOverFlowY, setPadding, setPadding, setPaddingBottom, setPaddingBottom, setPaddingLeft, setPaddingLeft, setPaddingRight, setPaddingRight, setPaddingTop, setPaddingTop, setPointerEvents, setPosition, setPosition, setReadOnly, setRight, setRight, setTabIndex, setTextAlign, setTextAlign, setTextContent, setTooltip, setTooltip, setTooltip, setTooltip, setTop, setTop, setTransitionDuration, setWidth, setWidth, setZIndex, show, showOn, style, style, styler, textContent, toggleDisplay, toggleDisplay, withWaves, withWavesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisExpandedadd, add, remove, remove, removeProperty, replace, setProperty, setPropertyprotected final SearchBox searchBox
protected FlexLayout menuElement
protected final FlexItem<elemental2.dom.HTMLDivElement> headContainer
protected final FlexItem<elemental2.dom.HTMLDivElement> searchContainer
protected final FlexItem<elemental2.dom.HTMLDivElement> subHeaderContainer
protected final FlexItem<elemental2.dom.HTMLDivElement> mainContainer
protected final DominoElement<elemental2.dom.HTMLUListElement> itemsContainer
protected final DominoElement<elemental2.dom.HTMLAnchorElement> addMissingElement
protected final MenuHeader<V,T extends AbstractMenu<V,T>> menuHeader
protected KeyboardNavigation<AbstractMenuItem<V,?>> keyboardNavigation
protected boolean searchable
protected boolean caseSensitive
protected String createMissingLabel
protected List<AbstractMenuItem<V,?>> menuItems
protected boolean autoCloseOnSelect
protected final List<AbstractMenu.MenuItemSelectionHandler<V>> selectionHandlers
protected boolean headerVisible
public T setIcon(BaseIcon<?> icon)
icon - Any Icon instance that extends from BaseIconpublic T setTitle(String title)
title - Stringpublic T appendAction(elemental2.dom.HTMLElement element)
element - HTMLElementpublic T appendAction(org.jboss.elemento.IsElement<?> element)
element - IsElementpublic T appendSubHeaderChild(elemental2.dom.HTMLElement element)
element - HTMLElementpublic T appendSunHeaderChild(org.jboss.elemento.IsElement<?> element)
element - IsElementpublic T appendChild(AbstractMenuItem<V,?> menuItem)
menuItem - AbstractMenupublic T removeItem(AbstractMenuItem<V,?> menuItem)
menuItem - AbstractMenupublic T appendSeparator()
public FlexItem<elemental2.dom.HTMLDivElement> getHeadContainer()
FlexItem containing the MenuHeader componentpublic FlexItem<elemental2.dom.HTMLDivElement> getSubHeaderContainer()
FlexItem containing the sub-header the menupublic FlexItem<elemental2.dom.HTMLDivElement> getMainContainer()
FlexItem that wrap this menu items containerpublic elemental2.dom.HTMLDivElement element()
element in interface org.jboss.elemento.IsElement<elemental2.dom.HTMLDivElement>element in class BaseDominoElement<elemental2.dom.HTMLDivElement,T extends AbstractMenu<V,T>>public boolean onSearch(String token)
token - String user input in the SearchBoxpublic String getCreateMissingLabel()
public T setCreateMissingLabel(String createMissingLabel)
createMissingLabel - Stringpublic List<AbstractMenuItem<V,?>> getMenuItems()
AbstractMenuItem of this menupublic DominoElement<elemental2.dom.HTMLLIElement> getNoResultElement()
DominoElement of the HTMLLIElement that is used to represent no
results when search is appliedpublic T setNoResultElement(elemental2.dom.HTMLLIElement noResultElement)
noResultElement - HTMLLIElementpublic T setNoResultElement(org.jboss.elemento.IsElement<elemental2.dom.HTMLLIElement> noResultElement)
noResultElement - IsElement of HTMLLIElementpublic boolean isCaseSensitive()
public T setCaseSensitive(boolean caseSensitive)
public elemental2.dom.HTMLElement getFocusElement()
HTMLElement that should be focused by default when open the menupublic T setFocusElement(elemental2.dom.HTMLElement focusElement)
focusElement - HTMLElementpublic T setFocusElement(org.jboss.elemento.IsElement<? extends elemental2.dom.HTMLElement> focusElement)
focusElement - IsElementpublic FlexItem<elemental2.dom.HTMLDivElement> getSearchContainer()
FlexItem that contains the search box of the menupublic DominoElement<elemental2.dom.HTMLUListElement> getItemsContainer()
DominoElement of the HTMLUListElement that contains the menu items.public KeyboardNavigation<AbstractMenuItem<V,?>> getKeyboardNavigation()
KeyboardNavigation of the menupublic MenuHeader<V,T> getMenuHeader()
MenuHeader component of the menupublic T setHeaderVisible(boolean visible)
visible - boolean, True to show the header, false to hide it.public boolean isSearchable()
public T setSearchable(boolean searchable)
searchable - boolean, true to search box and enable search, false to hide the search box
and disable search.public T setMissingItemHandler(MissingItemHandler<T> missingItemHandler)
missingItemHandler - MissingItemHandlerpublic T select(AbstractMenuItem<V,?> menuItem)
menuItem - AbstractMenuItempublic T select(AbstractMenuItem<V,?> menuItem, boolean silent)
menuItem - AbstractMenuItemsilent - boolean, true to avoid triggering change handlerspublic T selectAt(int index)
index - intpublic T selectAt(int index, boolean silent)
index - intsilent - boolean, true to avoid triggering change handlerspublic T selectByKey(String key)
key - Stringpublic T selectByKey(String key, boolean silent)
key - Stringsilent - boolean, true to avoid triggering change handlerspublic boolean isAutoCloseOnSelect()
public T setAutoCloseOnSelect(boolean autoCloseOnSelect)
autoCloseOnSelect - boolean, if true the menu will close after selecting a menu item
otherwise it remains openpublic T setBordered(boolean bordered)
bordered - boolean, true to show borders, false to remove thempublic T addSelectionHandler(AbstractMenu.MenuItemSelectionHandler<V> selectionHandler)
selectionHandler - AbstractMenu.MenuItemSelectionHandlerpublic T removeSelectionHandler(AbstractMenu.MenuItemSelectionHandler<V> selectionHandler)
selectionHandler - AbstractMenu.MenuItemSelectionHandlerpublic T openSubMenu(AbstractMenu<V,?> dropMenu)
dropMenu - AbstractMenu to openpublic boolean isOpened()
public void open(boolean focus)
focus - true to focus the first elementprotected DropDirection getEffectiveDropDirection()
public elemental2.dom.HTMLElement getTargetElement()
HTMLElement that triggers this menu to open, and which the positioning of
the menu will be based on.public T setTargetElement(org.jboss.elemento.IsElement<?> targetElement)
targetElement - The IsElement that triggers this menu to open, and which the
positioning of the menu will be based on.public T setTargetElement(elemental2.dom.HTMLElement targetElement)
targetElement - The HTMLElement that triggers this menu to open, and which the
positioning of the menu will be based on.public elemental2.dom.HTMLElement getAppendTarget()
HTMLElement to which the menu will be appended to when opened.public T setAppendTarget(elemental2.dom.HTMLElement appendTarget)
HTMLElement to which the menu will be appended to when opened.appendTarget - HTMLElementpublic T open()
public T close()
public DropDirection getDropDirection()
DropDirection of the menupublic T setDropDirection(DropDirection dropDirection)
DropDirection of the menudropDirection - DropDirectionpublic T addCloseHandler(AbstractMenu.CloseHandler closeHandler)
closeHandler - The AbstractMenu.CloseHandler to addpublic T removeCloseHandler(AbstractMenu.CloseHandler closeHandler)
closeHandler - The AbstractMenu.CloseHandler to removepublic T addOpenHandler(AbstractMenu.OpenHandler openHandler)
openHandler - The AbstractMenu.OpenHandler to addpublic T removeOpenHandler(AbstractMenu.OpenHandler openHandler)
openHandler - The AbstractMenu.OpenHandler to removepublic AbstractMenu<?,?> getParent()
AbstractMenu of the menupublic AbstractMenuItem<V,?> getParentItem()
AbstractMenuItem that opens the menupublic boolean isContextMenu()
public T setContextMenu(boolean contextMenu)
contextMenu - booleanm true to make the menu a context menuprotected void onItemSelected(AbstractMenuItem<V,?> item)
public boolean isUseSmallScreensDirection()
public T setUseSmallScreensDirection(boolean useSmallScreensDropDirection)
useSmallScreensDropDirection - boolean, true to allow the switch to small screen middle of
screen position, false to use the provided menu drop directionpublic boolean isDropDown()
Copyright © 2019–2022 Dominokit. All rights reserved.