Class AvatarGroup.AvatarGroupItem
- All Implemented Interfaces:
Serializable
- Enclosing class:
AvatarGroup
- 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 TypeMethodDescriptionvoidaddClassNames(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.voidremoveClassNames(String... classNames) Removes one or more class names from this item.voidsetAbbreviation(String abbr) Sets the abbreviation for the avatar.voidsetColorIndex(Integer colorIndex) Sets the color index for the avatar group item.voidSets the image url for the avatar.voidsetImageHandler(DownloadHandler downloadHandler) Sets the image for the avatar.voidsetImageResource(AbstractStreamResource resource) Deprecated, for removal: This API element is subject to removal in a future version.voidSets 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 avatar- See Also:
-
AvatarGroupItem
Creates a new avatar group item with the provided name and url.- Parameters:
name- the name for the avatarurl- the image url- See 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.When the image is set with
setImageHandler(DownloadHandler), this returns the URL that the handler is served from. The URL changes when the item is added to another avatar group.- Returns:
- the image url
-
getImageResource
Gets the image that was set for the avatar.When the image is set with
setImageHandler(DownloadHandler), this returns the resource that serves the handler. A new resource is created when the item is added to another avatar group.- Returns:
- the image resource value or
nullif 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
setImageHandler(DownloadHandler)- Parameters:
url- the image url- See Also:
-
setImageHandler
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).Sets the
Content-Dispositionheader toinlinefor pre-defined download handlers, created by factory methods inDownloadHandler, as well as for otherAbstractDownloadHandlerimplementations.The handler is registered as a resource of the avatar group that the item belongs to while the group is attached, and is unregistered when the group is detached or the item is removed from the group. When the item is added to another avatar group, the handler is served from a new resource with a new URL.
- Parameters:
downloadHandler- the download resource ornullto remove the resource- Since:
- 24.8
- See Also:
-
setImageResource
@Deprecated(since="24.8", forRemoval=true) public void setImageResource(AbstractStreamResource resource) Deprecated, for removal: This API element is subject to removal in a future version.UsesetImageHandler(DownloadHandler)insteadSets the image for the avatar.Setting the image as a resource with this method resets the image URL that was set with
setImage(String)The resource is registered with the session while the avatar group that the item belongs to is attached, and is unregistered when the group is detached or the item is removed from the group.
- Parameters:
resource- the resource value ornullto remove the resource- See Also:
-
getColorIndex
Gets the color index for the avatar group item.- Returns:
- the color index or
nullif 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-Nto the border.- Parameters:
colorIndex- the color index ornullto 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- Since:
- 24.3
-
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- Since:
- 24.3
-
getClassName
Gets the CSS class name set on this item.- Returns:
- a space-delimited list of CSS class names
- Since:
- 24.3
-
setImageHandler(DownloadHandler)instead