public class DefaultFacesManager extends AbstractFacesManager
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 FacesManagerListeners
are notified.Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
DefaultFacesManager(FaceCache faceCache,
FaceQueue faceQueue)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected FaceImages |
getFaceImages(int faceNum,
boolean[] isUnknownImage)
Returns the
FaceImages information for a face ID. |
void |
reset()
Forgets about pending faces.
|
addFacesManagerListener, fireFaceUpdated, getFace, getFace2, getMagicMapImageIcon, getOriginalImageIcon, getScaledImageIcon, lookupFace, removeFacesManagerListener
@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
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 usejava.io.IOException
- if the unknown image resource cannot be loaded@NotNull protected FaceImages getFaceImages(int faceNum, @Nullable boolean[] isUnknownImage)
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 IDisUnknownImage
- returns whether the returned face is the "unknown"
face; ignored if null
public void reset()
reset
in interface FacesManager
reset
in class AbstractFacesManager