Source code: giny/view/EdgeView.java
1 package giny.view;
2
3 import java.awt.*;
4 import java.awt.geom.*;
5 import giny.model.*;
6
7
8 public interface EdgeView {
9
10 /**
11 * Draws splined curves for edges.
12 */
13 public static int CURVED_LINES = 1;
14
15 /**
16 * Draws straight lines for edges.
17 */
18 public static int STRAIGHT_LINES = 2;
19
20 /**
21 * An Edge End That Looks Like An Arrow
22 */
23 public static int ARROW_END = 1;
24
25 /**
26 * An Edge End That Looks Like A Circle
27 */
28 public static int CIRCLE_END = 2;
29
30 /**
31 * An Edge End That Looks Like A Diamond
32 */
33 public static int DIAMOND_END = 3;
34
35 /**
36 * An Edge End That Looks Like A "T"
37 */
38 public static int T_END = 4;
39
40 //------------------------------------------------------//
41 // Get and Set Methods for all Common Viewable Elements
42 //------------------------------------------------------//
43
44 /**
45 * @return the index of this edge in the GraphPerspective
46 */
47 public int getGraphPerspectiveIndex ();
48
49 /**
50 * @return the Edge to which we are a view on
51 */
52 public Edge getEdge();
53
54 /**
55 * @return the GraphView we are in
56 */
57 public GraphView getGraphView ();
58
59 /**
60 * @param width set a new line width for this edge
61 */
62 public void setStrokeWidth ( float width );
63
64 /**
65 * @return the currently set edge width
66 */
67 public float getStrokeWidth ();
68
69 /**
70 * @param stroke the stroke to use on this edge
71 */
72 public void setStroke ( Stroke stroke );
73
74 /**
75 * @return the stroke used on this edge
76 */
77 public Stroke getStroke ();
78
79 /**
80 * @param line_type set a new line type for the edge
81 */
82 public void setLineType ( int line_type );
83
84 /**
85 * @return the currently set edge line type
86 */
87 public int getLineType ();
88
89 /**
90 * This really refers to the <B>Stroke</B>,
91 * TODO: Make separte stroke methods
92 * @param paint the paint for this node
93 */
94 public void setUnselectedPaint ( Paint paint );
95
96 /**
97 * This really refers to the <B>Stroke</B>,
98 * TODO: Make separte stroke methods
99 * @return the currently set edge Paint
100 */
101 public Paint getUnselectedPaint ();
102
103 /**
104 * This really refers to the <B>Stroke</B>,
105 * TODO: Make separte stroke methods
106 * @param paint the paint for this node
107 */
108 public void setSelectedPaint ( Paint paint );
109
110 /**
111 * This really refers to the <B>Stroke</B>,
112 * TODO: Make separte stroke methods
113 * @return the currently set edge Selectionpaint
114 */
115 public Paint getSelectedPaint ();
116
117 /**
118 * @return the currently set Source Edge End Type
119 */
120 public Paint getSourceEdgeEndPaint ();
121
122 /**
123 * @return the currently set Source Edge End Type
124 */
125 public Paint getSourceEdgeEndSelectedPaint ();
126
127 /**
128 * @return the currently set Target Edge End Type
129 */
130 public Paint getTargetEdgeEndPaint ();
131
132 /**
133 * @return the currently set Target Edge End Type
134 */
135 public Paint getTargetEdgeEndSelectedPaint ();
136
137 /**
138 * @param paint set the value for the source edge end when selected
139 */
140 public void setSourceEdgeEndSelectedPaint ( Paint paint );
141
142 /**
143 * @param paint set the value for the target edge end when selected
144 */
145 public void setTargetEdgeEndSelectedPaint ( Paint paint );
146
147 /**
148 * @param paint the new paint for the stroke of the source eged end
149 */
150 public void setSourceEdgeEndStrokePaint ( Paint paint );
151
152 /**
153 * @param paint the new paint for the stroke of the target eged end
154 */
155 public void setTargetEdgeEndStrokePaint ( Paint paint );
156
157 /**
158 * @param paint set the value for the source edge end
159 */
160 public void setSourceEdgeEndPaint ( Paint paint );
161
162 /**
163 * @param paint set the value for the target edge end
164 */
165 public void setTargetEdgeEndPaint ( Paint paint );
166
167
168 /**
169 * When we are selected then we draw ourselves red, and draw any handles.
170 */
171 public boolean setSelected ( boolean state );
172
173 /**
174 * @return selcted state
175 */
176 public boolean isSelected ();
177
178 /**
179 * @return selcted state
180 */
181 public boolean getSelected ();
182
183 /**
184 * Add a PHandle to the edge at the point specified.
185 *
186 * @param pt The point at which to draw the PHandle and to which the
187 * PHandle will be attached via the locator.
188 */
189 // public void addHandle ( Point2D pt );
190
191 /**
192 * Removes the PHandle at the specified point.
193 *
194 * @param pt If this point intersects an existing PHandle, then remove that
195 * PHandle.
196 */
197 // public void removeHandle ( Point2D pt );
198
199 /**
200 * Checks to see if a PHandle already exists for the given point.
201 *
202 * @param pt If this point intersects a currently existing PHandle, then
203 * return true, else return false.
204 */
205 //public boolean handleAlreadyExists ( Point2D pt );
206
207 /**
208 * This is the main method called to update the drawing of the edge.
209 */
210 public void updateEdgeView ();
211
212 /**
213 * Draws the EdgeEnd, also sets the Source/Target Points to values such
214 * that the edge does not "go through" the end
215 */
216 public void updateTargetArrow ();
217
218 /**
219 * Draws the EdgeEnd, also sets the Source/Target Points to values such
220 * that the edge does not "go through" the end
221 */
222 public void updateSourceArrow ();
223
224 /**
225 * Sets the Drawing style for the edge end.
226 */
227 public void setSourceEdgeEnd(int type);
228
229 /**
230 * Sets the Drawing style for the edge end.
231 */
232 public void setTargetEdgeEnd(int type);
233
234 /**
235 * Draws the Edge
236 */
237 public void updateLine();
238
239 /**
240 * Draws the edge as red and draws any handles previously added.
241 */
242 public void drawSelected();
243
244 /**
245 * Draws the edge as black and removes any handles from the display.
246 */
247 public void drawUnselected();
248
249 /**
250 * @return the Bend used
251 */
252 public Bend getBend ();
253
254
255 }