1 package com.opensymphony.workflow.designer; 2 3 import java.awt.Color ; 4 import java.util.List ; 5 6 import org.jgraph.graph.GraphConstants; 7 8 import com.opensymphony.workflow.loader.ActionDescriptor; 9 import com.opensymphony.workflow.loader.ConditionalResultDescriptor; 10 import com.opensymphony.workflow.loader.ResultDescriptor; 11 12 public class InitialActionCell extends WorkflowCell implements ResultAware 13 { 14 private ActionDescriptor action; 15 16 public void setActionDescriptor(ActionDescriptor action) 17 { 18 this.action = action; 19 } 20 21 public ActionDescriptor getActionDescriptor() 22 { 23 return action; 24 } 25 26 public InitialActionCell(String userObject) 27 { 28 super(userObject); 29 GraphConstants.setBackground(attributes, Color.red.darker()); 30 } 32 33 public boolean removeResult(ResultDescriptor result) 34 { 35 if(result instanceof ConditionalResultDescriptor) 36 { 37 List list = action.getConditionalResults(); 38 if(list != null) 39 { 40 for(int i = 0; i < list.size(); i++) 41 { 42 if(list.get(i) == result) 43 { 44 list.remove(i); 45 return true; 46 } 47 } 48 } 49 return false; 50 } 51 else 52 { 53 if(action.getUnconditionalResult() == result) 54 { 55 action.setUnconditionalResult(null); 56 return true; 57 } 58 return false; 59 } 60 } 61 } 62 63 | Popular Tags |