Crossfire JXClient, Trunk  R20561
FacesQueue.java
Go to the documentation of this file.
1 /*
2  * This file is part of JXClient, the Fullscreen Java Crossfire Client.
3  *
4  * JXClient is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * JXClient is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with JXClient; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * Copyright (C) 2005-2008 Yann Chachkoff.
19  * Copyright (C) 2006-2011 Andreas Kirschbaum.
20  */
21 
22 package com.realtime.crossfire.jxclient.faces;
23 
24 import org.jetbrains.annotations.NotNull;
25 
32 public class FacesQueue extends AbstractFaceQueue {
33 
38  @NotNull
40 
45  @NotNull
46  private final FaceQueue faceQueue;
47 
51  @NotNull
52  @SuppressWarnings("FieldCanBeLocal")
54 
55  @Override
56  public void faceLoaded(@NotNull final Face face, @NotNull final FaceImages faceImages) {
57  fireFaceLoaded(face, faceImages);
58  }
59 
60  @Override
61  public void faceFailed(@NotNull final Face face) {
62  faceQueue.loadFace(face);
63  }
64 
65  };
66 
70  @NotNull
71  @SuppressWarnings("FieldCanBeLocal")
73 
74  @Override
75  public void faceLoaded(@NotNull final Face face, @NotNull final FaceImages faceImages) {
76  fireFaceLoaded(face, faceImages);
77  fileCacheFaceQueue.saveFace(face, faceImages);
78  }
79 
80  @Override
81  public void faceFailed(@NotNull final Face face) {
82  fireFaceFailed(face);
83  }
84 
85  };
86 
97  public FacesQueue(@NotNull final FaceQueue faceQueue, @NotNull final ImageCache imageCacheOriginal, @NotNull final ImageCache imageCacheScaled, @NotNull final ImageCache imageCacheMagicMap) {
98  fileCacheFaceQueue = new FileCacheFaceQueue(imageCacheOriginal, imageCacheScaled, imageCacheMagicMap);
99  this.faceQueue = faceQueue;
101  faceQueue.addFaceQueueListener(askfaceFaceQueueListener);
102  }
103 
107  @Override
108  public void reset() {
110  faceQueue.reset();
111  }
112 
116  @Override
117  public void loadFace(@NotNull final Face face) {
119  }
120 
121 }
void reset()
Reset the processing: forget about pending faces.This function is called whenever the server socket b...
void saveFace(@NotNull final Face face, @NotNull final FaceImages faceImages)
Saves a face to the caches.
void reset()
Reset the processing: forget about pending faces.This function is called whenever the server socket b...
final FileCacheFaceQueue fileCacheFaceQueue
The FileCacheFaceQueue instance used to load faces from the file cache.
Definition: FacesQueue.java:39
Interface for classes implementing a means to load Faces.
Definition: FaceQueue.java:30
void loadFace(@NotNull Face face)
Request a face.
final FaceQueue faceQueue
The FaceQueue instance used to query faces from the Crossfire server.
Definition: FacesQueue.java:46
Interface for ImageIcon caching classes.
Definition: ImageCache.java:32
The main FaceQueue for loading faces.
Definition: FacesQueue.java:32
Consists of three ImageIcons representing a Face.
Definition: FaceImages.java:31
void fireFaceLoaded(@NotNull final Face face, @NotNull final FaceImages faceImages)
Notify all listener with FaceImages).
Abstract base class for classes implementing FaceQueue.
void reset()
Reset the processing: forget about pending faces.
void fireFaceFailed(@NotNull final Face face)
Notify all listener with FaceQueueListener#faceFailed(Face).
FacesQueue(@NotNull final FaceQueue faceQueue, @NotNull final ImageCache imageCacheOriginal, @NotNull final ImageCache imageCacheScaled, @NotNull final ImageCache imageCacheMagicMap)
Creates a new instance.
Definition: FacesQueue.java:97
void addFaceQueueListener(@NotNull final FaceQueueListener faceQueueListener)
Adds a FaceQueueListener to be notified about processed faces.the listener to add ...
Interface for listeners interested in FaceQueue events.
void loadFace(@NotNull final Face face)
Request a face.Must eventually call either FaceQueueListener#faceLoaded(Face, FaceImages) or FaceQueu...
final FaceQueueListener fileCacheFaceQueueListener
The FaceQueueListener attached to fileCacheFaceQueue.
Definition: FacesQueue.java:53
final FaceQueueListener askfaceFaceQueueListener
The FaceQueueListener attached to faceQueue.
Definition: FacesQueue.java:72
void loadFace(@NotNull final Face face)
Request a face.Must eventually call either FaceQueueListener#faceLoaded(Face, FaceImages) or FaceQueu...
A FaceQueue loading faces from ImageCache instances.