-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAsyncAction.java
More file actions
41 lines (34 loc) · 1.05 KB
/
Copy pathAsyncAction.java
File metadata and controls
41 lines (34 loc) · 1.05 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
package uploadServerTool;
import java.awt.event.ActionEvent;
import java.util.List;
import javax.swing.AbstractAction;
public abstract class AsyncAction extends AbstractAction {
private static final long serialVersionUID = 1L;
public AsyncAction(String string) {
super(string);
}
public void actionPerformed(ActionEvent e) {
Main.getInstance().lockActions();
Thread t = new Thread(new Runnable() {
public void run() {
AsyncAction.this.beforeRun();
List<Server> servers = ServerTableModel.getInstance().getSelectedServers();
for (Server s : servers) {
ServerTask t = AsyncAction.this.createTask(s);
t.addListener(ShowMessageListener.getInstance());
t.upMsgln(0, "server: " + s.host + " " + s.name + "(" + s.domain + ")");
t.run();
t.upMsgln(0, "");
}
AsyncAction.this.afterRun();
Main.getInstance().unlockActions();
}
});
t.start();
}
public abstract ServerTask createTask(Server paramServer);
public void beforeRun() {
}
public void afterRun() {
}
}