Class UserInfo

  • Direct Known Subclasses:
    SystemUserInfo

    public class UserInfo
    extends java.lang.Object
    User information of a collaborating user, used with various features of the collaboration engine.
    Since:
    1.0
    Author:
    Vaadin Ltd
    • Constructor Summary

      Constructors 
      Constructor Description
      UserInfo​(java.lang.String userId)
      Creates a new user info object from the given user id.
      UserInfo​(java.lang.String userId, java.lang.String name)
      Creates a new user info object from the given user id and name.
      UserInfo​(java.lang.String userId, java.lang.String name, java.lang.String imageUrl)
      Creates a new user info object from the given user id, name and image URL.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.lang.String getAbbreviation()
      Gets the user's abbreviation.
      int getColorIndex()
      Gets the user's color index.
      java.lang.String getId()
      Gets the user's unique identifier.
      java.lang.String getImage()
      Gets the url of the user's image.
      java.lang.String getName()
      Gets the user's name.
      int hashCode()  
      void setAbbreviation​(java.lang.String abbreviation)
      Sets the user's abbreviation.
      void setColorIndex​(int colorIndex)
      Sets the user's color index.
      void setImage​(java.lang.String imageUrl)
      Sets the url of the user's image.
      void setName​(java.lang.String name)
      Sets the user's name.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UserInfo

        public UserInfo​(java.lang.String userId)
        Creates a new user info object from the given user id.
        Parameters:
        userId - the user id, not null
        Since:
        1.0
      • UserInfo

        public UserInfo​(java.lang.String userId,
                        java.lang.String name)
        Creates a new user info object from the given user id and name.
        Parameters:
        userId - the user id, not null
        name - the name of the user
        Since:
        1.0
      • UserInfo

        public UserInfo​(java.lang.String userId,
                        java.lang.String name,
                        java.lang.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 with CollaborationAvatarGroup.setImageProvider(ImageProvider).

        Parameters:
        userId - the user id, not null
        name - the name of the user
        imageUrl - the URL of the user image
        Since:
        1.0
    • Method Detail

      • getId

        public java.lang.String getId()
        Gets the user's unique identifier.
        Returns:
        the user's id, not null
        Since:
        1.0
      • getName

        public java.lang.String getName()
        Gets the user's name.
        Returns:
        the user's name.
        Since:
        1.0
      • setName

        public void setName​(java.lang.String name)
        Sets the user's name.
        Parameters:
        name - the name to set
        Since:
        1.0
      • getAbbreviation

        public java.lang.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
        Since:
        1.0
      • setAbbreviation

        public void setAbbreviation​(java.lang.String abbreviation)
        Sets the user's abbreviation.
        Parameters:
        abbreviation - the abbreviation to set
        Since:
        1.0
      • getImage

        public java.lang.String getImage()
        Gets the url of the user's image.
        Returns:
        the image url
        Since:
        1.0
      • setImage

        public void setImage​(java.lang.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 with CollaborationAvatarGroup.setImageProvider(ImageProvider).

        Parameters:
        imageUrl - the image URL to set
        Since:
        1.0
      • 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
        Since:
        1.0
      • 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 set
        Since:
        1.0
        See Also:
        getColorIndex()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object