01: package abbot.tester.extensions;
02:
03: import java.awt.*;
04:
05: import abbot.*;
06: import abbot.tester.*;
07: import org.jgraph.JGraph;
08: import org.jgraph.graph.*;
09:
10: /** Provide user actions on an instance of {@link JGraph}.
11: The substructure for {@link JGraph} is a cell (vertex or edge).
12: This class provides an example of a {@link ComponentTester} extension.
13:
14: @see JGraphLocation
15: */
16:
17: // TODO: marquee selection
18: // TODO: multi-selection (can this be generalized?)
19: // maybe multi-select(begin, end)
20: // multi-select(array) (discontiguous)
21: public class JGraphTester extends JComponentTester {
22:
23: /** Select a single cell. */
24: public void actionSelectCell(Component c, ComponentLocation loc) {
25: actionClick(c, loc);
26: }
27:
28: public ComponentLocation parseLocation(String encoded) {
29: return new JGraphLocation().parse(encoded);
30: }
31:
32: /** Returns a {@link JGraphLocation} corresponding to the given
33: {@link Point} location. If there is no object at that location,
34: the raw {@link Point} is used. If there is an object, and its
35: {@link CellView}'s {@link Object#toString()} looks meaningful, that is
36: used, otherwise the object's index is used.
37: */
38: public ComponentLocation getLocation(Component c, Point p) {
39: //JGraph graph = (JGraph)c;
40: // FIXME
41: return new JGraphLocation(p);
42: }
43: }
|