Source code: giny/view/Bend.java
1 package giny.view;
2
3 import java.awt.*;
4 import java.awt.event.*;
5 import java.awt.geom.*;
6 import java.util.*;
7
8 /**
9 * A class that encapsulates the representation of the bend used for a
10 * particular EdgeView.
11 *
12 * @author Mike Smoot (mes5k)
13 */
14 public interface Bend {
15
16 /**
17 * Given a list of points removes all existing handles/handlePoints
18 * and adds new ones for those specified in the List.
19 * @param bendPoints A list of Point2Ds to create new handles.
20 */
21 public void setHandles( java.util.List bendPoints );
22
23 /**
24 * Returns a (new) List of clones of the Point2Ds that locate the handles.
25 */
26 public java.util.List getHandles();
27
28 /**
29 * Moves the handle specified at the given index to the given point.
30 * @param i Index of the handle to move.
31 * @param pt Point2D to which to move the specified handle.
32 */
33 public void moveHandle( int i, Point2D pt );
34
35 /**
36 * Returns the handle Point2D closest to the source node.
37 */
38 public Point2D getSourceHandlePoint ();
39
40 /**
41 * Returns the handle Point2D closest to the target node.
42 */
43 public Point2D getTargetHandlePoint ();
44
45 /**
46 * Add a PHandle to the edge at the point specified. Acts as
47 * an interface to actuallyAddHandle() which does the actual adding.
48 *
49 * @param pt The point at which to draw the PHandle and to which the
50 * PHandle will be attached via the locator.
51 */
52 public void addHandle ( Point2D pt );
53
54 /**
55 * Add a PHandle to the edge at the point and index specified. Acts as
56 * an interface to actuallyAddHandle() which does the actual adding.
57 *
58 * @param insertIndex The index at which to add the PHandle to the
59 * list of handles.
60 * @param pt The point at which to draw the PHandle and to which the
61 * PHandle will be attached via the locator.
62 */
63 public void addHandle ( int insertIndex , Point2D pt );
64
65
66 /**
67 * Removes the PHandle at the specified point.
68 *
69 * @param pt If this point intersects an existing PHandle, then remove that
70 * PHandle.
71 */
72 public void removeHandle ( Point2D pt );
73
74
75
76 /**
77 * Removes the PHandle at the given index.
78 *
79 * @param i The index of the PHandle to remove.
80 */
81 public void removeHandle ( int i );
82
83 /**
84 * Checks to see if a PHandle already exists for the given point.
85 *
86 * @param pt If this point intersects a currently existing PHandle, then
87 * return true, else return false.
88 */
89 public boolean handleAlreadyExists ( Point2D pt );
90
91 /**
92 * Draws any handles previously added.
93 */
94 public void drawSelected();
95
96 /**
97 * Removes any handles from the display.
98 */
99 public void drawUnselected();
100
101 /**
102 * Returns a list of points that define what gets drawn and hence
103 * what is visible to the user.
104 */
105 public Point2D[] getDrawPoints();
106 }