|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--abbot.script.ComponentReference
Encapsulate as much information as is available to identify a GUI
component. Usage:
<component id="..." class="..." [...]>
A number of optional tags are supported to provide an increasingly precise
specification of the desired component:tag
a class-specific identifier, e.g. the label on a
JButton.name
the Component name, as set by
setName()
. Note that auto-generated names for windows and
frames are ignored and are considered to be null.
parent
the reference id of this component's
parent.
Field Summary | |
static int |
MW_FAILURE
Match weight corresponding to no possible match. |
static Collection |
VALID_ATTRIBUTES
|
Fields inherited from interface abbot.script.Tags |
TAG_ACTION, TAG_ARGS, TAG_ASSERT, TAG_AWTTESTSCRIPT, TAG_CALL, TAG_CLASS, TAG_CLASSPATH, TAG_COMMENT, TAG_COMPONENT, TAG_COUNT, TAG_DELEGATE, TAG_DESC, TAG_DOCBASE, TAG_EVENT, TAG_FILENAME, TAG_FORKED, TAG_HEIGHT, TAG_HORDER, TAG_ID, TAG_INDEX, TAG_INVERT, TAG_INVOKER, TAG_KEYCHAR, TAG_KEYCODE, TAG_KIND, TAG_LAUNCH, TAG_METHOD, TAG_MODIFIERS, TAG_NAME, TAG_PARAMS, TAG_PARENT, TAG_POLL_INTERVAL, TAG_PROPERTY, TAG_SAMPLE, TAG_SCRIPT, TAG_SEQUENCE, TAG_SLOW, TAG_STOP_ON_ERROR, TAG_STOP_ON_FAILURE, TAG_TAG, TAG_TERMINATE, TAG_THREADED, TAG_TIMEOUT, TAG_TITLE, TAG_TRIGGER, TAG_TYPE, TAG_VALUE, TAG_VMARGS, TAG_VORDER, TAG_WAIT, TAG_WIDTH, TAG_WINDOW, TAG_X, TAG_Y |
Constructor Summary | |
ComponentReference(Resolver resolver,
Class cls,
Map attributes)
|
|
ComponentReference(Resolver resolver,
Component comp)
Create a reference based on the given component. |
|
ComponentReference(Resolver resolver,
Component comp,
boolean resolve)
Create a reference based on the given component. |
|
ComponentReference(Resolver resolver,
org.jdom.Element el)
For creation from XML. |
|
ComponentReference(String id,
Class compClass)
For general component lookup by class name. |
|
ComponentReference(String id,
Class compClass,
String name,
String tag)
For general component lookup. |
|
ComponentReference(String id,
Class compClass,
String name,
String tag,
String title)
For general component lookup. |
|
ComponentReference(String id,
Class compClass,
String name,
String tag,
String title,
ComponentReference parent,
int index)
For general component lookup. |
|
ComponentReference(String id,
Class compClass,
String name,
String tag,
String title,
ComponentReference parent,
int index,
ComponentReference invokerOrWindow)
For general component lookup. |
Method Summary | |
boolean |
equals(Object obj)
Two ComponentReferences with identical XML representations should be equal. |
Component |
findInHierarchy(ComponentFinder finder)
Using the given finder to read the current hierarchy, match this reference against an existing component. |
void |
fromXML(String xml)
Set all options based on the given XML. |
String |
getAttribute(String key)
|
String |
getID()
|
int |
getIndex()
Deprecated. use getAttribute(TAG_INDEX) instead. |
String |
getInvokerID()
Deprecated. use getAttribute(TAG_INVOKER) instead. |
ComponentReference |
getInvokerReference()
|
(package private) int |
getMatchWeight(Component comp)
Return a measure of how well the given component matches the given component reference. |
String |
getName()
Deprecated. use getAttribute(TAG_NAME) instead. |
(package private) static String |
getOrder(Component original,
Component[] matchList,
boolean horizontal)
Return the order of the given component among the array given, sorted by horizontal or vertical screen position. |
ComponentReference |
getParentReference()
|
String |
getRefClassName()
|
String |
getTag()
Deprecated. use getAttribute(TAG_TAG) instead. |
String |
getTitle()
Deprecated. use getAttribute(TAG_TITLE) instead. |
String |
getWindowID()
Deprecated. use getAttribute(TAG_WINDOW) instead. |
ComponentReference |
getWindowReference()
Reference ID of this component's parent window (optional). |
boolean |
isAssignableFrom(Class cls)
Return whether this reference has the same class or is a superclass of the given component's class. |
static ComponentReference |
matchExisting(Component comp,
Collection existing)
Match the given component against an existing set of references. |
(package private) void |
setAttribute(String key,
String value)
For package-level testing only. |
String |
toEditableString()
Provide an editable string representation of the object. |
String |
toString()
Return a human-readable representation. |
org.jdom.Element |
toXML()
Provide an XML representation of the object. |
String |
toXMLString()
|
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int MW_FAILURE
public static final Collection VALID_ATTRIBUTES
Constructor Detail |
public ComponentReference(String id, Class compClass)
id
- Desired ID for the reference. Only used if this reference is
to be passed as the parent, window, or invoker of another.compClass
- Class of the component (required)public ComponentReference(String id, Class compClass, String name, String tag)
id
- Desired ID for the reference. Only used if this reference is
to be passed as the parent, window, or invoker of another.compClass
- Class of the component (required)name
- Name of the component, or nulltag
- Tag as returned by ComponentTester.getTag(Component)public ComponentReference(String id, Class compClass, String name, String tag, String title)
id
- Desired ID for the reference. Only used if this reference is
to be passed as the parent, window, or invoker of another.compClass
- Class of the component (required)name
- Name of the component, or nulltag
- Tag as returned by ComponentTester.getTag(Component)title
- Owning Frame/Dialog title, or nullpublic ComponentReference(String id, Class compClass, String name, String tag, String title, ComponentReference parent, int index)
id
- Desired ID for the reference. Only used if this reference is
to be passed as the parent, window, or invoker of another.compClass
- Class of the component (required)name
- Name of the component, or nulltag
- Tag as returned by ComponentTester.getTag(Component)title
- Owning Frame/Dialog title, or nullparent
- Reference to parent, or nullindex
- Index within parent, or -1public ComponentReference(String id, Class compClass, String name, String tag, String title, ComponentReference parent, int index, ComponentReference invokerOrWindow)
id
- Desired ID for the reference. Only used if this reference is
to be passed as the parent, window, or invoker of another.compClass
- Class of the component (required)name
- Name of the component, or nulltag
- Tag as returned by ComponentTester.getTag(Component)title
- Owning Frame/Dialog title, or nullparent
- Reference to parent, or nullindex
- Index within parent, or -1invokerOrWindow
- Window reference, invoker, or nullpublic ComponentReference(Resolver resolver, org.jdom.Element el) throws InvalidScriptException
public ComponentReference(Resolver resolver, Class cls, Map attributes)
public ComponentReference(Resolver resolver, Component comp)
public ComponentReference(Resolver resolver, Component comp, boolean resolve)
resolve
is true.Method Detail |
public String getID()
public String getRefClassName()
public String getAttribute(String key)
void setAttribute(String key, String value)
public boolean isAssignableFrom(Class cls)
public ComponentReference getParentReference()
public ComponentReference getWindowReference()
public ComponentReference getInvokerReference()
public void fromXML(String xml) throws InvalidScriptException
public org.jdom.Element toXML()
XMLifiable
toXML
in interface XMLifiable
public String toEditableString()
XMLifiable
toEditableString
in interface XMLifiable
public boolean equals(Object obj)
equals
in class Object
public String toString()
toString
in class Object
public String toXMLString()
static String getOrder(Component original, Component[] matchList, boolean horizontal)
int getMatchWeight(Component comp)
In general, we want to match if we get any weight at all, and there's only one component that matches.
public static ComponentReference matchExisting(Component comp, Collection existing)
public Component findInHierarchy(ComponentFinder finder) throws ComponentNotFoundException, MultipleComponentsFoundException
public String getName()
public String getTag()
public String getInvokerID()
public String getWindowID()
public String getTitle()
public int getIndex()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |