01: package org.enhydra.jawe.components.graph.actions;
02:
03: import java.awt.event.ActionEvent;
04:
05: import org.enhydra.jawe.ActionBase;
06: import org.enhydra.jawe.JaWEComponent;
07: import org.enhydra.jawe.JaWEManager;
08: import org.enhydra.jawe.base.controller.JaWEController;
09: import org.enhydra.jawe.components.graph.Graph;
10: import org.enhydra.jawe.components.graph.GraphController;
11: import org.enhydra.jawe.components.graph.GraphManager;
12: import org.enhydra.jawe.components.graph.WorkflowElement;
13: import org.enhydra.shark.xpdl.XMLElement;
14: import org.enhydra.shark.xpdl.XMLUtil;
15: import org.enhydra.shark.xpdl.elements.Participant;
16:
17: /*
18: * @author Harald Meister harald.meister@abacus.ch
19: * @author Sasa Bojanic
20: */
21: public class MoveParticipants extends ActionBase {
22:
23: boolean movingUp = true;
24:
25: public MoveParticipants(JaWEComponent jawecomponent) {
26: super (jawecomponent);
27: }
28:
29: public void enableDisableAction() {
30: GraphController gc = (GraphController) jawecomponent;
31: JaWEController jc = JaWEManager.getInstance()
32: .getJaWEController();
33: Graph selectedGraph = gc.getSelectedGraph();
34: boolean en = false;
35: if (selectedGraph != null) {
36: XMLElement el = selectedGraph.getXPDLObject();
37: if (XMLUtil.getPackage(el) == jc.getMainPackage()) {
38: Object[] scells = selectedGraph.getSelectionCells();
39: if (scells != null
40: && scells.length == 1
41: && ((WorkflowElement) scells[0])
42: .getPropertyObject() instanceof Participant) {
43: en = true;
44: }
45: }
46: }
47:
48: setEnabled(en);
49: }
50:
51: public MoveParticipants(JaWEComponent jawecomponent,
52: boolean movingUp) {
53: super (jawecomponent);
54: this .movingUp = movingUp;
55: }
56:
57: public void actionPerformed(ActionEvent e) {
58: GraphController gcon = (GraphController) jawecomponent;
59: Graph selectedGraph = gcon.getSelectedGraph();
60: if (selectedGraph == null)
61: return;
62:
63: Object[] cells = selectedGraph.getSelectionCells();
64: GraphManager gm = selectedGraph.getGraphManager();
65: gm.moveParticipants(cells, movingUp);
66:
67: }
68:
69: }
|