abbot
Class DefaultComponentFinder

java.lang.Object
  |
  +--abbot.DefaultComponentFinder
All Implemented Interfaces:
ComponentFinder, Tags

public class DefaultComponentFinder
extends Object
implements ComponentFinder, Tags

Basic component lookup implementation.


Field Summary
static int POPUP_TIMEOUT
          Timeout for waiting on a popup menu.
 
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
 
Method Summary
(package private) static void ()
           
 void closeWindows()
          Send an explicit window close event to all showing windows.
 void disposeWindows()
          Dispose of all available windows, and does not return until they have been disposed of.
 void filterComponent(Component comp)
          Don't return the given component in any queries.
 Component findActivePopupMenu(Component invoker)
          Returns the currently active popup menu with the given invoker.
 Component findComponent(ComponentReference ref)
          Attempt to find the component corresponding to the given reference among existing, visible components.
 Component findMenuItemByName(Component root, String name)
          Look up the first menu item below root with the given title.
 Window findWindow(String nameOrTitle)
          Return the window with the given name or title.
 Frame getComponentFrame(Component comp)
          Return the component's owning frame.
 String getComponentName(Component comp)
          Return the component's name, ensuring that null is returned if the name appears to be auto-generated.
 Component getComponentParent(Component comp)
          Look up the apparent parent of a component.
 Component[] getComponents(Container c)
          Returns all components below the GUI hierarchy of the given Container, including Windows and MenuElements.
 Window getComponentTitledWindow(Component comp)
          Return the component's owning frame or dialog.
 Window getComponentWindow(Component comp)
          Return the nearest Window ancestor of the given Component.
 String getComponentWindowTitle(Component comp)
          Return the title of the nearest ancestor window with a title.
static ComponentFinder getFinder()
          This is the factory method to use unless you already know otherwise :)
static ComponentFinder getFinder(ComponentFinder context)
          This factory method allows the finder to be used where a finder already exists and is filtering components.
 Window[] getRootWindows()
          Return an array of all available Frames, across all known contexts.
 Window[] getWindows()
          Returns the set of all available windows that have not been filtered.
 Window[] getWindows(Window parent)
          Return all windows owned by the given window that have not been filtered.
 void ignoreComponent(Component comp)
          Ignore (for the purpose of future lookup) the given component.
 void ignoreExistingComponents()
          Ignore (for the purposes of future lookup) all currently available components.
 boolean isFiltered(Component comp)
          Returns true if the component or its Window ancestor is filtered.
 boolean isShowing(Component c)
          Indicates whether the given component is showing and ready for input.
 void setFilterEnabled(boolean enable)
          Indicate whether to filter component lists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POPUP_TIMEOUT

public static int POPUP_TIMEOUT
Timeout for waiting on a popup menu.
Method Detail

static void ()

getFinder

public static ComponentFinder getFinder()
This is the factory method to use unless you already know otherwise :)

getFinder

public static ComponentFinder getFinder(ComponentFinder context)
This factory method allows the finder to be used where a finder already exists and is filtering components. This should only be required in very rare cases like when the script editor needs to test itself.

findComponent

public Component findComponent(ComponentReference ref)
                        throws ComponentNotFoundException,
                               MultipleComponentsFoundException
Attempt to find the component corresponding to the given reference among existing, visible components.
Specified by:
findComponent in interface ComponentFinder
Parameters:
ref - A Component reference to use to identify a component
Returns:
The component which matches the passed in ComponentReference
Throws:
ComponentNotFoundException - if a Component cannot be located via the passed in ComponentReference
MultipleComponentsFoundException - if more then one component is found via the passed in reference

findWindow

public Window findWindow(String nameOrTitle)
                  throws ComponentNotFoundException,
                         MultipleComponentsFoundException
Return the window with the given name or title. Attempts to find a named window first, since that search is more restrictive. Regular expressions are allowed.
Specified by:
findWindow in interface ComponentFinder

findActivePopupMenu

public Component findActivePopupMenu(Component invoker)
Returns the currently active popup menu with the given invoker.
Specified by:
findActivePopupMenu in interface ComponentFinder

findMenuItemByName

public Component findMenuItemByName(Component root,
                                    String name)
Description copied from interface: ComponentFinder
Look up the first menu item below root with the given title.
Specified by:
findMenuItemByName in interface ComponentFinder

getComponentName

public String getComponentName(Component comp)
Return the component's name, ensuring that null is returned if the name appears to be auto-generated.
Specified by:
getComponentName in interface ComponentFinder

getRootWindows

public Window[] getRootWindows()
Return an array of all available Frames, across all known contexts.
Specified by:
getRootWindows in interface ComponentFinder

getWindows

public Window[] getWindows(Window parent)
Return all windows owned by the given window that have not been filtered.
Specified by:
getWindows in interface ComponentFinder

getWindows

public Window[] getWindows()
Returns the set of all available windows that have not been filtered. This includes frames and windows.
Specified by:
getWindows in interface ComponentFinder

getComponents

public Component[] getComponents(Container c)
Returns all components below the GUI hierarchy of the given Container, including Windows and MenuElements.
Specified by:
getComponents in interface ComponentFinder

getComponentParent

public Component getComponentParent(Component comp)
Look up the apparent parent of a component. A popup menu's parent is the menu or component that spawned it.
Specified by:
getComponentParent in interface ComponentFinder

getComponentFrame

public Frame getComponentFrame(Component comp)
Return the component's owning frame. There will always one of these; even a frameless window will have a temporary frame generated for it.
Specified by:
getComponentFrame in interface ComponentFinder

getComponentWindow

public Window getComponentWindow(Component comp)
Return the nearest Window ancestor of the given Component. If the component is a Window, returns the component. Note that for popups, this means the window of the invoker.
Specified by:
getComponentWindow in interface ComponentFinder

getComponentWindowTitle

public String getComponentWindowTitle(Component comp)
Return the title of the nearest ancestor window with a title. If no title is found, return null.
Specified by:
getComponentWindowTitle in interface ComponentFinder

getComponentTitledWindow

public Window getComponentTitledWindow(Component comp)
Return the component's owning frame or dialog. There will always one of these; even a frameless window will have a temporary frame generated for it.
Specified by:
getComponentTitledWindow in interface ComponentFinder

isFiltered

public boolean isFiltered(Component comp)
Returns true if the component or its Window ancestor is filtered.
Specified by:
isFiltered in interface ComponentFinder

filterComponent

public void filterComponent(Component comp)
Description copied from interface: ComponentFinder
Don't return the given component in any queries. Makes the given component unavailable unless filtering is turned off.
Specified by:
filterComponent in interface ComponentFinder

ignoreComponent

public void ignoreComponent(Component comp)
Ignore (for the purpose of future lookup) the given component.
Specified by:
ignoreComponent in interface ComponentFinder

ignoreExistingComponents

public void ignoreExistingComponents()
Ignore (for the purposes of future lookup) all currently available components.
Specified by:
ignoreExistingComponents in interface ComponentFinder

setFilterEnabled

public void setFilterEnabled(boolean enable)
Description copied from interface: ComponentFinder
Indicate whether to filter component lists.
Specified by:
setFilterEnabled in interface ComponentFinder

closeWindows

public void closeWindows()
Send an explicit window close event to all showing windows. Note that this is not guaranteed to actually make the window go away.
Specified by:
closeWindows in interface ComponentFinder

disposeWindows

public void disposeWindows()
Dispose of all available windows, and does not return until they have been disposed of.
Specified by:
disposeWindows in interface ComponentFinder

isShowing

public boolean isShowing(Component c)
Indicates whether the given component is showing and ready for input.
Specified by:
isShowing in interface ComponentFinder


Copyright © 2002-2003 Timothy Wall. All Rights Reserved.
Abbot is hosted on

SourceForge