java.lang.Object com.realtime.crossfire.jxclient.account.CharacterModel
public class CharacterModel
Maintains the character list for an account. Only meaningful if the server supports the new "loginmethod".
Field Summary | |
---|---|
private java.util.Map<java.lang.Integer,java.util.List<CharacterInformationListener>> |
characterInformationListeners
All registered character entry listeners. |
private java.util.Collection<CharacterListener> |
characterListeners
All registered character listeners. |
private java.util.List<CharacterInformation> |
characters
The current entries. |
private java.util.Collection<CharacterInformation> |
charactersPending
The pending entries. |
private java.lang.Object |
sync
Object used for synchronization. |
Constructor Summary | |
---|---|
CharacterModel()
|
Method Summary | |
---|---|
void |
add(CharacterInformation characterInformation)
Adds an entry. |
void |
addCharacterInformationListener(int index,
CharacterInformationListener listener)
Adds a character entry listener for one entry. |
void |
addCharacterListener(CharacterListener listener)
Adds a character listener. |
void |
begin()
Starts an update transaction. |
void |
commit()
Finishes an update transaction. |
int |
getCharacterIndex(java.lang.String characterName)
Returns the index of an entry by character name. |
private java.util.Collection<CharacterInformationListener> |
getCharacterInformationListeners(int index)
Returns the character entry listeners for one entry index. |
CharacterInformation |
getEntry(int index)
Returns a character entry by index. |
void |
removeCharacterInformationListener(int index,
CharacterInformationListener listener)
Removes a character entry listener for one entry. |
void |
removeCharacterListener(CharacterListener listener)
Removes a character listener. |
int |
size()
Returns the number of character entries. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@NotNull private final java.util.Map<java.lang.Integer,java.util.List<CharacterInformationListener>> characterInformationListeners
@NotNull private final java.util.Collection<CharacterListener> characterListeners
@NotNull private final java.util.List<CharacterInformation> characters
@NotNull private final java.util.Collection<CharacterInformation> charactersPending
begin()
and commit()
.
@NotNull private final java.lang.Object sync
Constructor Detail |
---|
public CharacterModel()
Method Detail |
---|
public void add(@NotNull CharacterInformation characterInformation)
characterInformation
- the entry to addpublic void addCharacterInformationListener(int index, @NotNull CharacterInformationListener listener)
index
- the entry index to monitorlistener
- the listener to addpublic void addCharacterListener(@NotNull CharacterListener listener)
listener
- the listener to addpublic void begin()
public void commit()
public int getCharacterIndex(@NotNull java.lang.String characterName)
characterName
- the character name
-1
if not found@NotNull private java.util.Collection<CharacterInformationListener> getCharacterInformationListeners(int index)
index
- the entry index
@Nullable public CharacterInformation getEntry(int index)
index
- the index
null
if the index is
invalidpublic void removeCharacterInformationListener(int index, @NotNull CharacterInformationListener listener)
index
- the entry index to monitorlistener
- the listener to removepublic void removeCharacterListener(@NotNull CharacterListener listener)
listener
- the listener to removepublic int size()