com.vaadin.flow.component.avatar.
Class AvatarGroup.AvatarGroupItem
All Implemented Interfaces:
Enclosing class:
Item to be set as an avatar for the avatar group.
Author:
Vaadin Ltd
See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new empty avatar group item.
AvatarGroupItem
(String name) Creates a new avatar group item with the provided name.
AvatarGroupItem
(String name, String url) Creates a new avatar group item with the provided name and url.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addClassNames
(String... classNames) Adds one or more class names to this item.
Gets the abbreviation that was set for the avatar.
Gets the CSS class name set on this item.
Gets the color index for the avatar group item.
getImage()
Gets the image url that was set for the avatar.
Gets the image that was set for the avatar.
getName()
Gets the name that was set for the avatar.
void
removeClassNames
(String... classNames) Removes one or more class names from this item.
void
setAbbreviation
(String abbr) Sets the abbreviation for the avatar.
void
setColorIndex
(Integer colorIndex) Sets the color index for the avatar group item.
void
Sets the image url for the avatar.
void
setImageResource
(AbstractStreamResource resource) Sets the image for the avatar.
void
Sets the name for the avatar.
-
Constructor Details
-
AvatarGroupItem
public AvatarGroupItem()Creates a new empty avatar group item.
The avatar displays the user icon in the avatar and "Anonymous" in the tooltip unless overridden by setting other properties.
-
AvatarGroupItem
Creates a new avatar group item with the provided name.
Parameters:
name
- the name for the avatarSee Also:
-
AvatarGroupItem
Creates a new avatar group item with the provided name and url.
Parameters:
name
- the name for the avatarurl
- the image urlSee Also:
-
-
Method Details
-
getName
Gets the name that was set for the avatar.
Returns:
the name
-
setName
Sets the name for the avatar.
The name is displayed in a tooltip on hover.
Automatically deduced abbreviation is displayed in the avatar if no abbreviation or image is set.
Parameters:
name
- the name for the avatar -
getAbbreviation
Gets the abbreviation that was set for the avatar.
Returns:
the abbreviation
-
setAbbreviation
Sets the abbreviation for the avatar.
The abbreviation will be displayed in the avatar if no image has been set.
Parameters:
abbr
- the abbreviation -
getImage
Gets the image url that was set for the avatar.
Returns:
the image url
-
getImageResource
Gets the image that was set for the avatar.
Returns:
the image resource value or
null
if the resource has not been set -
setImage
Sets the image url for the avatar.
The image will be displayed in the avatar even if abbreviation or name is set.
Setting the image with this method resets the image resource provided with
setImageResource(AbstractStreamResource)
Parameters:
url
- the image urlSee Also:
-
setImageResource
Sets the image for the avatar.
Setting the image as a resource with this method resets the image URL that was set with
setImage(String)
Parameters:
resource
- the resource value ornull
to remove the resourceSee Also:
-
getColorIndex
Gets the color index for the avatar group item.
Returns:
the color index or
null
if the index has not been set -
setColorIndex
Sets the color index for the avatar group item.
The color index defines which color will be used for the border of the avatar. Color index N applies CSS variable
--vaadin-user-color-N
to the border.Parameters:
colorIndex
- the color index ornull
to remove the index -
addClassNames
Adds one or more class names to this item. Multiple class names can be specified by using multiple parameters.
Parameters:
classNames
- the class name or class names to be added to the item -
removeClassNames
Removes one or more class names from this item. Multiple class names can be specified by using multiple parameters.
Parameters:
classNames
- the class name or class names to be removed from the item -
getClassName
Gets the CSS class name set on this item.
Returns:
a space-delimited list of CSS class names
-