Class ChatUser


  • public class ChatUser
    extends java.lang.Object
    Struct to hold the user state in the chat GUI.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.swing.Icon avatar
      The avatar image.
      protected boolean away
      The away flag.
      protected IComponentIdentifier cid
      The chat user.
      protected static javax.swing.UIDefaults icons
      The icons.
      protected long lastupdate
      The time of the last update for checking when user becomes offline.
      protected java.util.Set<java.lang.Integer> messages
      The open message ids.
      protected java.lang.String nick
      The cached nickname.
      protected boolean typing
      The typing flag.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addMessage​(int id)
      Add a message that is currently being sent.
      IComponentIdentifier getComponentIdentifier()
      Get the cid.
      javax.swing.Icon getIcon()
      Get an icon for the user.
      java.lang.String getNick()
      Get the nick.
      boolean isAvatarUnknown()
      Test if image is unknown.
      boolean isAway()
      Get the away state.
      boolean isNickUnknown()
      Test if nickname is unknown.
      boolean isTyping()
      Get the typing state.
      void removeMessage​(int id)
      Remove a message when sending is finished.
      void setAvatar​(javax.swing.Icon avatar)
      Set the image.
      void setAway​(boolean away)
      Set the away state.
      void setNick​(java.lang.String nick)
      Set the nick.
      boolean setOnline​(java.lang.Boolean online)
      Called when the user has been detected offline or online
      void setTyping​(boolean typing)
      Set the typing state.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • icons

        protected static final javax.swing.UIDefaults icons
        The icons.
      • typing

        protected boolean typing
        The typing flag.
      • away

        protected boolean away
        The away flag.
      • messages

        protected java.util.Set<java.lang.Integer> messages
        The open message ids.
      • nick

        protected java.lang.String nick
        The cached nickname.
      • avatar

        protected javax.swing.Icon avatar
        The avatar image.
      • lastupdate

        protected long lastupdate
        The time of the last update for checking when user becomes offline.
    • Method Detail

      • getIcon

        public javax.swing.Icon getIcon()
        Get an icon for the user.
      • setTyping

        public void setTyping​(boolean typing)
        Set the typing state.
      • isTyping

        public boolean isTyping()
        Get the typing state.
      • setAway

        public void setAway​(boolean away)
        Set the away state.
      • isAway

        public boolean isAway()
        Get the away state.
      • getNick

        public java.lang.String getNick()
        Get the nick.
        Returns:
        the nick.
      • setNick

        public void setNick​(java.lang.String nick)
        Set the nick.
        Parameters:
        nick - The nick to set.
      • isNickUnknown

        public boolean isNickUnknown()
        Test if nickname is unknown.
      • isAvatarUnknown

        public boolean isAvatarUnknown()
        Test if image is unknown.
      • setAvatar

        public void setAvatar​(javax.swing.Icon avatar)
        Set the image.
        Parameters:
        image - The image to set.
      • getComponentIdentifier

        public IComponentIdentifier getComponentIdentifier()
        Get the cid.
        Returns:
        the cid.
      • addMessage

        public void addMessage​(int id)
        Add a message that is currently being sent.
      • removeMessage

        public void removeMessage​(int id)
        Remove a message when sending is finished.
      • setOnline

        public boolean setOnline​(java.lang.Boolean online)
        Called when the user has been detected offline or online
        Returns:
        True, when to much offline detections appeared and the user should be removed.