1 package com.opensymphony.workflow.designer.actions; 2 3 import java.awt.Point ; 4 import java.awt.event.ActionEvent ; 5 6 import javax.swing.AbstractAction ; 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 20 public class Delete extends AbstractAction 21 { 22 private WorkflowDescriptor workflow; 23 private WorkflowGraph graph; 24 private Point location; 25 26 public Delete(WorkflowDescriptor workflow, WorkflowGraph graph, Point location) 27 { 28 super("Delete"); 29 this.workflow = workflow; 30 this.graph = graph; 31 this.location = location; 32 } 33 34 public void actionPerformed(ActionEvent e) 35 { 36 Object 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 |