Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

abbot.script
Class ComponentReference  view ComponentReference download ComponentReference.java

java.lang.Object
  extended byabbot.script.ComponentReference
All Implemented Interfaces:
Tags, XMLifiable

public class ComponentReference
extends java.lang.Object
implements Tags, XMLifiable

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:
(This list subject to change as required by the DefaultComponentFinder).


Field Summary
private static java.lang.String CR_USAGE
           
private  abbot.ComponentFinder finder
           
private  java.lang.String id
           
private  int index
           
private  java.lang.String invokerID
           
private  ComponentReference invokerReference
           
private  java.lang.String name
           
private  java.lang.String parentID
           
private  ComponentReference parentReference
           
private  java.awt.Point point
           
private  java.lang.String refClassName
           
private  abbot.Resolver resolver
           
private  java.lang.String tag
           
private  java.lang.String title
           
private  java.lang.String windowID
           
private  ComponentReference windowReference
           
 
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_EVENT, TAG_FILENAME, TAG_FORKED, TAG_ID, TAG_INDEX, TAG_INVERT, TAG_INVOKER, TAG_KEYCHAR, TAG_KEYCODE, TAG_KIND, TAG_LAUNCH, TAG_METHOD, TAG_MODIFIERS, TAG_NAME, TAG_PARENT, TAG_POLL_INTERVAL, 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_WAIT, TAG_WINDOW, TAG_X, TAG_Y
 
Constructor Summary
ComponentReference(abbot.Resolver resolver, java.awt.Component comp)
          Create a reference based on the given component.
ComponentReference(abbot.Resolver resolver, org.jdom.Element el)
          For creation from XML.
ComponentReference(java.lang.String id, java.lang.Class compClass)
          For general component lookup by class name.
ComponentReference(java.lang.String id, java.lang.Class compClass, java.lang.String name, java.lang.String tag)
          For general component lookup.
ComponentReference(java.lang.String id, java.lang.Class compClass, java.lang.String name, java.lang.String tag, java.lang.String title)
          For general component lookup.
ComponentReference(java.lang.String id, java.lang.Class compClass, java.lang.String name, java.lang.String tag, java.lang.String title, ComponentReference parent, int index)
          For general component lookup.
ComponentReference(java.lang.String id, java.lang.Class compClass, java.lang.String name, java.lang.String tag, java.lang.String title, ComponentReference parent, int index, ComponentReference invokerOrWindow)
          For general component lookup.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Two ComponentReferences with identical XML representations should be equal.
private  void fromXML(org.jdom.Element el, boolean useGivenID)
          Parse settings from the given XML.
 void fromXML(java.lang.String xml)
          Set all options based on the given XML.
 java.lang.String getID()
          Unique identifier for this component.
 int getIndex()
          Index among parent's children (optional).
 java.awt.Point getInvocationLocation()
           
 java.lang.String getInvokerID()
          Invoker of a JPopupMenu.
 ComponentReference getInvokerReference()
           
 java.lang.String getName()
          This component's name, null if no name was set.
 java.lang.String getParentID()
          Reference ID of this component's parent (optional).
 ComponentReference getParentReference()
           
 java.lang.String getRefClassName()
          This component's class name.
 java.lang.String getTag()
          Returns a component class-specific tag used to match this reference to a real component.
 java.lang.String getTitle()
          Title string of this component's parent frame (optional).
 java.lang.String getWindowID()
          Reference ID of this component's parent window (optional).
 ComponentReference getWindowReference()
           
 int hashCode()
          Two ComponentReferences with identical XML representations should have the same hash code.
 boolean isAssignableFrom(java.lang.Class cls)
          Return whether this reference has the same class or is a superclass of the given component's class.
 java.lang.String toEditableString()
          Provide an editable string representation of the object.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 org.jdom.Element toXML()
          Provide an XML representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CR_USAGE

private static final java.lang.String CR_USAGE
See Also:
Constant Field Values

resolver

private abbot.Resolver resolver

finder

private abbot.ComponentFinder finder

id

private java.lang.String id

name

private java.lang.String name

refClassName

private java.lang.String refClassName

parentID

private java.lang.String parentID

parentReference

private ComponentReference parentReference

index

private int index

windowID

private java.lang.String windowID

windowReference

private ComponentReference windowReference

title

private java.lang.String title

tag

private java.lang.String tag

invokerID

private java.lang.String invokerID

invokerReference

private ComponentReference invokerReference

point

private java.awt.Point point
Constructor Detail

ComponentReference

public ComponentReference(java.lang.String id,
                          java.lang.Class compClass)
For general component lookup by class name.


ComponentReference

public ComponentReference(java.lang.String id,
                          java.lang.Class compClass,
                          java.lang.String name,
                          java.lang.String tag)
For general component lookup.


ComponentReference

public ComponentReference(java.lang.String id,
                          java.lang.Class compClass,
                          java.lang.String name,
                          java.lang.String tag,
                          java.lang.String title)
For general component lookup.


ComponentReference

public ComponentReference(java.lang.String id,
                          java.lang.Class compClass,
                          java.lang.String name,
                          java.lang.String tag,
                          java.lang.String title,
                          ComponentReference parent,
                          int index)
For general component lookup.


ComponentReference

public ComponentReference(java.lang.String id,
                          java.lang.Class compClass,
                          java.lang.String name,
                          java.lang.String tag,
                          java.lang.String title,
                          ComponentReference parent,
                          int index,
                          ComponentReference invokerOrWindow)
For general component lookup.


ComponentReference

public ComponentReference(abbot.Resolver resolver,
                          org.jdom.Element el)
                   throws InvalidScriptException
For creation from XML.


ComponentReference

public ComponentReference(abbot.Resolver resolver,
                          java.awt.Component comp)
Create a reference based on the given component. May recursively add other components required to identify this one.

Method Detail

getID

public java.lang.String getID()
Unique identifier for this component.


getName

public java.lang.String getName()
This component's name, null if no name was set.


getRefClassName

public java.lang.String getRefClassName()
This component's class name.


isAssignableFrom

public boolean isAssignableFrom(java.lang.Class cls)
Return whether this reference has the same class or is a superclass of the given component's class. Simply compare class names to avoid class loader conflicts. Note that this does not take into account interfaces (which is okay, since with GUI components we're only concerned with class inheritance).


getParentID

public java.lang.String getParentID()
Reference ID of this component's parent (optional).


getParentReference

public ComponentReference getParentReference()

getIndex

public int getIndex()
Index among parent's children (optional).


getWindowID

public java.lang.String getWindowID()
Reference ID of this component's parent window (optional).


getWindowReference

public ComponentReference getWindowReference()

getTitle

public java.lang.String getTitle()
Title string of this component's parent frame (optional).


getInvokerID

public java.lang.String getInvokerID()
Invoker of a JPopupMenu.


getInvokerReference

public ComponentReference getInvokerReference()

getInvocationLocation

public java.awt.Point getInvocationLocation()

getTag

public java.lang.String getTag()
Returns a component class-specific tag used to match this reference to a real component.


fromXML

public void fromXML(java.lang.String xml)
             throws InvalidScriptException
Set all options based on the given XML.


fromXML

private void fromXML(org.jdom.Element el,
                     boolean useGivenID)
              throws InvalidScriptException
Parse settings from the given XML. Only overwrite the ID if useGivenID is set.


toXML

public org.jdom.Element toXML()
Description copied from interface: XMLifiable
Provide an XML representation of the object.

Specified by:
toXML in interface XMLifiable

toEditableString

public java.lang.String toEditableString()
Description copied from interface: XMLifiable
Provide an editable string representation of the object. Usually will be a String form of the XML, but may be something simpler if it doesn't make sense to provide the full XML.

Specified by:
toEditableString in interface XMLifiable

hashCode

public int hashCode()
Two ComponentReferences with identical XML representations should have the same hash code.


equals

public boolean equals(java.lang.Object obj)
Two ComponentReferences with identical XML representations should be equal.


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).