com.realtime.crossfire.jxclient.faces
Class AbstractFacesManager

java.lang.Object
  extended by com.realtime.crossfire.jxclient.faces.AbstractFacesManager
All Implemented Interfaces:
FacesManager
Direct Known Subclasses:
DefaultFacesManager

public abstract class AbstractFacesManager
extends java.lang.Object
implements FacesManager

Abstract base class for FacesManager implementations.


Field Summary
private  FaceCache faceCache
          The FaceCache instance used to look up in-memory faces.
private  java.util.Collection<FacesManagerListener> facesManagerListeners
          The FacesManagerListeners to notify about changed faces.
 
Constructor Summary
protected AbstractFacesManager(FaceCache faceCache)
          Creates a new instance.
 
Method Summary
 void addFacesManagerListener(FacesManagerListener facesManagerListener)
          Adds a FacesManagerListener to be notified about updated faces.
protected  void fireFaceUpdated(Face face)
          Notifies all FacesManagerListeners that a face has been updated.
 Face getFace(int faceNum)
          Returns the Face instance for a given face ID.
 Face getFace2(int faceNum)
          Returns the Face instance for a given face ID.
protected abstract  FaceImages getFaceImages(int faceNum)
          Returns the FaceImages information for a face ID.
 javax.swing.ImageIcon getMagicMapImageIcon(int faceNum)
          Returns the "magic map" face for a face ID.
 javax.swing.ImageIcon getOriginalImageIcon(int faceNum)
          Returns the "original" face for a face ID.
 javax.swing.ImageIcon getScaledImageIcon(int faceNum)
          Returns the "scaled" face for a face ID.
protected  Face lookupFace(int faceNum)
          Returns the Face instance for a given face ID.
 void removeFacesManagerListener(FacesManagerListener facesManagerListener)
          Removes a FacesManagerListener to be notified about updated faces.
 void reset()
          Forgets about pending faces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

faceCache

@NotNull
private final FaceCache faceCache
The FaceCache instance used to look up in-memory faces.


facesManagerListeners

@NotNull
private final java.util.Collection<FacesManagerListener> facesManagerListeners
The FacesManagerListeners to notify about changed faces.

Constructor Detail

AbstractFacesManager

protected AbstractFacesManager(@NotNull
                               FaceCache faceCache)
Creates a new instance.

Parameters:
faceCache - the face cache instance for storing in-memory faces
Method Detail

addFacesManagerListener

public void addFacesManagerListener(@NotNull
                                    FacesManagerListener facesManagerListener)
Adds a FacesManagerListener to be notified about updated faces.

Specified by:
addFacesManagerListener in interface FacesManager
Parameters:
facesManagerListener - the listener

fireFaceUpdated

protected void fireFaceUpdated(@NotNull
                               Face face)
Notifies all FacesManagerListeners that a face has been updated.

Parameters:
face - the face

getFace

@NotNull
public Face getFace(int faceNum)
Returns the Face instance for a given face ID. Requests the face face from the server if necessary.

Specified by:
getFace in interface FacesManager
Parameters:
faceNum - the face ID to request
Returns:
the face

getFace2

@Nullable
public Face getFace2(int faceNum)
Returns the Face instance for a given face ID. Requests the face from the server if necessary.

Specified by:
getFace2 in interface FacesManager
Parameters:
faceNum - the face ID to request
Returns:
the face or null for the empty face

getFaceImages

@NotNull
protected abstract FaceImages getFaceImages(int faceNum)
Returns the FaceImages information for a face ID. This function returns immediately even if the face is not loaded. A not loaded face will be updated as soon as loading has finished.

Parameters:
faceNum - the face ID
Returns:
the face images information

getMagicMapImageIcon

@NotNull
public javax.swing.ImageIcon getMagicMapImageIcon(int faceNum)
Returns the "magic map" face for a face ID. This function returns immediately even if the face is not loaded. A not loaded face will be updated as soon as loading has finished.

Specified by:
getMagicMapImageIcon in interface FacesManager
Parameters:
faceNum - the face ID
Returns:
the face, or the "unknown" face if the face is not loaded

getOriginalImageIcon

@NotNull
public javax.swing.ImageIcon getOriginalImageIcon(int faceNum)
Returns the "original" face for a face ID. This function returns immediately even if the face is not loaded. A not loaded face will be updated as soon as loading has finished.

Specified by:
getOriginalImageIcon in interface FacesManager
Parameters:
faceNum - the face ID
Returns:
the face, or the "unknown" face if the face is not loaded

getScaledImageIcon

@NotNull
public javax.swing.ImageIcon getScaledImageIcon(int faceNum)
Returns the "scaled" face for a face ID. This function returns immediately even if the face is not loaded. A not loaded face will be updated as soon as loading has finished.

Specified by:
getScaledImageIcon in interface FacesManager
Parameters:
faceNum - the face ID
Returns:
the face, or the "unknown" face if the face is not loaded

lookupFace

@NotNull
protected Face lookupFace(int faceNum)
Returns the Face instance for a given face ID. Other than getFace(int), does not request the face face from the server if unknown.

Parameters:
faceNum - the face ID to look up
Returns:
the face

removeFacesManagerListener

public void removeFacesManagerListener(@NotNull
                                       FacesManagerListener facesManagerListener)
Removes a FacesManagerListener to be notified about updated faces.

Specified by:
removeFacesManagerListener in interface FacesManager
Parameters:
facesManagerListener - the listener

reset

public void reset()
Forgets about pending faces.

Specified by:
reset in interface FacesManager