01: package com.opensymphony.workflow.designer.actions;
02:
03: import java.awt.Point;
04: import java.awt.event.ActionEvent;
05:
06: import javax.swing.AbstractAction;
07:
08: import com.opensymphony.workflow.designer.*;
09: import com.opensymphony.workflow.loader.WorkflowDescriptor;
10:
11: /**
12: * User: Hani Suleiman
13: * Date: Nov 24, 2003
14: * Time: 1:10:28 PM
15: */
16: public class Delete extends AbstractAction {
17: private WorkflowDescriptor workflow;
18: private WorkflowGraph graph;
19: private Point location;
20:
21: public Delete(WorkflowDescriptor workflow, WorkflowGraph graph,
22: Point location) {
23: super ("Delete");
24: this .workflow = workflow;
25: this .graph = graph;
26: this .location = location;
27: }
28:
29: public void actionPerformed(ActionEvent e) {
30: Object cell = graph.getFirstCellForLocation(location.x,
31: location.y);
32: if (cell == null) {
33: return;
34: } else if (cell instanceof ResultEdge) {
35: // update the graph
36: graph.removeEdge((ResultEdge) cell);
37: WorkflowDesigner.INSTANCE.navigator().reloadWorkflow(
38: workflow);
39: } else if (cell instanceof StepCell) {
40: graph.removeStep((StepCell) cell);
41: //WorkflowDesigner.INSTANCE.navigator().reloadSteps(workflow);
42: WorkflowDesigner.INSTANCE.navigator().reloadWorkflow(
43: workflow);
44: } else if (cell instanceof JoinCell) {
45: graph.removeJoin((JoinCell) cell);
46: //WorkflowDesigner.INSTANCE.navigator().reloadJoins(workflow);
47: WorkflowDesigner.INSTANCE.navigator().reloadWorkflow(
48: workflow);
49: } else if (cell instanceof SplitCell) {
50: graph.removeSplit((SplitCell) cell);
51: //WorkflowDesigner.INSTANCE.navigator().reloadSplits(workflow);
52: WorkflowDesigner.INSTANCE.navigator().reloadWorkflow(
53: workflow);
54: }
55: WorkflowDesigner.INSTANCE.navigator().selectTreeNode(workflow,
56: workflow);
57: }
58:
59: }
|