1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.util;
21
22 import org.xnap.XNap;
23
24 /***
25 * Represents a state of a {@link FiniteStateMachine}.
26 */
27 public class State
28 {
29
30
31
32 /***
33 * Operation has been aborted.
34 */
35 public static final State ABORTED = new State(XNap.tr("Aborted"));
36
37 /***
38 * An abort is in progress.
39 */
40 public static final State ABORTING
41 = new State(XNap.tr("Aborting"));
42
43 /***
44 * Connect is in progress.
45 */
46 public static final State CONNECTING
47 = new State(XNap.tr("Connecting"));
48
49 /***
50 * Connect was successful.
51 */
52 public static final State CONNECTED
53 = new State(XNap.tr("Connected"));
54
55 /***
56 * Object was deleted.
57 */
58 public static final State DELETED = new State(XNap.tr("Deleted"));
59
60 /***
61 * Disconnect is in progress.
62 */
63 public static final State DISCONNECTING
64 = new State(XNap.tr("Disconnecting"));
65
66 /***
67 * Disconnect was successful.
68 */
69 public static final State DISCONNECTED
70 = new State(XNap.tr("Not connected"));
71
72 /***
73 * Download in progress.
74 */
75 public static final State DOWNLOADING
76 = new State(XNap.tr("Downloading"));
77
78 /***
79 * An unrecoverable error has occured.
80 */
81 public static final State ERROR = new State(XNap.tr("Error"));
82
83 /***
84 * Operation has failed.
85 */
86 public static final State FAILED = new State(XNap.tr("Failed"));
87
88 /***
89 * Operation is finished.
90 */
91 public static final State FINISHED = new State(XNap.tr("Finished"));
92
93 /***
94 * Object has been locally queued.
95 */
96 public static final State LOCALLY_QUEUED
97 = new State(XNap.tr("Locally queued"));
98
99 /***
100 * Operation has not started, yet.
101 */
102 public static final State NOT_STARTED = new State("");
103
104 /***
105 * Object has requested an operation.
106 */
107 public static final State REQUESTING
108 = new State(XNap.tr("Requesting"));
109
110 /***
111 * Something is going on.
112 */
113 public static final State RUNNING
114 = new State(XNap.tr("Running"));
115
116 /***
117 * Search is in progress.
118 */
119 public static final State SEARCHING
120 = new State(XNap.tr("Searching"));
121
122 /***
123 * A stop operation is in progress .
124 */
125 public static final State STOPPING
126 = new State(XNap.tr("Stopping"));
127
128 /***
129 * Operation has been stopped.
130 */
131 public static final State STOPPED = new State(XNap.tr("Stopped"));
132
133 /***
134 * Operation was successful.
135 */
136 public static final State SUCCEEDED = new State(XNap.tr("Succeeded"));
137
138 /***
139 * Upload in progress.
140 */
141 public static final State UPLOADING
142 = new State(XNap.tr("Uploading"));
143
144 /***
145 * Waiting for something.
146 */
147 public static final State WAITING = new State(XNap.tr("Waiting"));
148
149
150
151 private String description;
152
153
154
155 public State(String description)
156 {
157 setDescription(description);
158 }
159
160 public State()
161 {
162 }
163
164
165
166 /***
167 * Returns a short description for this state. Usually used to inform the
168 * user.
169 */
170 public String getDescription()
171 {
172 return description;
173 }
174
175 /***
176 * Sets a new description.
177 */
178 public void setDescription(String newValue)
179 {
180 description = newValue;
181 }
182
183 /***
184 * Returns {@link #getDescription}.
185 */
186 public String toString()
187 {
188 return getDescription();
189 }
190
191 }