summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/lifecycle/gui/view/CompActDefOutcomeHandler.java
diff options
context:
space:
mode:
authorabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
committerabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
commit0ec8481c10cd8277d84c7c1a785483a0a739e5a0 (patch)
tree5f6e5d9ae75193e67e6f3b3dfa488960c5cde1d5 /source/com/c2kernel/lifecycle/gui/view/CompActDefOutcomeHandler.java
parent036cbdba66f804743c4c838ed598d6972c4b3e17 (diff)
More code cleanup:
Refactored Entity Proxy Subscription to handle generics better Rewrote RemoteMap to use TreeMap instead of the internal array for order. It now sorts its keys by number if they parse, else as strings. Removed a no-longer-in-progress outcome form class
Diffstat (limited to 'source/com/c2kernel/lifecycle/gui/view/CompActDefOutcomeHandler.java')
-rw-r--r--[-rwxr-xr-x]source/com/c2kernel/lifecycle/gui/view/CompActDefOutcomeHandler.java79
1 files changed, 47 insertions, 32 deletions
diff --git a/source/com/c2kernel/lifecycle/gui/view/CompActDefOutcomeHandler.java b/source/com/c2kernel/lifecycle/gui/view/CompActDefOutcomeHandler.java
index cb0ef59..58964aa 100755..100644
--- a/source/com/c2kernel/lifecycle/gui/view/CompActDefOutcomeHandler.java
+++ b/source/com/c2kernel/lifecycle/gui/view/CompActDefOutcomeHandler.java
@@ -15,7 +15,11 @@ import com.c2kernel.graph.layout.DefaultGraphLayoutGenerator;
import com.c2kernel.graph.view.EditorPanel;
import com.c2kernel.graph.view.VertexPropertyPanel;
import com.c2kernel.gui.MainFrame;
-import com.c2kernel.gui.tabs.outcome.*;
+import com.c2kernel.gui.tabs.outcome.InvalidOutcomeException;
+import com.c2kernel.gui.tabs.outcome.InvalidSchemaException;
+import com.c2kernel.gui.tabs.outcome.OutcomeException;
+import com.c2kernel.gui.tabs.outcome.OutcomeHandler;
+import com.c2kernel.gui.tabs.outcome.OutcomeNotInitialisedException;
import com.c2kernel.lifecycle.CompositeActivityDef;
import com.c2kernel.lifecycle.gui.model.WfDefGraphPanel;
import com.c2kernel.lifecycle.gui.model.WfEdgeDefFactory;
@@ -44,26 +48,26 @@ public class CompActDefOutcomeHandler
protected JButton mLoadButton = new JButton(Resource.getImageResource("graph/load.png"));
protected JButton mLayoutButton = new JButton(Resource.getImageResource("graph/autolayout.png"));
protected JButton[] mOtherToolBarButtons = { mLayoutButton, mLoadButton };
-
+
protected CompositeActivityDef mCompActDef = null;
protected WfEdgeDefFactory mWfEdgeDefFactory = new WfEdgeDefFactory();
- protected WfVertexDefFactory mWfVertexDefFactory = new WfVertexDefFactory();
+ protected WfVertexDefFactory mWfVertexDefFactory = new WfVertexDefFactory();
protected EditorPanel mEditorPanel;
protected VertexPropertyPanel mPropertyPanel;
protected JSplitPane mSplitPane;
boolean unsaved;
-
+
public CompActDefOutcomeHandler() {
super();
- mPropertyPanel = loadPropertyPanel();
- mPropertyPanel.createLayout(new FindActDefPanel());
+ mPropertyPanel = loadPropertyPanel();
+ mPropertyPanel.createLayout(new FindActDefPanel());
mEditorPanel =
new EditorPanel(
mWfEdgeDefFactory,
mWfVertexDefFactory,
new WfVertexDefOutlineCreator(),
- true,
+ true,
mOtherToolBarButtons,
new WfDefGraphPanel(new WfDirectedEdgeDefRenderer(),
new WfVertexDefRenderer()));
@@ -92,7 +96,8 @@ public class CompActDefOutcomeHandler
protected void createListeners()
{
mLoadButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent ae) {
+ @Override
+ public void actionPerformed(ActionEvent ae) {
File selectedFile = null;
int returnValue = MainFrame.xmlChooser.showOpenDialog(null);
@@ -110,32 +115,34 @@ public class CompActDefOutcomeHandler
}
case JFileChooser.CANCEL_OPTION :
case JFileChooser.ERROR_OPTION :
-
+
default :
}
}
});
-
+
mLayoutButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent ae) {
+ @Override
+ public void actionPerformed(ActionEvent ae) {
DefaultGraphLayoutGenerator.layoutGraph(mEditorPanel.mGraphModelManager.getModel());
}
});
- }
-
+ }
+
public void setUpGraphEditor() {
mEditorPanel.mGraphModelManager.setModel(mCompActDef.getChildrenGraphModel());
// Give the editor panel the edge and vertex types
mEditorPanel.updateVertexTypes(mCompActDef.getVertexTypeNameAndConstructionInfo());
mEditorPanel.updateEdgeTypes(mCompActDef.getEdgeTypeNameAndConstructionInfo());
mEditorPanel.enterSelectMode();
- mWfVertexDefFactory.setCreationContext(mCompActDef);
+ mWfVertexDefFactory.setCreationContext(mCompActDef);
}
-
+
/**
*
*/
- public void setOutcome(String outcome) throws InvalidOutcomeException {
+ @Override
+ public void setOutcome(String outcome) throws InvalidOutcomeException {
try {
CompositeActivityDef newAct = (CompositeActivityDef)CastorXMLUtility.unmarshall(outcome);
if (mCompActDef != null)
@@ -149,14 +156,16 @@ public class CompActDefOutcomeHandler
/**
*
*/
- public void setDescription(String description)
+ @Override
+ public void setDescription(String description)
throws InvalidSchemaException {
- // ignore - always the same
+ // ignore - always the same
}
/**
*
*/
- public void setReadOnly(boolean readOnly) {
+ @Override
+ public void setReadOnly(boolean readOnly) {
mLayoutButton.setEnabled(!readOnly);
mLoadButton.setEnabled(!readOnly);
mEditorPanel.setEditable(!readOnly);
@@ -165,13 +174,15 @@ public class CompActDefOutcomeHandler
/**
*
*/
- public JPanel getPanel() throws OutcomeNotInitialisedException {
+ @Override
+ public JPanel getPanel() throws OutcomeNotInitialisedException {
return this;
}
/**
*
*/
- public String getOutcome() throws OutcomeException {
+ @Override
+ public String getOutcome() throws OutcomeException {
try {
return CastorXMLUtility.marshall(mCompActDef);
} catch (Exception ex) {
@@ -181,20 +192,21 @@ public class CompActDefOutcomeHandler
/**
*
*/
- public void run() {
- Thread.currentThread().setName("Composite Act Def Viewer");
+ @Override
+ public void run() {
+ Thread.currentThread().setName("Composite Act Def Viewer");
createLayout();
createListeners();
- mPropertyPanel.setGraphModelManager(mEditorPanel.mGraphModelManager);
- setUpGraphEditor();
+ mPropertyPanel.setGraphModelManager(mEditorPanel.mGraphModelManager);
+ setUpGraphEditor();
}
-
+
public VertexPropertyPanel loadPropertyPanel()
{
String wfPanelClass = Gateway.getProperty("WfPropertyPanel");
if (wfPanelClass != null) {
try {
- Class panelClass = Class.forName(wfPanelClass);
+ Class<?> panelClass = Class.forName(wfPanelClass);
return (VertexPropertyPanel)panelClass.newInstance();
} catch (Exception ex) {
Logger.error("Could not load wf props panel:"+wfPanelClass);
@@ -203,15 +215,18 @@ public class CompActDefOutcomeHandler
}
return new VertexPropertyPanel();
}
-
- public boolean isUnsaved() {
+
+ @Override
+ public boolean isUnsaved() {
return unsaved;
}
-
- public void saved() {
+
+ @Override
+ public void saved() {
unsaved = false;
}
-
+
+ @Override
public void export(File targetFile) throws Exception {
ElemActDefOutcomeHandler.exportAct(targetFile.getParentFile(), mCompActDef);
}