|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object abbot.tester.ComponentLocation
public class ComponentLocation
Provides encapsulation of a visible Component-relative location. "Visible" in this context means currently accessible by the pointer (possibly via scrolling). A hidden node in a collapsed tree path would not be considered visible.
This class the specifics of location so that ComponentTester
primitives
(ComponentTester.actionClick(Component,ComponentLocation)
,
ComponentTester.actionShowPopupMenu(Component,ComponentLocation)
,
etc) may be directed to specific elements of
substructure on a Component
(list rows, tree paths, table
cells, substructure values, etc.).
Classes derived from ComponentLocation
should provide
constructors for each type of location indication, e.g. value, index, and
Point
. The toString()
method should provide an encoded
String
suitable for use by the parse(String)
method, which
must convert the String
encoding back into a proper
ComponentLocation
.
By convention, Point
locations are specified with (x,y) notation.
Indexed locations should use square brackets, e.g. [i] or [r,c] and
value locations should use a quoted String
, e.g.
'"cuckoo for cocoa puffs"'. The specific syntax allowed will vary by
specific ComponentLocation
type. The base
ComponentLocation
implementation
supports only the explicit (x,y) notation.
Recorders
should use the String
value by default for consistency. The
special value CENTER
is provided to indicate the center of a
Component
.
The method badFormat(String)
should provide usage-like information
indicating the acceptable forms of input for this class.
JListLocation
,
JTreeLocation
,
JTableLocation
Field Summary | |
---|---|
static String |
CENTER
Special ComponentLocation encoding which represents
the center of the component. |
Constructor Summary | |
---|---|
ComponentLocation()
Create a simple location which represents the center of a component. |
|
ComponentLocation(Point where)
Create a simple location. |
Method Summary | |
---|---|
protected String |
badFormat(String encoded)
|
protected String |
encodeIndex(int index)
|
protected String |
encodeValue(String value)
|
boolean |
equals(Object o)
Returns whether the given object is an equivalent ComponentLocation . |
Rectangle |
getBounds(Component c)
Convert the abstract location into a concrete area, relative to the given Component . |
Point |
getPoint(Component c)
Convert the abstract location into a concrete one. |
protected boolean |
isIndex(String encoded)
Returns whether the given (trimmed) String is an encoded
index. |
protected boolean |
isValue(String encoded)
Returns whether the given (trimmed) String is an encoded
value. |
ComponentLocation |
parse(String encoded)
Convert the given encoding into the proper location. |
protected int |
parseIndex(String encoded)
Extract the encoded index. |
protected String |
parseValue(String encoded)
Extract the encoded value. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String CENTER
ComponentLocation
encoding which represents
the center of the component.
Constructor Detail |
---|
public ComponentLocation()
public ComponentLocation(Point where)
Method Detail |
---|
public Point getPoint(Component c) throws LocationUnavailableException
Point
relative to the given Component
.
LocationUnavailableException
public Rectangle getBounds(Component c) throws LocationUnavailableException
Component
. If a point has
been specified, returns a 1x1 rectangle, otherwise returns the
a rectangle at (0, 0) of the Component's size.
LocationUnavailableException
public boolean equals(Object o)
ComponentLocation
.
equals
in class Object
public String toString()
toString
in class Object
protected String badFormat(String encoded)
protected String encodeIndex(int index)
protected boolean isIndex(String encoded)
String
is an encoded
index.
protected int parseIndex(String encoded)
protected String encodeValue(String value)
protected boolean isValue(String encoded)
String
is an encoded
value.
protected String parseValue(String encoded)
public ComponentLocation parse(String encoded)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |