1
2
3
4
5
6 package net.kwfgrid.gwui.gui;
7
8 import net.kwfgrid.gworkflowdl.protocol.structure.ProtocolWorkflow;
9 import net.kwfgrid.gworkflowdl.protocol.structure.ProtocolTransition;
10
11 import org.glassbox.executor.Executor;
12
13 import java.awt.BorderLayout;
14 import javax.swing.*;
15
16 public class TransitionInspectorFrame extends JFrame {
17 WorkflowElementEditorContainer _view;
18 TransitionInfoView _infoview;
19 AbstractTransitionEdgeEditor _readedgeeditor, _inedgeeditor, _outedgeeditor;
20 TransitionPropertiesEditor _propertieseditor;
21 TransitionConditionEditor _conditioneditor;
22 TransitionDescriptionEditor _descriptioneditor;
23 TransitionIDView _idview;
24 OperationEditor _operationeditor;
25 boolean _editable;
26 ProtocolWorkflow _workflow;
27 Executor _executor;
28 OperationEditorDelegateFactory _opdelegatefact;
29
30 public TransitionInspectorFrame(ProtocolWorkflow workflow, Executor executor) {
31 super("Transition Inspector");
32 getContentPane().setLayout(new BorderLayout());
33 _view = null;
34 _readedgeeditor = null;
35 _inedgeeditor = null;
36 _outedgeeditor = null;
37 _propertieseditor = null;
38 _conditioneditor = null;
39 _descriptioneditor = null;
40 _operationeditor = null;
41 _infoview = null;
42 _idview = null;
43 _editable = true;
44 _executor = executor;
45 _workflow = workflow;
46 _opdelegatefact = new DefaultOperationEditorDelegateFactory();
47 }
48
49 public void setEnabled(boolean enabled) {
50 super.setEnabled(enabled);
51 if (_view!=null) _view.setEnabled(enabled);
52 }
53
54 public void setEditable(boolean editable) {
55 _editable = editable;
56 if (_view!=null) _view.setEditable(editable);
57 }
58
59 public void setTransition(ProtocolTransition transition) {
60 if (_view!=null) {
61 _view.dispose();
62 getContentPane().removeAll();
63 getContentPane().invalidate();
64 }
65 if (transition != null) {
66 _idview = new TransitionIDView(_workflow, transition);
67 _descriptioneditor = new TransitionDescriptionEditor(_executor,
68 _workflow,
69 transition);
70 _infoview = new TransitionInfoView(_workflow,
71 transition);
72 _conditioneditor = new TransitionConditionEditor(_executor,
73 _workflow,
74 transition);
75 _propertieseditor = new TransitionPropertiesEditor(_executor,
76 _workflow,
77 transition);
78 _operationeditor = new OperationEditor(_opdelegatefact,
79 _executor,
80 _workflow,
81 transition);
82 _readedgeeditor = new TransitionReadEdgeEditor(_executor,
83 _workflow,
84 transition);
85 _inedgeeditor = new TransitionInputEdgeEditor(_executor,
86 _workflow,
87 transition);
88 _outedgeeditor = new TransitionOutputEdgeEditor(_executor,
89 _workflow,
90 transition);
91 _view = new WorkflowElementEditorContainer(_workflow,
92 transition,
93 new AbstractWorkflowElementView[] { _idview,
94 _infoview,
95 _descriptioneditor,
96 _propertieseditor,
97 _readedgeeditor,
98 _inedgeeditor,
99 _outedgeeditor,
100 _conditioneditor,
101 _operationeditor },
102 new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 });
103 JScrollPane pane = new JScrollPane(_view.getView());
104 pane.setBorder(null);
105 getContentPane().add(pane, BorderLayout.CENTER);
106 getContentPane().setSize(getContentPane().getLayout().preferredLayoutSize(getContentPane()));
107 getContentPane().validate();
108 _view.setEnabled(isEnabled());
109 _view.setEditable(_editable);
110 pack();
111 show();
112 } else {
113 _view = null;
114 _infoview = null;
115 _readedgeeditor = null;
116 _inedgeeditor = null;
117 _outedgeeditor = null;
118 _propertieseditor = null;
119 _conditioneditor = null;
120 _descriptioneditor = null;
121 _idview = null;
122 _operationeditor = null;
123 hide();
124 }
125 }
126 }