java.lang.Object com.realtime.crossfire.jxclient.faces.AbstractFacesManager com.realtime.crossfire.jxclient.faces.DefaultFacesManager
public class DefaultFacesManager
Retrieves Face
information by face ID. If a face is not available
in-memory, an "unknown" (question mark) face is returned immediately.
Asynchronously, the face is loaded from the file cache. If loading fails, the
face is requested from the server (and later stored into the file cache). As
soon as the face becomes available, all registered FacesManagerListener
s are notified.
Field Summary | |
---|---|
private FaceImages |
emptyFaceImages
The empty face; returned for face ID 0. |
private FaceQueue |
faceQueue
The FaceQueue instance used to load faces not present in-memory. |
private FaceQueueListener |
faceQueueListener
The FaceQueueListener registered to faceQueue . |
private FaceImages |
unknownFaceImages
The unknown face. |
Constructor Summary | |
---|---|
DefaultFacesManager(FaceCache faceCache,
FaceQueue faceQueue)
Creates a new instance. |
Method Summary | |
---|---|
protected FaceImages |
getFaceImages(int faceNum)
Returns the FaceImages information for a face ID. |
void |
reset()
Forgets about pending faces. |
Methods inherited from class com.realtime.crossfire.jxclient.faces.AbstractFacesManager |
---|
addFacesManagerListener, fireFaceUpdated, getFace, getFace2, getMagicMapImageIcon, getOriginalImageIcon, getScaledImageIcon, lookupFace, removeFacesManagerListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@NotNull private final FaceImages emptyFaceImages
@NotNull private final FaceQueue faceQueue
FaceQueue
instance used to load faces not present in-memory.
@NotNull private final FaceQueueListener faceQueueListener
FaceQueueListener
registered to faceQueue
.
@NotNull private final FaceImages unknownFaceImages
Constructor Detail |
---|
public DefaultFacesManager(@NotNull FaceCache faceCache, @NotNull FaceQueue faceQueue) throws java.io.IOException
faceCache
- the face cache instance for storing in-memory facesfaceQueue
- the face queue to use
java.io.IOException
- if the unknown image resource cannot be loadedMethod Detail |
---|
@NotNull protected FaceImages getFaceImages(int faceNum)
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.
getFaceImages
in class AbstractFacesManager
faceNum
- the face ID
public void reset()
reset
in interface FacesManager
reset
in class AbstractFacesManager