summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/lifecycle/gui/view/ElemActDefOutcomeHandler.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/ElemActDefOutcomeHandler.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/ElemActDefOutcomeHandler.java')
-rw-r--r--[-rwxr-xr-x]source/com/c2kernel/lifecycle/gui/view/ElemActDefOutcomeHandler.java53
1 files changed, 31 insertions, 22 deletions
diff --git a/source/com/c2kernel/lifecycle/gui/view/ElemActDefOutcomeHandler.java b/source/com/c2kernel/lifecycle/gui/view/ElemActDefOutcomeHandler.java
index a30491e..c37e5a7 100755..100644
--- a/source/com/c2kernel/lifecycle/gui/view/ElemActDefOutcomeHandler.java
+++ b/source/com/c2kernel/lifecycle/gui/view/ElemActDefOutcomeHandler.java
@@ -41,7 +41,8 @@ public class ElemActDefOutcomeHandler extends VertexPropertyPanel implements Out
/**
*
*/
- public void setOutcome(String outcome) throws InvalidOutcomeException {
+ @Override
+ public void setOutcome(String outcome) throws InvalidOutcomeException {
try {
act = (ActivityDef)CastorXMLUtility.unmarshall(outcome);
setVertex(act);
@@ -54,7 +55,8 @@ public class ElemActDefOutcomeHandler extends VertexPropertyPanel implements Out
/**
*
*/
- public void setDescription(String description)
+ @Override
+ public void setDescription(String description)
throws InvalidSchemaException {
// ignore
}
@@ -62,7 +64,8 @@ public class ElemActDefOutcomeHandler extends VertexPropertyPanel implements Out
/**
*
*/
- public void setReadOnly(boolean readOnly) {
+ @Override
+ public void setReadOnly(boolean readOnly) {
setEditable(!readOnly);
}
@@ -70,48 +73,54 @@ public class ElemActDefOutcomeHandler extends VertexPropertyPanel implements Out
/**
*
*/
- 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(act);
} catch (Exception ex) {
Logger.error(ex);
throw new OutcomeException();
- }
+ }
}
/**
*
*/
- public void run() {
+ @Override
+ public void run() {
validate();
}
-
- 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 {
exportAct(targetFile.getParentFile(), act);
}
-
+
public static void exportAct(File dir, ActivityDef actDef) throws Exception {
FileStringUtility.string2File(new File(dir, actDef.getActName()+".xml"), CastorXMLUtility.marshall(actDef));
// Export associated schema
exportSchema((String)actDef.getProperties().get("SchemaType"), (String)actDef.getProperties().get("SchemaVersion"), dir);
// Export associated script
exportScript((String)actDef.getProperties().get("ScriptName"), (String)actDef.getProperties().get("ScriptVersion"), dir);
-
+
//Export child act if composite
if (actDef instanceof CompositeActivityDef) {
CompositeActivityDef compActDef = (CompositeActivityDef)actDef;
@@ -121,32 +130,32 @@ public class ElemActDefOutcomeHandler extends VertexPropertyPanel implements Out
exportScript((String)vert.getProperties().get("RoutingScriptName"), (String)vert.getProperties().get("RoutingScriptVersion"), dir);
}
GraphableVertex[] childDefs = compActDef.getLayoutableChildren();
- for (int i=0; i<childDefs.length; i++) {
- if (childDefs[i] instanceof ActivitySlotDef)
- exportAct(dir, ((ActivitySlotDef)childDefs[i]).getTheActivityDef());
+ for (GraphableVertex childDef : childDefs) {
+ if (childDef instanceof ActivitySlotDef)
+ exportAct(dir, ((ActivitySlotDef)childDef).getTheActivityDef());
}
}
}
-
+
public static void exportScript(String name, String version, File dir) {
if (name == null || name.length()==0) return;
try {
- FileStringUtility.string2File(new File(dir, name+"_"+version+".xml"),
+ FileStringUtility.string2File(new File(dir, name+"_"+version+".xml"),
LocalObjectLoader.getScript(name, version));
} catch (Exception ex) {
Logger.error(ex);
JOptionPane.showMessageDialog(null, "Could not export script "+name+"_"+version, "Error", JOptionPane.ERROR_MESSAGE);
}
}
-
+
public static void exportSchema(String name, String version, File dir) {
if (name == null || name.length()==0) return;
try {
- FileStringUtility.string2File(new File(dir, name+"_"+version+".xsd"),
+ FileStringUtility.string2File(new File(dir, name+"_"+version+".xsd"),
LocalObjectLoader.getSchema(name, Integer.parseInt(version)).schema);
} catch (Exception ex) {
Logger.error(ex);
JOptionPane.showMessageDialog(null, "Could not export schema "+name+"_"+version, "Error", JOptionPane.ERROR_MESSAGE);
}
- }
+ }
}