01: package com.opensymphony.workflow.designer;
02:
03: import java.awt.Color;
04: import java.util.List;
05:
06: import org.jgraph.graph.GraphConstants;
07:
08: import com.opensymphony.workflow.loader.ActionDescriptor;
09: import com.opensymphony.workflow.loader.ConditionalResultDescriptor;
10: import com.opensymphony.workflow.loader.ResultDescriptor;
11:
12: public class InitialActionCell extends WorkflowCell implements
13: ResultAware {
14: private ActionDescriptor action;
15:
16: public void setActionDescriptor(ActionDescriptor action) {
17: this .action = action;
18: }
19:
20: public ActionDescriptor getActionDescriptor() {
21: return action;
22: }
23:
24: public InitialActionCell(String userObject) {
25: super (userObject);
26: GraphConstants.setBackground(attributes, Color.red.darker());
27: // GraphConstants.setBorder(attributes, BorderFactory.createEmptyBorder());
28: }
29:
30: public boolean removeResult(ResultDescriptor result) {
31: if (result instanceof ConditionalResultDescriptor) {
32: List list = action.getConditionalResults();
33: if (list != null) {
34: for (int i = 0; i < list.size(); i++) {
35: if (list.get(i) == result) {
36: list.remove(i);
37: return true;
38: }
39: }
40: }
41: return false;
42: } else {
43: if (action.getUnconditionalResult() == result) {
44: action.setUnconditionalResult(null);
45: return true;
46: }
47: return false;
48: }
49: }
50: }
|