Class AvatarGroup
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasTheme,com.vaadin.flow.component.shared.HasThemeVariant<AvatarGroupVariant>,Serializable
You can specify the max number of items an Avatar Group should display. Items that overflow are grouped into a single Avatar that displays the overflow count. The name of each hidden item is shown on hover in a tooltip. Clicking the overflow item displays the overflowing avatars and names in a list.
- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe internationalization properties forAvatarGroup.static classItem to be set as an avatar for the avatar group. -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty avatar group component.AvatarGroup(AvatarGroup.AvatarGroupItem... items) Creates an avatar group with the provided items to be displayed as avatars.AvatarGroup(com.vaadin.flow.signals.Signal<List<S>> itemsSignal) Creates an avatar group with the provided signal bound to the items.Creates an avatar group with the provided items to be displayed as avatars. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(AvatarGroup.AvatarGroupItem... items) Adds the items to the list of displayed as avatars.<S extends com.vaadin.flow.signals.Signal<AvatarGroup.AvatarGroupItem>>
voidBinds the given signal to the items of the avatar group as a one-way binding so that the rendered avatars are updated when the signal's value or any individual item signal changes.getI18n()Gets the internationalization object previously set for this component.getItems()Gets the items that were set for the avatar group in an unmodifiable list.Gets the maximum number of avatars to display, ornullif no limit has been set.voidremove(AvatarGroup.AvatarGroupItem... items) Removes the items from the list of displayed as avatars.voidSets the internationalization object for this component.voidsetItems(AvatarGroup.AvatarGroupItem... items) Sets the items that will be displayed as avatars.voidSets the items that will be displayed as avatars.voidSets the the maximum number of avatars to display.Methods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, 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.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasSize
bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, bindThemeName, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, bindThemeVariant, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariants
-
Constructor Details
-
AvatarGroup
public AvatarGroup()Creates an empty avatar group component. -
AvatarGroup
Creates an avatar group with the provided items to be displayed as avatars.- Parameters:
items- the items to be displayed
-
AvatarGroup
Creates an avatar group with the provided items to be displayed as avatars.- Parameters:
items- the items to be displayed
-
AvatarGroup
Creates an avatar group with the provided signal bound to the items.The rendered avatars are updated when the signal's value or any individual item signal changes.
- Type Parameters:
S- the type of signal holding individual items- Parameters:
itemsSignal- the signal to bind the items to, notnull- Since:
- 25.1
- See Also:
-
-
Method Details
-
setItems
Sets the items that will be displayed as avatars.- Parameters:
items- the items to set
-
setItems
Sets the items that will be displayed as avatars.- Parameters:
items- the items to set
-
add
Adds the items to the list of displayed as avatars.- Parameters:
items- the items to add
-
remove
Removes the items from the list of displayed as avatars.- Parameters:
items- the items to remove
-
getItems
Gets the items that were set for the avatar group in an unmodifiable list.- Returns:
- list of items
-
bindItems
public <S extends com.vaadin.flow.signals.Signal<AvatarGroup.AvatarGroupItem>> void bindItems(com.vaadin.flow.signals.Signal<List<S>> itemsSignal) Binds the given signal to the items of the avatar group as a one-way binding so that the rendered avatars are updated when the signal's value or any individual item signal changes.When a signal is bound, the items are kept synchronized with the signal value while the component is attached. When the component is detached, signal value changes have no effect.
While a signal is bound, any attempt to modify items manually through
setItems(Collection),add(AvatarGroupItem...), orremove(AvatarGroupItem...)throws aBindingActiveException.- Type Parameters:
S- the type of signal holding individual items- Parameters:
itemsSignal- the signal to bind the items to, notnull- Since:
- 25.1
-
getI18n
Gets the internationalization object previously set for this component.NOTE: Updating the instance that is returned from this method will not update the component if not set again using
setI18n(AvatarGroupI18n)- Returns:
- the i18n object or
nullif no i18n object has been set
-
setI18n
Sets the internationalization object for this component.- Parameters:
i18n- the i18n object, notnull
-
setMaxItemsVisible
Sets the the maximum number of avatars to display.By default, all the avatars are displayed. When max is set, the overflowing avatars are grouped into one avatar.
- Parameters:
max- the maximum number of avatars, ornullto remove the limit
-
getMaxItemsVisible
Gets the maximum number of avatars to display, ornullif no limit has been set.- Returns:
- the max number of avatars
- See Also:
-