KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > designer > ResultEdge


1 package com.opensymphony.workflow.designer;
2
3 import java.awt.*;
4
5 import com.opensymphony.workflow.loader.ResultDescriptor;
6 import com.opensymphony.workflow.designer.views.EdgeRouter;
7 import org.jgraph.graph.GraphConstants;
8
9 /**
10  * @author Hani Suleiman (hani@formicary.net)
11  * Date: May 20, 2003
12  * Time: 3:27:52 PM
13  */

14 public class ResultEdge extends WorkflowEdge
15 {
16   private static final EdgeRouter EDGE_ROUTER = new EdgeRouter();
17   private int index;
18
19   private ResultDescriptor descriptor;
20
21   public ResultEdge(ResultDescriptor descriptor, Point labelPos)
22   {
23     setDescriptor(descriptor);
24     int arrow = GraphConstants.ARROW_CLASSIC;
25     GraphConstants.setLineEnd(attributes, arrow);
26     GraphConstants.setEndFill(attributes, true);
27     GraphConstants.setDisconnectable(attributes, true);
28     GraphConstants.setRouting(attributes, EDGE_ROUTER);
29     if(labelPos!=null)
30     {
31       GraphConstants.setLabelPosition(attributes, labelPos);
32     }
33   }
34
35   public ResultDescriptor getDescriptor()
36   {
37     return descriptor;
38   }
39
40   public void setDescriptor(ResultDescriptor descriptor)
41   {
42     this.descriptor = descriptor;
43   }
44
45   /**
46    * The index of the result.
47    * For any given source and target, each result between them
48    * (in any direction) will have a unique index.
49    * @return
50    */

51   public int getIndex()
52   {
53     return index;
54   }
55
56   public void setIndex(int index)
57   {
58     this.index = index;
59   }
60 }
61
Popular Tags