com.vaadin.collaborationengine.
Class UserInfo
- java.lang.Object
-
- com.vaadin.collaborationengine.UserInfo
-
Direct Known Subclasses:
public class UserInfo extends Object
User information of a collaborating user, used with various features of the collaboration engine.
-
-
Constructor Summary
Constructors Constructor and Description UserInfo(String userId)
Creates a new user info object from the given user id.
UserInfo(String userId, String name)
Creates a new user info object from the given user id and name.
UserInfo(String userId, String name, String imageUrl)
Creates a new user info object from the given user id, name and image URL.
-
Method Summary
All Methods Modifier and Type Method and Description boolean
equals(Object o)
String
getAbbreviation()
Gets the user's abbreviation.
int
getColorIndex()
Gets the user's color index.
String
getId()
Gets the user's unique identifier.
String
getImage()
Gets the url of the user's image.
String
getName()
Gets the user's name.
int
hashCode()
void
setAbbreviation(String abbreviation)
Sets the user's abbreviation.
void
setColorIndex(int colorIndex)
Sets the user's color index.
void
setImage(String imageUrl)
Sets the url of the user's image.
void
setName(String name)
Sets the user's name.
-
-
-
Constructor Detail
-
UserInfo
public UserInfo(String userId)
Creates a new user info object from the given user id.
Parameters:
userId
- the user id, notnull
-
UserInfo
public UserInfo(String userId, String name)
Creates a new user info object from the given user id and name.
Parameters:
userId
- the user id, notnull
name
- the name of the user
-
UserInfo
public UserInfo(String userId, String name, String imageUrl)
Creates a new user info object from the given user id, name and image URL. The color index is calculated based on the id. All other properties are left empty.
If this user info is given to a
CollaborationAvatarGroup
, the image URL is used to load the user's avatar. Alternatively, the user images can be loaded from a backend to the avatar group withCollaborationAvatarGroup.setImageProvider(ImageProvider)
.Parameters:
userId
- the user id, notnull
name
- the name of the userimageUrl
- the URL of the user image
-
-
Method Detail
-
getId
public String getId()
Gets the user's unique identifier.
Returns:
the user's id, not
null
-
getName
public String getName()
Gets the user's name.
Returns:
the user's name.
-
setName
public void setName(String name)
Sets the user's name.
Parameters:
name
- the name to set
-
getAbbreviation
public String getAbbreviation()
Gets the user's abbreviation.
Note: This is not computed based on the user's name, but needs to be explicitly set with
setAbbreviation(String)
.Returns:
the user's abbreviation
-
setAbbreviation
public void setAbbreviation(String abbreviation)
Sets the user's abbreviation.
Parameters:
abbreviation
- the abbreviation to set
-
getImage
public String getImage()
Gets the url of the user's image.
Returns:
the image url
-
setImage
public void setImage(String imageUrl)
Sets the url of the user's image.
If this user info is given to a
CollaborationAvatarGroup
, the image URL is used to load the user's avatar. Alternatively, the user images can be loaded from a backend to the avatar group withCollaborationAvatarGroup.setImageProvider(ImageProvider)
.Parameters:
imageUrl
- the image URL to set
-
getColorIndex
public int getColorIndex()
Gets the user's color index.
The color index defines the user specific color. In practice, color index
n
means that the user color will be set as the CSS variable--vaadin-user-color-n
.The default value is -1, which indicates that the user color can be automatically assigned by Collaboration Engine.
Returns:
the user's color index
-
setColorIndex
public void setColorIndex(int colorIndex)
Sets the user's color index.
Setting it to -1 (which is the default value) indicates that the user color can be automatically assigned by Collaboration Engine.
Parameters:
colorIndex
- the color index to setSee Also:
-
-