KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > designer > actions > Delete


1 package com.opensymphony.workflow.designer.actions;
2
3 import java.awt.Point JavaDoc;
4 import java.awt.event.ActionEvent JavaDoc;
5
6 import javax.swing.AbstractAction JavaDoc;
7
8 import com.opensymphony.workflow.designer.JoinCell;
9 import com.opensymphony.workflow.designer.ResultEdge;
10 import com.opensymphony.workflow.designer.SplitCell;
11 import com.opensymphony.workflow.designer.StepCell;
12 import com.opensymphony.workflow.designer.WorkflowGraph;
13 import com.opensymphony.workflow.loader.WorkflowDescriptor;
14
15 /**
16  * User: Hani Suleiman
17  * Date: Nov 24, 2003
18  * Time: 1:10:28 PM
19  */

20 public class Delete extends AbstractAction JavaDoc
21 {
22   private WorkflowDescriptor workflow;
23   private WorkflowGraph graph;
24   private Point JavaDoc location;
25
26   public Delete(WorkflowDescriptor workflow, WorkflowGraph graph, Point JavaDoc location)
27   {
28     super("Delete");
29     this.workflow = workflow;
30     this.graph = graph;
31     this.location = location;
32   }
33
34   public void actionPerformed(ActionEvent JavaDoc e)
35   {
36     Object JavaDoc cell = graph.getFirstCellForLocation(location.x, location.y);
37     if(cell == null)
38     {
39       return;
40     }
41     else if(cell instanceof ResultEdge)
42     {
43       graph.removeEdge((ResultEdge)cell);
44     }
45     else if(cell instanceof StepCell)
46     {
47       graph.removeStep((StepCell)cell);
48     }
49     else if(cell instanceof JoinCell)
50     {
51       graph.removeJoin((JoinCell)cell);
52     }
53     else if(cell instanceof SplitCell)
54     {
55       graph.removeSplit((SplitCell)cell);
56     }
57   }
58
59 }
60
Popular Tags