View Javadoc

1   /*
2    * Copyright (c) 2005, The K-Wf Grid Consortium
3    * Fraunhofer Institute for Computer Architecture and Software Technology
4    * See http://www.kwfgrid.eu and http://www.first.fraunhofer.de for more details.
5    */
6   package net.kwfgrid.gwui.graphview;
7   
8   import net.kwfgrid.gworkflowdl.structure.Edge;
9   
10  import de.fzi.wim.guibase.graphview.graph.DefaultEdge;
11  import de.fzi.wim.guibase.graphview.graph.Node;
12  
13  import java.util.Map;
14  import java.util.Iterator;
15  import java.awt.geom.Point2D;
16  
17  /***
18     A graph edge representing a petri net arc.
19     Due to naming irritations the edge of the petri net is named 'arc' in the context of this class.
20   */
21  public abstract class ArcEdge extends DefaultEdge implements WorkflowGraphElement {
22      protected Edge _arc;
23      protected Point2D[] _cp;
24      protected Point2D _ps, _pe, _lp;
25      protected String _label;
26  
27      public ArcEdge(Node from, Node to, Edge e) {
28  	super(from, to);
29  	_arc = e;
30  	_ps = null;
31  	_pe = null;
32  	_cp = null;
33  	_lp = null;
34  	_label = null;
35      }
36      
37      public Object getStructureObject() {
38  	return _arc;
39      }
40  
41      public Edge getArc() {
42  	return _arc;
43      }
44      
45      protected void setArc(Edge arc) {
46  	_arc = arc;
47      }
48  
49      public void setLabel(String label) {
50  	_label = label;
51      }
52  
53      public String getLabel() {
54  	return _label;
55      }
56  
57      public void setControlPoints(Point2D[] cp) {
58  	_cp = cp;
59      }
60  
61      public void setPointOfArrowAtStart(Point2D ps) {
62  	_ps = ps;
63      }
64  
65      public void setPointOfArrowAtEnd(Point2D pe) {
66  	_pe = pe;
67      }
68  
69      public void setLabelPosition(Point2D lp) {
70  	_lp = lp;
71      }
72  
73      public Point2D[] getControlPoints() {
74  	return _cp;
75      }
76  
77      public Point2D getPointOfArrowAtStart() {
78  	return _ps;
79      }
80  
81      public Point2D getPointOfArrowAtEnd() {
82  	return _pe;
83      }
84  
85      public Point2D getLabelPosition() {
86  	return _lp;
87      }
88  
89      public boolean hasArrowAtStart() {
90  	return _ps != null;
91      }
92  
93      public boolean hasArrowAtEnd() {
94  	return _pe != null;
95      }
96  
97      public boolean hasLabel() {
98  	return _lp != null;
99      }
100 
101     public double getLength() {
102 	return 10;
103     }
104 
105     public abstract PlaceNode getPlace();
106     
107     public abstract TransitionNode getTransition();
108 }