Class AbstractDropdownButton
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<JmixMenuBar>
io.jmix.flowui.kit.component.dropdownbutton.AbstractDropdownButton
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<AbstractDropdownButton>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<AbstractDropdownButton>,com.vaadin.flow.component.FocusNotifier<AbstractDropdownButton>,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasText,com.vaadin.flow.component.HasTheme,com.vaadin.flow.component.shared.HasOverlayClassName,DropdownButtonComponent,HasSubParts,HasTitle,Serializable
- Direct Known Subclasses:
ComboButton,DropdownButton
public abstract class AbstractDropdownButton
extends com.vaadin.flow.component.Composite<JmixMenuBar>
implements DropdownButtonComponent, com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, HasTitle, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.shared.HasOverlayClassName, com.vaadin.flow.component.HasText, com.vaadin.flow.component.Focusable<AbstractDropdownButton>
An abstract base class for dropdown button components, providing functionality for managing dropdown items,
icons, styles, and various component behaviors. It serves as a customizable foundation for components such
as dropdown buttons and combo buttons.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classprotected static classprotected static interfaceprotected static interfaceprotected static classBlank item needed for correct insertion by index.protected static classNested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText
com.vaadin.flow.component.HasText.WhiteSpace -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected JmixMenuItemprotected com.vaadin.flow.component.icon.Iconprotected List<AbstractDropdownButton.HasMenuItem> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddAttachListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.AttachEvent> listener) voidaddClassName(String className) voidaddClassNames(String... classNames) com.vaadin.flow.shared.RegistrationaddDetachListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.DetachEvent> listener) com.vaadin.flow.component.ShortcutRegistrationaddFocusShortcut(com.vaadin.flow.component.Key key, com.vaadin.flow.component.KeyModifier... keyModifiers) Adds a new dropdown item with the specified identifier and component content.Adds a new dropdown item with the specified identifier, component content, and position index.addItem(String id, com.vaadin.flow.component.Component component, Consumer<DropdownButtonItem.ClickEvent> componentEventListener) Adds a new dropdown item with the specified identifier, content component, and a click event listener.addItem(String id, com.vaadin.flow.component.Component component, Consumer<DropdownButtonItem.ClickEvent> componentEventListener, int index) Adds a new dropdown item with the specified identifier, component content, click event listener, and position index.Adds a new dropdown item with the specified identifier and action.Adds a new dropdown item with the specified identifier, action, and index.Adds a new dropdown item with the specified identifier and text.Adds a new dropdown item with the specified identifier, text, and index.addItem(String id, String text, Consumer<DropdownButtonItem.ClickEvent> componentEventListener) Adds a new dropdown item with the specified identifier, text, and a click event listener.addItem(String id, String text, Consumer<DropdownButtonItem.ClickEvent> componentEventListener, int index) Adds a new dropdown item with the specified identifier, text, click event listener, and position index.protected voidaddItemInternal(AbstractDropdownButton.HasMenuItem item, int index) voidAdds a visual separator to the dropdown menu.voidaddSeparatorAtIndex(int index) Adds a visual separator at the specified index in the dropdown menu.voidaddThemeName(String themeName) voidaddThemeNames(String... themeNames) voidblur()protected com.vaadin.flow.component.contextmenu.MenuItemcreateComponentMenuItem(String id, com.vaadin.flow.component.Component content, int index) protected com.vaadin.flow.component.contextmenu.MenuItemcreateTextMenuItem(String id, String text, int index) voidfocus()com.vaadin.flow.dom.ClassListprotected abstract JmixMenuItemOptional<com.vaadin.flow.component.Unit>com.vaadin.flow.component.icon.IcongetIcon()Returns the icon associated with the dropdown button item, if present.Returns the dropdown item with the specified identifier.getItems()Returns a list of all items currently present in the dropdown button component.intcom.vaadin.flow.dom.ThemeListgetWidth()Optional<com.vaadin.flow.component.Unit>booleanhasClassName(String className) booleanhasThemeName(String themeName) booleanbooleanbooleanDetermines whether the dropdown menu is configured to open when the user hovers over the component.voidremove(DropdownButtonItem item) Removes the specified item from the collection or list.voidremove(DropdownButtonItem... items) Removes the specified items from the dropdown button's list of items.voidRemoves the specified item identified by the given item ID.voidRemoves all items from the dropdown button component.booleanremoveClassName(String className) voidremoveClassNames(String... classNames) booleanremoveThemeName(String themeName) voidremoveThemeNames(String... themeNames) voidsetClassName(String className) voidsetClassName(String className, boolean set) voidsetEnabled(boolean enabled) voidsetHeight(float height, com.vaadin.flow.component.Unit unit) voidvoidvoidsetMaxHeight(float maxHeight, com.vaadin.flow.component.Unit unit) voidsetMaxHeight(String maxHeight) voidsetMaxWidth(float maxWidth, com.vaadin.flow.component.Unit unit) voidsetMaxWidth(String maxWidth) voidsetMinHeight(float minHeight, com.vaadin.flow.component.Unit unit) voidsetMinHeight(String minHeight) voidsetMinWidth(float minWidth, com.vaadin.flow.component.Unit unit) voidsetMinWidth(String minWidth) voidsetOpenOnHover(boolean openOnHover) Configures whether the dropdown menu opens when the user hovers over the button.voidsetOverlayClassName(String overlayClassName) voidvoidvoidsetTabIndex(int tabIndex) voidsetThemeName(String themeName) voidsetThemeName(String themeName, boolean set) voidsetWidth(float width, com.vaadin.flow.component.Unit unit) voidvoidMethods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement, initContentMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface io.jmix.flowui.kit.component.dropdownbutton.DropdownButtonComponent
getSubPart, setIconMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasStyle
getStyleMethods inherited from interface com.vaadin.flow.component.HasText
getText, getWhiteSpace, setText, setWhiteSpace
-
Field Details
-
ATTRIBUTE_JMIX_ROLE_NAME
- See Also:
-
items
-
dropdownItem
-
iconComponent
protected com.vaadin.flow.component.icon.Icon iconComponent
-
-
Constructor Details
-
AbstractDropdownButton
public AbstractDropdownButton()
-
-
Method Details
-
getDropdownItem
-
addItem
Description copied from interface:DropdownButtonComponentAdds a new dropdown item with the specified identifier and action.- Specified by:
addItemin interfaceDropdownButtonComponent- Parameters:
id- the identifier for the dropdown itemaction- the action to associate with the dropdown item- Returns:
- the created dropdown item
-
addItem
Description copied from interface:DropdownButtonComponentAdds a new dropdown item with the specified identifier, action, and index.- Specified by:
addItemin interfaceDropdownButtonComponent- Parameters:
id- the identifier for the dropdown itemaction- the action to associate with the dropdown itemindex- the position at which the dropdown item will be added- Returns:
- the created dropdown item
-
addItem
Description copied from interface:DropdownButtonComponentAdds a new dropdown item with the specified identifier and text.- Specified by:
addItemin interfaceDropdownButtonComponent- Parameters:
id- the identifier for the dropdown itemtext- the text to display for the dropdown item- Returns:
- the created dropdown item
-
addItem
Description copied from interface:DropdownButtonComponentAdds a new dropdown item with the specified identifier, text, and index.- Specified by:
addItemin interfaceDropdownButtonComponent- Parameters:
id- the identifier for the dropdown itemtext- the text to display for the dropdown itemindex- the position at which the dropdown item will be added- Returns:
- the created dropdown item
-
addItem
public DropdownButtonItem addItem(String id, String text, Consumer<DropdownButtonItem.ClickEvent> componentEventListener) Description copied from interface:DropdownButtonComponentAdds a new dropdown item with the specified identifier, text, and a click event listener.- Specified by:
addItemin interfaceDropdownButtonComponent- Parameters:
id- the unique identifier for the dropdown itemtext- the text displayed for the dropdown itemcomponentEventListener- the listener to handle click events for the dropdown item- Returns:
- the created dropdown item instance
-
addItem
public DropdownButtonItem addItem(String id, String text, Consumer<DropdownButtonItem.ClickEvent> componentEventListener, int index) Description copied from interface:DropdownButtonComponentAdds a new dropdown item with the specified identifier, text, click event listener, and position index.- Specified by:
addItemin interfaceDropdownButtonComponent- Parameters:
id- the unique identifier for the dropdown itemtext- the text to display for the dropdown itemcomponentEventListener- the listener to handle click events for the dropdown itemindex- the position at which the dropdown item will be added- Returns:
- the created dropdown item instance
-
addItem
Description copied from interface:DropdownButtonComponentAdds a new dropdown item with the specified identifier and component content.- Specified by:
addItemin interfaceDropdownButtonComponent- Parameters:
id- the unique identifier for the dropdown itemcomponent- the component to be used as content for the dropdown item- Returns:
- the created dropdown item instance
-
addItem
public DropdownButtonItem addItem(String id, com.vaadin.flow.component.Component component, int index) Description copied from interface:DropdownButtonComponentAdds a new dropdown item with the specified identifier, component content, and position index.- Specified by:
addItemin interfaceDropdownButtonComponent- Parameters:
id- the unique identifier for the dropdown itemcomponent- the component to be used as content for the dropdown itemindex- the position at which the dropdown item will be added- Returns:
- the created dropdown item instance
-
addItem
public DropdownButtonItem addItem(String id, com.vaadin.flow.component.Component component, Consumer<DropdownButtonItem.ClickEvent> componentEventListener) Description copied from interface:DropdownButtonComponentAdds a new dropdown item with the specified identifier, content component, and a click event listener.- Specified by:
addItemin interfaceDropdownButtonComponent- Parameters:
id- the unique identifier for the dropdown itemcomponent- the component to be used as content for the dropdown itemcomponentEventListener- the listener to handle click events for the dropdown item- Returns:
- the created dropdown item instance
-
addItem
public DropdownButtonItem addItem(String id, com.vaadin.flow.component.Component component, Consumer<DropdownButtonItem.ClickEvent> componentEventListener, int index) Description copied from interface:DropdownButtonComponentAdds a new dropdown item with the specified identifier, component content, click event listener, and position index.- Specified by:
addItemin interfaceDropdownButtonComponent- Parameters:
id- the unique identifier for the dropdown itemcomponent- the component to be used as content for the dropdown itemcomponentEventListener- the listener to handle click events for the dropdown itemindex- the position at which the dropdown item will be added- Returns:
- the created dropdown item instance
-
createComponentMenuItem
protected com.vaadin.flow.component.contextmenu.MenuItem createComponentMenuItem(String id, com.vaadin.flow.component.Component content, int index) -
createTextMenuItem
-
addItemInternal
-
getItem
Description copied from interface:DropdownButtonComponentReturns the dropdown item with the specified identifier.- Specified by:
getItemin interfaceDropdownButtonComponent- Parameters:
itemId- the unique identifier of the dropdown item to retrieve- Returns:
- the item with the given identifier, or
nullif no item with the specified ID is found
-
getItems
Description copied from interface:DropdownButtonComponentReturns a list of all items currently present in the dropdown button component.- Specified by:
getItemsin interfaceDropdownButtonComponent- Returns:
- a list of
DropdownButtonIteminstances representing all items in the dropdown.
-
remove
Description copied from interface:DropdownButtonComponentRemoves the specified item identified by the given item ID.- Specified by:
removein interfaceDropdownButtonComponent- Parameters:
itemId- the unique identifier of the item to be removed
-
remove
Description copied from interface:DropdownButtonComponentRemoves the specified item from the collection or list.- Specified by:
removein interfaceDropdownButtonComponent- Parameters:
item- the item to be removed
-
remove
Description copied from interface:DropdownButtonComponentRemoves the specified items from the dropdown button's list of items.- Specified by:
removein interfaceDropdownButtonComponent- Parameters:
items- the items to be removed from the dropdown button. Each item represents a DropdownButtonItem object to be excluded from the list.
-
removeAll
public void removeAll()Description copied from interface:DropdownButtonComponentRemoves all items from the dropdown button component.- Specified by:
removeAllin interfaceDropdownButtonComponent
-
addSeparator
public void addSeparator()Description copied from interface:DropdownButtonComponentAdds a visual separator to the dropdown menu. Separators are used to group related items visually.- Specified by:
addSeparatorin interfaceDropdownButtonComponent
-
addSeparatorAtIndex
public void addSeparatorAtIndex(int index) Description copied from interface:DropdownButtonComponentAdds a visual separator at the specified index in the dropdown menu. Separators are used to visually group related items within the menu.- Specified by:
addSeparatorAtIndexin interfaceDropdownButtonComponent- Parameters:
index- the position at which the separator will be added. The index must be a non-negative integer less than or equal to the current number of items.
-
addAttachListener
public com.vaadin.flow.shared.Registration addAttachListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.AttachEvent> listener) - Specified by:
addAttachListenerin interfacecom.vaadin.flow.component.AttachNotifier
-
isAttached
public boolean isAttached()- Overrides:
isAttachedin classcom.vaadin.flow.component.Component
-
addDetachListener
public com.vaadin.flow.shared.Registration addDetachListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.DetachEvent> listener) - Specified by:
addDetachListenerin interfacecom.vaadin.flow.component.DetachNotifier
-
getIcon
@Nullable public com.vaadin.flow.component.icon.Icon getIcon()Description copied from interface:DropdownButtonComponentReturns the icon associated with the dropdown button item, if present.- Specified by:
getIconin interfaceDropdownButtonComponent- Returns:
- the icon of the dropdown button item, or
nullif no icon is set
-
setClassName
- Specified by:
setClassNamein interfacecom.vaadin.flow.component.HasStyle
-
setClassName
- Specified by:
setClassNamein interfacecom.vaadin.flow.component.HasStyle
-
getClassName
- Specified by:
getClassNamein interfacecom.vaadin.flow.component.HasStyle
-
addClassName
- Specified by:
addClassNamein interfacecom.vaadin.flow.component.HasStyle
-
removeClassName
- Specified by:
removeClassNamein interfacecom.vaadin.flow.component.HasStyle
-
getClassNames
public com.vaadin.flow.dom.ClassList getClassNames()- Specified by:
getClassNamesin interfacecom.vaadin.flow.component.HasStyle
-
addClassNames
- Specified by:
addClassNamesin interfacecom.vaadin.flow.component.HasStyle
-
removeClassNames
- Specified by:
removeClassNamesin interfacecom.vaadin.flow.component.HasStyle
-
hasClassName
- Specified by:
hasClassNamein interfacecom.vaadin.flow.component.HasStyle
-
getOverlayClassName
- Specified by:
getOverlayClassNamein interfacecom.vaadin.flow.component.shared.HasOverlayClassName
-
setOverlayClassName
- Specified by:
setOverlayClassNamein interfacecom.vaadin.flow.component.shared.HasOverlayClassName
-
setThemeName
- Specified by:
setThemeNamein interfacecom.vaadin.flow.component.HasTheme
-
setThemeName
- Specified by:
setThemeNamein interfacecom.vaadin.flow.component.HasTheme
-
getThemeName
- Specified by:
getThemeNamein interfacecom.vaadin.flow.component.HasTheme
-
addThemeName
- Specified by:
addThemeNamein interfacecom.vaadin.flow.component.HasTheme
-
removeThemeName
- Specified by:
removeThemeNamein interfacecom.vaadin.flow.component.HasTheme
-
hasThemeName
- Specified by:
hasThemeNamein interfacecom.vaadin.flow.component.HasTheme
-
getThemeNames
public com.vaadin.flow.dom.ThemeList getThemeNames()- Specified by:
getThemeNamesin interfacecom.vaadin.flow.component.HasTheme
-
addThemeNames
- Specified by:
addThemeNamesin interfacecom.vaadin.flow.component.HasTheme
-
removeThemeNames
- Specified by:
removeThemeNamesin interfacecom.vaadin.flow.component.HasTheme
-
setOpenOnHover
public void setOpenOnHover(boolean openOnHover) Description copied from interface:DropdownButtonComponentConfigures whether the dropdown menu opens when the user hovers over the button.- Specified by:
setOpenOnHoverin interfaceDropdownButtonComponent- Parameters:
openOnHover- iftrue, the dropdown menu will open on hover; iffalse, it will only open on click
-
isOpenOnHover
public boolean isOpenOnHover()Description copied from interface:DropdownButtonComponentDetermines whether the dropdown menu is configured to open when the user hovers over the component.- Specified by:
isOpenOnHoverin interfaceDropdownButtonComponent- Returns:
trueif the dropdown opens on hover,falseotherwise
-
setEnabled
public void setEnabled(boolean enabled) - Specified by:
setEnabledin interfacecom.vaadin.flow.component.HasEnabled
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfacecom.vaadin.flow.component.HasEnabled
-
setTabIndex
public void setTabIndex(int tabIndex) - Specified by:
setTabIndexin interfacecom.vaadin.flow.component.Focusable<AbstractDropdownButton>
-
getTabIndex
public int getTabIndex()- Specified by:
getTabIndexin interfacecom.vaadin.flow.component.Focusable<AbstractDropdownButton>
-
focus
public void focus()- Specified by:
focusin interfacecom.vaadin.flow.component.Focusable<AbstractDropdownButton>
-
blur
public void blur()- Specified by:
blurin interfacecom.vaadin.flow.component.Focusable<AbstractDropdownButton>
-
addFocusShortcut
public com.vaadin.flow.component.ShortcutRegistration addFocusShortcut(com.vaadin.flow.component.Key key, com.vaadin.flow.component.KeyModifier... keyModifiers) - Specified by:
addFocusShortcutin interfacecom.vaadin.flow.component.Focusable<AbstractDropdownButton>
-
setWidth
- Specified by:
setWidthin interfacecom.vaadin.flow.component.HasSize
-
setWidth
public void setWidth(float width, com.vaadin.flow.component.Unit unit) - Specified by:
setWidthin interfacecom.vaadin.flow.component.HasSize
-
setMinWidth
- Specified by:
setMinWidthin interfacecom.vaadin.flow.component.HasSize
-
setMinWidth
public void setMinWidth(float minWidth, com.vaadin.flow.component.Unit unit) - Specified by:
setMinWidthin interfacecom.vaadin.flow.component.HasSize
-
setMaxWidth
- Specified by:
setMaxWidthin interfacecom.vaadin.flow.component.HasSize
-
setMaxWidth
public void setMaxWidth(float maxWidth, com.vaadin.flow.component.Unit unit) - Specified by:
setMaxWidthin interfacecom.vaadin.flow.component.HasSize
-
getWidth
- Specified by:
getWidthin interfacecom.vaadin.flow.component.HasSize
-
getMinWidth
- Specified by:
getMinWidthin interfacecom.vaadin.flow.component.HasSize
-
getMaxWidth
- Specified by:
getMaxWidthin interfacecom.vaadin.flow.component.HasSize
-
getWidthUnit
- Specified by:
getWidthUnitin interfacecom.vaadin.flow.component.HasSize
-
setHeight
- Specified by:
setHeightin interfacecom.vaadin.flow.component.HasSize
-
setHeight
public void setHeight(float height, com.vaadin.flow.component.Unit unit) - Specified by:
setHeightin interfacecom.vaadin.flow.component.HasSize
-
setMinHeight
- Specified by:
setMinHeightin interfacecom.vaadin.flow.component.HasSize
-
setMinHeight
public void setMinHeight(float minHeight, com.vaadin.flow.component.Unit unit) - Specified by:
setMinHeightin interfacecom.vaadin.flow.component.HasSize
-
setMaxHeight
- Specified by:
setMaxHeightin interfacecom.vaadin.flow.component.HasSize
-
setMaxHeight
public void setMaxHeight(float maxHeight, com.vaadin.flow.component.Unit unit) - Specified by:
setMaxHeightin interfacecom.vaadin.flow.component.HasSize
-
getHeight
- Specified by:
getHeightin interfacecom.vaadin.flow.component.HasSize
-
getMinHeight
- Specified by:
getMinHeightin interfacecom.vaadin.flow.component.HasSize
-
getMaxHeight
- Specified by:
getMaxHeightin interfacecom.vaadin.flow.component.HasSize
-
getHeightUnit
- Specified by:
getHeightUnitin interfacecom.vaadin.flow.component.HasSize
-
setSizeFull
public void setSizeFull()- Specified by:
setSizeFullin interfacecom.vaadin.flow.component.HasSize
-
setWidthFull
public void setWidthFull()- Specified by:
setWidthFullin interfacecom.vaadin.flow.component.HasSize
-
setHeightFull
public void setHeightFull()- Specified by:
setHeightFullin interfacecom.vaadin.flow.component.HasSize
-
setSizeUndefined
public void setSizeUndefined()- Specified by:
setSizeUndefinedin interfacecom.vaadin.flow.component.HasSize
-