com.vaadin.flow.component.avatar.
Class AvatarGroup
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.avatar.AvatarGroup
-
All Implemented Interfaces:
AttachNotifier
,DetachNotifier
,HasElement
,HasSize
,HasStyle
,HasTheme
,Serializable
@Tag("vaadin-avatar-group") @NpmPackage(value="@vaadin/polymer-legacy-adapter",version="23.1.15") @NpmPackage(value="@vaadin/avatar-group",version="23.1.15") @NpmPackage(value="@vaadin/vaadin-avatar",version="23.1.15") @JsModule("@vaadin/polymer-legacy-adapter/style-modules.js") @JsModule("@vaadin/avatar-group/src/vaadin-avatar-group.js") public class AvatarGroup extends Component implements HasStyle, HasSize, HasTheme
Avatar Group is used to group multiple Avatars together. It can be used, for example, to show that there are multiple users viewing the same page or for listing members of a project.
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 Classes Modifier and Type Class Description static class
AvatarGroup.AvatarGroupI18n
The internationalization properties for
AvatarGroup
.static class
AvatarGroup.AvatarGroupItem
Item to be set as an avatar for the avatar group.
-
Constructor Summary
Constructors Constructor Description AvatarGroup()
Creates an empty avatar group component.
AvatarGroup(AvatarGroup.AvatarGroupItem... items)
Creates an avatar group with the provided items to be displayed as avatars.
AvatarGroup(Collection<AvatarGroup.AvatarGroupItem> items)
Creates an avatar group with the provided items to be displayed as avatars.
-
Method Summary
All Methods Modifier and Type Method Description void
add(AvatarGroup.AvatarGroupItem... items)
Adds the items to the list of displayed as avatars.
void
addThemeVariants(AvatarGroupVariant... variants)
Adds theme variants to the avatar group component.
AvatarGroup.AvatarGroupI18n
getI18n()
Gets the internationalization object previously set for this component.
List<AvatarGroup.AvatarGroupItem>
getItems()
Gets the items that were set for the avatar group in an unmodifiable list.
Integer
getMaxItemsVisible()
Gets the maximum number of avatars to display, or
null
if no limit has been set.void
remove(AvatarGroup.AvatarGroupItem... items)
Removes the items from the list of displayed as avatars.
void
removeThemeVariants(AvatarGroupVariant... variants)
Removes theme variants from the avatar group component.
void
setI18n(AvatarGroup.AvatarGroupI18n i18n)
Sets the internationalization properties for this component.
void
setItems(AvatarGroup.AvatarGroupItem... items)
Sets the items that will be displayed as avatars.
void
setItems(Collection<AvatarGroup.AvatarGroupItem> items)
Sets the items that will be displayed as avatars.
void
setMaxItemsVisible(Integer max)
Sets the the maximum number of avatars to display.
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, scrollIntoView, set, setElement, setId, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
-
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
-
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
-
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Methods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
-
-
-
-
Constructor Detail
-
AvatarGroup
public AvatarGroup()
Creates an empty avatar group component.
-
AvatarGroup
public AvatarGroup(Collection<AvatarGroup.AvatarGroupItem> items)
Creates an avatar group with the provided items to be displayed as avatars.
-
AvatarGroup
public AvatarGroup(AvatarGroup.AvatarGroupItem... items)
Creates an avatar group with the provided items to be displayed as avatars.
-
-
Method Detail
-
setItems
public void setItems(Collection<AvatarGroup.AvatarGroupItem> items)
Sets the items that will be displayed as avatars.
Parameters:
items
- the items to set
-
setItems
public void setItems(AvatarGroup.AvatarGroupItem... items)
Sets the items that will be displayed as avatars.
Parameters:
items
- the items to set
-
add
public void add(AvatarGroup.AvatarGroupItem... items)
Adds the items to the list of displayed as avatars.
Parameters:
items
- the items to add
-
remove
public void remove(AvatarGroup.AvatarGroupItem... items)
Removes the items from the list of displayed as avatars.
Parameters:
items
- the items to remove
-
getItems
public List<AvatarGroup.AvatarGroupItem> getItems()
Gets the items that were set for the avatar group in an unmodifiable list.
Returns:
list of items
-
getI18n
public AvatarGroup.AvatarGroupI18n getI18n()
Gets the internationalization object previously set for this component.
Note: updating the object content that is gotten from this method will not update the lang on the component if not set back using
setI18n(AvatarGroupI18n)
Returns:
the i18n object. It will be
null
, If the i18n properties weren't set.
-
setI18n
public void setI18n(AvatarGroup.AvatarGroupI18n i18n)
Sets the internationalization properties for this component.
Parameters:
i18n
- the internationalized properties, notnull
-
setMaxItemsVisible
public void setMaxItemsVisible(Integer max)
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, ornull
to remove the limit
-
getMaxItemsVisible
public Integer getMaxItemsVisible()
Gets the maximum number of avatars to display, or
null
if no limit has been set.Returns:
the max number of avatars
See Also:
-
addThemeVariants
public void addThemeVariants(AvatarGroupVariant... variants)
Adds theme variants to the avatar group component.
Parameters:
variants
- theme variants to add
-
removeThemeVariants
public void removeThemeVariants(AvatarGroupVariant... variants)
Removes theme variants from the avatar group component.
Parameters:
variants
- theme variants to remove
-
-