1
2
3
4
5
6 package net.kwfgrid.gwui.gui;
7
8 import net.kwfgrid.gworkflowdl.protocol.structure.IStructureObject;
9 import net.kwfgrid.gworkflowdl.protocol.structure.ProtocolWorkflow;
10
11 import org.glassbox.executor.Executor;
12
13
14 /***
15 Abstract super class for an editor of a workflow element.
16 */
17 public abstract class AbstractWorkflowElementEditor extends AbstractWorkflowElementView implements GUIMethodCallTask.Callback {
18 private boolean _performingtask;
19 private boolean _editable;
20 private Executor _executor;
21
22 /***
23 Constructor.
24 @param exeuctor The exeuctor to run method calls.
25 @param workflow The edited workflow.
26 @param element The edited element, an object in the workflow structure.
27 */
28 protected AbstractWorkflowElementEditor(Executor executor, ProtocolWorkflow workflow, IStructureObject element) {
29 super(workflow, element);
30 _executor = executor;
31 _performingtask = false;
32 _editable = true;
33 }
34
35 /***
36 Get the executor for method calls on the document edited by this editor.
37 */
38 protected Executor getExecutor() {
39 return _executor;
40 }
41
42 /***
43 Set if a task which has been initiated by this view is currently performed.
44 Calls <code>updateState()</code> after changing the performing-task state.
45 */
46 public void setPerformingTask(boolean performing) {
47 _performingtask = performing;
48 updateState();
49 }
50
51 /***
52 Check if a task which has been initiated by this view is currently performed.
53 */
54 public boolean isPerformingTask() {
55 return _performingtask;
56 }
57
58 /***
59 Set if this view is editable.
60 Calls <code>updateState()</code> after changing the editable state.
61 */
62 public void setEditable(boolean editable) {
63 _editable = editable;
64 updateState();
65 }
66
67 public boolean isEditable() {
68 return _editable;
69 }
70
71 public void notifyTaskFinished() {
72 setPerformingTask(false);
73 }
74
75 public void notifyTaskFailed() {
76 setPerformingTask(false);
77 }
78 }