1 |
+ |
//---PACKAGE DECLARATION--- |
2 |
+ |
|
3 |
+ |
//---IMPORTS--- |
4 |
|
import uk.ac.ukc.iscream.util.*; |
5 |
|
import java.io.*; |
6 |
|
import java.net.*; |
7 |
|
import javax.swing.JOptionPane; |
8 |
|
|
9 |
+ |
/** |
10 |
+ |
* This is the main thread for the client. |
11 |
+ |
* Once started i continually checks it actionQueue |
12 |
+ |
* for actions that other areas of the system have placed |
13 |
+ |
* there, it then performs those actions. |
14 |
+ |
* |
15 |
+ |
* Currently this is the main thread where all non-GUI events |
16 |
+ |
* are dispatched to. |
17 |
+ |
* |
18 |
+ |
* @author $Author$ |
19 |
+ |
* @version $Id$ |
20 |
+ |
*/ |
21 |
|
public class ConnectionHandler extends Thread { |
22 |
|
|
23 |
+ |
//---FINAL ATTRIBUTES--- |
24 |
+ |
|
25 |
+ |
/** |
26 |
+ |
* The current CVS revision of this class |
27 |
+ |
*/ |
28 |
+ |
public final String REVISION = "$Revision$"; |
29 |
+ |
|
30 |
|
public final String PROTOCOL_VERSION = "PROTOCOL 1.0"; |
31 |
|
|
32 |
|
public static final int DONOTHING = 0; |
35 |
|
public static final int STOPDATA = 3; |
36 |
|
public static final int DISCONNECT = 4; |
37 |
|
public static final int QUIT = 5; |
38 |
< |
|
38 |
> |
|
39 |
> |
//---STATIC METHODS--- |
40 |
> |
|
41 |
> |
//---CONSTRUCTORS--- |
42 |
> |
|
43 |
|
public ConnectionHandler(DataPanel data, Queue actionQueue) { |
44 |
|
_data = data; |
45 |
|
_actionQueue = actionQueue; |
46 |
|
_myQueue = _actionQueue.getQueue(); |
47 |
|
} |
48 |
|
|
49 |
+ |
//---PUBLIC METHODS--- |
50 |
+ |
|
51 |
|
public void run() { |
52 |
|
|
53 |
|
while(true) { |
218 |
|
} |
219 |
|
} |
220 |
|
|
221 |
< |
|
221 |
> |
//---PRIVATE METHODS--- |
222 |
> |
|
223 |
> |
//---ACCESSOR/MUTATOR METHODS--- |
224 |
> |
|
225 |
> |
//---ATTRIBUTES--- |
226 |
> |
|
227 |
|
SwingClient SwingClient; |
228 |
|
DataPanel _data; |
229 |
|
Queue _actionQueue; |
238 |
|
PrintWriter _dataOutBound; |
239 |
|
DataReader _dataReader; |
240 |
|
String _clientName = "CadburyFlakeClient"; |
241 |
+ |
|
242 |
+ |
//---STATIC ATTRIBUTES--- |
243 |
+ |
|
244 |
|
} |