forked from pquiring/javaforce
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJFTask.java
More file actions
executable file
·68 lines (51 loc) · 1.19 KB
/
Copy pathJFTask.java
File metadata and controls
executable file
·68 lines (51 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package javaforce;
/**
* Created : Mar 12, 2012
*
* @author pquiring
*/
import java.util.*;
/**
* A special Thread (task) for ProgressDialog.<br> You should override work();
*/
public abstract class JFTask extends Thread implements ShellProcessListener {
private ProgressDialog pd;
private boolean status;
private HashMap<String, Object> properties = new HashMap<String, Object>();
public volatile boolean abort = false;
public void start(ProgressDialog pd) {
this.pd = pd;
start();
}
public void run() {
status = work();
if (pd != null) pd.done();
}
public void abort() {
abort = true;
}
public void dispose() {
if (pd != null) pd.dispose();
}
public abstract boolean work();
public boolean getStatus() {
return status;
}
public void setLabel(String txt) {
pd.setLabel(txt);
}
public void setTitle(String txt) {
pd.setTitle(txt);
}
public void setProgress(int value) {
pd.setProgress(value);
}
public void shellProcessOutput(String out) {
}
public void setProperty(String key, Object value) {
properties.put(key, value);
}
public Object getProperty(String key) {
return properties.get(key);
}
}