Package jadex.tools.chat
Class ChatUser
- java.lang.Object
-
- jadex.tools.chat.ChatUser
-
public class ChatUser extends java.lang.ObjectStruct to hold the user state in the chat GUI.
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.IconavatarThe avatar image.protected booleanawayThe away flag.protected IComponentIdentifiercidThe chat user.protected static javax.swing.UIDefaultsiconsThe icons.protected longlastupdateThe time of the last update for checking when user becomes offline.protected java.util.Set<java.lang.Integer>messagesThe open message ids.protected java.lang.StringnickThe cached nickname.protected booleantypingThe typing flag.
-
Constructor Summary
Constructors Constructor Description ChatUser(IComponentIdentifier cid)Create a new chat user object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMessage(int id)Add a message that is currently being sent.IComponentIdentifiergetComponentIdentifier()Get the cid.javax.swing.IcongetIcon()Get an icon for the user.java.lang.StringgetNick()Get the nick.booleanisAvatarUnknown()Test if image is unknown.booleanisAway()Get the away state.booleanisNickUnknown()Test if nickname is unknown.booleanisTyping()Get the typing state.voidremoveMessage(int id)Remove a message when sending is finished.voidsetAvatar(javax.swing.Icon avatar)Set the image.voidsetAway(boolean away)Set the away state.voidsetNick(java.lang.String nick)Set the nick.booleansetOnline(java.lang.Boolean online)Called when the user has been detected offline or onlinevoidsetTyping(boolean typing)Set the typing state.
-
-
-
Field Detail
-
icons
protected static final javax.swing.UIDefaults icons
The icons.
-
cid
protected IComponentIdentifier cid
The chat user.
-
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.
-
-
Constructor Detail
-
ChatUser
public ChatUser(IComponentIdentifier cid)
Create a new chat user object.
-
-
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.
-
-