root / org.gvsig.proj / branches / refactor2018 / org.gvsig.proj / org.gvsig.proj.swing / org.gvsig.proj.swing.impl / src / main / java / org / gvsig / proj / swing / impl / tree / DirectGroupLoader.java @ 866
History | View | Annotate | Download (790 Bytes)
1 | 866 | cmartinez | package org.gvsig.proj.swing.impl.tree; |
---|---|---|---|
2 | |||
3 | import java.util.List; |
||
4 | |||
5 | import javax.swing.tree.TreeNode; |
||
6 | |||
7 | public abstract class DirectGroupLoader |
||
8 | implements GroupLoader {
|
||
9 | |||
10 | protected LoadedGroup caller;
|
||
11 | private boolean cancelled = false; |
||
12 | |||
13 | public DirectGroupLoader(LoadedGroup caller) {
|
||
14 | this.caller = caller;
|
||
15 | } |
||
16 | |||
17 | @Override
|
||
18 | public void execute() { |
||
19 | this.cancelled = false; |
||
20 | this.caller.clear();
|
||
21 | List<TreeNode> result = this.doExecute(); |
||
22 | if (cancelled) {
|
||
23 | this.caller.cancelled();
|
||
24 | } |
||
25 | else {
|
||
26 | this.caller.loaded(result);
|
||
27 | } |
||
28 | } |
||
29 | |||
30 | protected abstract List<TreeNode> doExecute(); |
||
31 | |||
32 | @Override
|
||
33 | public void cancel() { |
||
34 | cancelled = true;
|
||
35 | } |
||
36 | |||
37 | @Override
|
||
38 | |||
39 | public boolean isCancelled() { |
||
40 | return cancelled;
|
||
41 | } |
||
42 | |||
43 | @Override
|
||
44 | public TreeNode createLoadingNode() { |
||
45 | return null; |
||
46 | } |
||
47 | } |