Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.account.CharacterModel Class Reference

Maintains the character list for an account. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.account.CharacterModel:

Public Member Functions

void add (@NotNull final CharacterInformation characterInformation)
 Adds an entry. More...
 
void addCharacterInformationListener (final int index, @NotNull final CharacterInformationListener listener)
 Adds a character entry listener for one entry. More...
 
void addCharacterListener (@NotNull final CharacterListener listener)
 Adds a character listener. More...
 
void begin ()
 Starts an update transaction. More...
 
void commit ()
 Finishes an update transaction. More...
 
boolean displaysFace (final int faceNum)
 Returns whether any character has the given face. More...
 
int getCharacterIndex (@NotNull final String characterName)
 Returns the index of an entry by character name. More...
 
CharacterInformation getEntry (final int index)
 Returns a character entry by index. More...
 
void removeCharacterInformationListener (final int index, @NotNull final CharacterInformationListener listener)
 Removes a character entry listener for one entry. More...
 
void removeCharacterListener (@NotNull final CharacterListener listener)
 Removes a character listener. More...
 
int size ()
 Returns the number of character entries. More...
 

Private Member Functions

EventListenerList2< CharacterInformationListenergetCharacterInformationListeners (final int index)
 Returns the character entry listeners for one entry index. More...
 

Private Attributes

final Map< Integer, EventListenerList2< CharacterInformationListener > > characterInformationListeners = new HashMap<>()
 All registered character entry listeners. More...
 
final EventListenerList2< CharacterListenercharacterListeners = new EventListenerList2<>()
 All registered character listeners. More...
 
final List< CharacterInformationcharacters = new ArrayList<>()
 The current entries. More...
 
final Collection< CharacterInformationcharactersPending = new ArrayList<>()
 The pending entries. More...
 
final Object sync = new Object()
 Object used for synchronization. More...
 

Detailed Description

Maintains the character list for an account.

Only meaningful if the server supports the new "loginmethod".

Author
Nicolas Weeger

Definition at line 38 of file CharacterModel.java.

Member Function Documentation

◆ add()

void com.realtime.crossfire.jxclient.account.CharacterModel.add ( @NotNull final CharacterInformation  characterInformation)

Adds an entry.

Parameters
characterInformationthe entry to add

Definition at line 122 of file CharacterModel.java.

References com.realtime.crossfire.jxclient.account.CharacterModel.sync.

◆ addCharacterInformationListener()

void com.realtime.crossfire.jxclient.account.CharacterModel.addCharacterInformationListener ( final int  index,
@NotNull final CharacterInformationListener  listener 
)

Adds a character entry listener for one entry.

Parameters
indexthe entry index to monitor
listenerthe listener to add

Definition at line 182 of file CharacterModel.java.

References com.realtime.crossfire.jxclient.account.CharacterModel.getCharacterInformationListeners().

Referenced by com.realtime.crossfire.jxclient.gui.list.GUICharacterList.rebuildList(), and com.realtime.crossfire.jxclient.gui.list.GUICharacter.setIndex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addCharacterListener()

void com.realtime.crossfire.jxclient.account.CharacterModel.addCharacterListener ( @NotNull final CharacterListener  listener)

Adds a character listener.

Parameters
listenerthe listener to add

Definition at line 165 of file CharacterModel.java.

References com.realtime.crossfire.jxclient.util.EventListenerList2< T extends EventListener >.add().

+ Here is the call graph for this function:

◆ begin()

void com.realtime.crossfire.jxclient.account.CharacterModel.begin ( )

Starts an update transaction.

Definition at line 131 of file CharacterModel.java.

◆ commit()

void com.realtime.crossfire.jxclient.account.CharacterModel.commit ( )

Finishes an update transaction.

Definition at line 138 of file CharacterModel.java.

References com.realtime.crossfire.jxclient.account.CharacterModel.getCharacterInformationListeners(), and com.realtime.crossfire.jxclient.account.CharacterModel.sync.

+ Here is the call graph for this function:

◆ displaysFace()

boolean com.realtime.crossfire.jxclient.account.CharacterModel.displaysFace ( final int  faceNum)

Returns whether any character has the given face.

Parameters
faceNumthe face
Returns
whether the face was found

Definition at line 219 of file CharacterModel.java.

◆ getCharacterIndex()

int com.realtime.crossfire.jxclient.account.CharacterModel.getCharacterIndex ( @NotNull final String  characterName)

Returns the index of an entry by character name.

Parameters
characterNamethe character name
Returns
the index, or
-1
if not found

Definition at line 93 of file CharacterModel.java.

References com.realtime.crossfire.jxclient.account.CharacterModel.sync.

Referenced by com.realtime.crossfire.jxclient.gui.list.GUICharacterList.setCharacter().

+ Here is the caller graph for this function:

◆ getCharacterInformationListeners()

EventListenerList2<CharacterInformationListener> com.realtime.crossfire.jxclient.account.CharacterModel.getCharacterInformationListeners ( final int  index)
private

◆ getEntry()

CharacterInformation com.realtime.crossfire.jxclient.account.CharacterModel.getEntry ( final int  index)

◆ removeCharacterInformationListener()

void com.realtime.crossfire.jxclient.account.CharacterModel.removeCharacterInformationListener ( final int  index,
@NotNull final CharacterInformationListener  listener 
)

Removes a character entry listener for one entry.

Parameters
indexthe entry index to monitor
listenerthe listener to remove

Definition at line 191 of file CharacterModel.java.

References com.realtime.crossfire.jxclient.account.CharacterModel.getCharacterInformationListeners().

Referenced by com.realtime.crossfire.jxclient.gui.list.GUICharacterList.rebuildList(), and com.realtime.crossfire.jxclient.gui.list.GUICharacter.setIndex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeCharacterListener()

void com.realtime.crossfire.jxclient.account.CharacterModel.removeCharacterListener ( @NotNull final CharacterListener  listener)

Removes a character listener.

Parameters
listenerthe listener to remove

Definition at line 173 of file CharacterModel.java.

References com.realtime.crossfire.jxclient.util.EventListenerList2< T extends EventListener >.remove().

+ Here is the call graph for this function:

◆ size()

int com.realtime.crossfire.jxclient.account.CharacterModel.size ( )

Returns the number of character entries.

Returns
the number of character entries

Definition at line 112 of file CharacterModel.java.

References com.realtime.crossfire.jxclient.account.CharacterModel.sync.

Referenced by com.realtime.crossfire.jxclient.gui.list.GUICharacterList.rebuildList().

+ Here is the caller graph for this function:

Member Data Documentation

◆ characterInformationListeners

final Map<Integer, EventListenerList2<CharacterInformationListener> > com.realtime.crossfire.jxclient.account.CharacterModel.characterInformationListeners = new HashMap<>()
private

All registered character entry listeners.

Maps entry index to list of listeners.

Definition at line 70 of file CharacterModel.java.

Referenced by com.realtime.crossfire.jxclient.account.CharacterModel.getCharacterInformationListeners().

◆ characterListeners

final EventListenerList2<CharacterListener> com.realtime.crossfire.jxclient.account.CharacterModel.characterListeners = new EventListenerList2<>()
private

All registered character listeners.

Definition at line 63 of file CharacterModel.java.

◆ characters

final List<CharacterInformation> com.realtime.crossfire.jxclient.account.CharacterModel.characters = new ArrayList<>()
private

The current entries.

Definition at line 44 of file CharacterModel.java.

◆ charactersPending

final Collection<CharacterInformation> com.realtime.crossfire.jxclient.account.CharacterModel.charactersPending = new ArrayList<>()
private

The pending entries.

Only valid between begin() and commit().

Definition at line 51 of file CharacterModel.java.

◆ sync


The documentation for this class was generated from the following file: