public class DropDownMenu extends BaseDominoElement<elemental2.dom.HTMLDivElement,DropDownMenu> implements HasBackground<DropDownMenu>
The menu can have different actions and can be placed at specific position
Customize the component can be done by overwriting classes provided by DropDownStyles
For example:
DropDownMenu.create(element)
.addAction(DropdownAction.create("action 1"))
.open();
BaseDominoElement,
HasBackground| Modifier and Type | Class and Description |
|---|---|
static interface |
DropDownMenu.CloseHandler
A handler that will be called when closing the menu
|
static interface |
DropDownMenu.OnAdd
A handler that will be called when adding a new action
|
static interface |
DropDownMenu.OpenHandler
A handler that will be called when opening the menu
|
static interface |
DropDownMenu.SearchFilter
The search filter strategy which will filter the actions based on the search criteria
|
BaseDominoElement.ElementHandler<T>, BaseDominoElement.ResizeHandler<T>, BaseDominoElement.StyleEditor<E extends elemental2.dom.HTMLElement,T extends org.jboss.elemento.IsElement<E>>, BaseDominoElement.WavesStyler| Constructor and Description |
|---|
DropDownMenu(elemental2.dom.HTMLElement targetElement) |
| Modifier and Type | Method and Description |
|---|---|
DropDownMenu |
addAction(DropdownAction<?> action)
Deprecated.
|
DropDownMenu |
addCloseHandler(DropDownMenu.CloseHandler closeHandler)
Adds a close handler to be called when the menu is closed
|
DropDownMenu |
addGroup(DropdownActionsGroup<?> group)
Adds new group of actions to this menu as a one unit
|
DropDownMenu |
addOpenHandler(DropDownMenu.OpenHandler openHandler)
Adds an open handler to be called when the menu is opened
|
DropDownMenu |
appendChild(DropdownAction<?> action)
Adds an action
|
DropDownMenu |
appendChild(elemental2.dom.Node child) |
DropDownMenu |
clearActions()
Clears all the actions
|
void |
clearSearch()
Clears the current search
|
void |
close()
Closes the menu
|
static void |
closeAllMenus()
Closes all current opened menus
|
static DropDownMenu |
create(elemental2.dom.HTMLElement targetElement)
Creates drop down menu relative to
targetElement. |
static DropDownMenu |
create(org.jboss.elemento.IsElement<?> targetElement)
Same as
create(HTMLElement) but accepts a wrapper IsElement |
elemental2.dom.HTMLDivElement |
element() |
void |
focus()
Sets focus at the first element of the menu
|
List<DropdownAction<?>> |
getActions() |
AppendStrategy |
getAppendStrategy() |
elemental2.dom.HTMLElement |
getAppendTarget() |
List<DropdownAction<?>> |
getFilteredAction() |
DominoElement<elemental2.dom.HTMLUListElement> |
getMenuElement() |
DominoElement<elemental2.dom.HTMLElement> |
getNoSearchResultsElement() |
DominoElement<elemental2.dom.HTMLDivElement> |
getSearchContainer() |
DropDownMenu.SearchFilter |
getSearchFilter() |
boolean |
hasActions() |
DropDownMenu |
insertFirst(DropdownAction<?> action)
Inserts an action at the first index
|
boolean |
isCaseSensitiveSearch() |
boolean |
isOpened() |
void |
open()
Opens the menu
|
void |
open(boolean focus)
Opens the menu with a boolean to indicate if the first element should be focused
|
DropDownMenu |
removeCloseHandler(DropDownMenu.CloseHandler closeHandler)
Removes a close handler
|
DropDownMenu |
removeOpenHandler(DropDownMenu.OpenHandler openHandler)
Removes an open handler
|
DropDownMenu |
selectAt(int index)
Focuses an action at a specific
index |
DropDownMenu |
separator()
Adds a separator element
|
DropDownMenu |
setAppendStrategy(AppendStrategy appendStrategy)
Sets the strategy for adding the menu to the target element.
|
DropDownMenu |
setAppendTarget(elemental2.dom.HTMLElement appendTarget)
Sets the target element for this menu that will be positioned according to its location
|
DropDownMenu |
setBackground(Color background) |
void |
setCaseSensitiveSearch(boolean caseSensitiveSearch)
Sets if the search is case sensitive
|
DropDownMenu |
setCreatable(boolean creatable)
Sets if the menu accepts creating new actions on the fly.
|
DropDownMenu |
setNoMatchSearchResultText(String text)
Set the text which is displayed in case nothing is found at a searchable
DropDownMenu
Default is "No results matched". |
void |
setNoSearchResultsElement(elemental2.dom.HTMLElement noSearchResultsElement)
Sets the no search result element which will be shown when there is no results found according
to the search criteria
|
DropDownMenu |
setOnAddListener(DropDownMenu.OnAdd onAdd)
Adds a listener that will be called when a new action is added
|
DropDownMenu |
setPosition(DropDownPosition position)
Sets the position of the menu
|
DropDownMenu |
setSearchable(boolean searchable)
Sets if the menu is searchable or not.
|
DropDownMenu |
setSearchFilter(DropDownMenu.SearchFilter searchFilter)
Sets the search filter strategy that will be called to filter the actions based on the search
value
|
DropDownMenu |
setTitle(String title)
Sets the title of this menu
|
add, add, addClickListener, addCss, addCss, addEventListener, addEventListener, addEventsListener, addHideListener, addShowListener, alignCenter, alignRight, 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, setPropertypublic List<DropdownAction<?>> getFilteredAction()
DropdownAction filtered based on the search criteriapublic static void closeAllMenus()
public static DropDownMenu create(elemental2.dom.HTMLElement targetElement)
targetElement.
The target element will be used to position the menu according to its location
targetElement - The target HTMLElementpublic static DropDownMenu create(org.jboss.elemento.IsElement<?> targetElement)
create(HTMLElement) but accepts a wrapper IsElementtargetElement - The IsElementpublic DropDownMenu insertFirst(DropdownAction<?> action)
action - The DropdownAction to addpublic DropDownMenu appendChild(DropdownAction<?> action)
action - The DropdownAction to add@Deprecated public DropDownMenu addAction(DropdownAction<?> action)
appendChild(DropdownAction) insteadpublic DropDownMenu separator()
public DropDownMenu appendChild(elemental2.dom.Node child)
appendChild in interface HasChildren<DropDownMenu>appendChild in class BaseDominoElement<elemental2.dom.HTMLDivElement,DropDownMenu>child - Node to be appended to the componentpublic void close()
public void open()
public void open(boolean focus)
focus - true to focus the first elementpublic void clearSearch()
public boolean isOpened()
public DropDownMenu setPosition(DropDownPosition position)
position - The new DropDownPositionpublic elemental2.dom.HTMLDivElement element()
element in interface org.jboss.elemento.IsElement<elemental2.dom.HTMLDivElement>element in class BaseDominoElement<elemental2.dom.HTMLDivElement,DropDownMenu>public DropDownMenu clearActions()
public boolean hasActions()
public DropDownMenu selectAt(int index)
indexindex - the index of the actionpublic DropDownMenu addCloseHandler(DropDownMenu.CloseHandler closeHandler)
closeHandler - The DropDownMenu.CloseHandler to addpublic DropDownMenu removeCloseHandler(DropDownMenu.CloseHandler closeHandler)
closeHandler - The DropDownMenu.CloseHandler to removepublic DropDownMenu addOpenHandler(DropDownMenu.OpenHandler openHandler)
openHandler - The DropDownMenu.OpenHandler to addpublic DropDownMenu removeOpenHandler(DropDownMenu.OpenHandler openHandler)
openHandler - The DropDownMenu.OpenHandler to removepublic List<DropdownAction<?>> getActions()
public DropDownMenu setSearchable(boolean searchable)
searchable - true if this menu is searchable, false otherwisepublic DropDownMenu setCreatable(boolean creatable)
By configuring the menu as creatable means that the user can create a new action by setting the action text and then adding it directly to the actions list
creatable - true if the menu accepts creating new actions on the fly, false otherwisepublic DropDownMenu setNoMatchSearchResultText(String text)
DropDownMenu
Default is "No results matched".text - the new textpublic DropDownMenu setOnAddListener(DropDownMenu.OnAdd onAdd)
onAdd - the DropDownMenu.OnAdd listener to addpublic DropDownMenu addGroup(DropdownActionsGroup<?> group)
group - the DropdownActionsGroup to addpublic DropDownMenu setTitle(String title)
title - the title textpublic DropDownMenu setAppendTarget(elemental2.dom.HTMLElement appendTarget)
appendTarget - the new target elementpublic elemental2.dom.HTMLElement getAppendTarget()
public DropDownMenu setAppendStrategy(AppendStrategy appendStrategy)
appendStrategy - the AppendStrategypublic AppendStrategy getAppendStrategy()
AppendStrategypublic DominoElement<elemental2.dom.HTMLElement> getNoSearchResultsElement()
public void setNoSearchResultsElement(elemental2.dom.HTMLElement noSearchResultsElement)
noSearchResultsElement - the new no search results elementpublic boolean isCaseSensitiveSearch()
public void setCaseSensitiveSearch(boolean caseSensitiveSearch)
caseSensitiveSearch - true if search is case sensitive, false otherwisepublic DominoElement<elemental2.dom.HTMLUListElement> getMenuElement()
public DropDownMenu setBackground(Color background)
setBackground in interface HasBackground<DropDownMenu>background - Colorpublic DominoElement<elemental2.dom.HTMLDivElement> getSearchContainer()
public void focus()
public DropDownMenu.SearchFilter getSearchFilter()
public DropDownMenu setSearchFilter(DropDownMenu.SearchFilter searchFilter)
searchFilter - The new DropDownMenu.SearchFilterCopyright © 2019–2022 Dominokit. All rights reserved.