abbot.finder
Class TestHierarchy

java.lang.Object
  extended by abbot.finder.AWTHierarchy
      extended by abbot.finder.TestHierarchy
All Implemented Interfaces:
Hierarchy

public class TestHierarchy
extends AWTHierarchy

Provide isolation of a Component hierarchy to limit consideration to only those Components created during the lifetime of this Hierarchy instance. Extant Components (and any subsequently generated subwindows) are ignored by default.

Implicitly auto-filters windows which are disposed (i.e. generate a WINDOW_CLOSED event), but also implicitly un-filters them if they should be shown again. Any Window explicitly disposed with dispose(Window) will be ignored permanently.


Field Summary
 
Fields inherited from class abbot.finder.AWTHierarchy
EMPTY, tracker
 
Constructor Summary
TestHierarchy()
          Create a new TestHierarchy which does not contain any UI Components which might already exist.
TestHierarchy(boolean ignoreExisting)
          Create a new TestHierarchy, indicating whether extant Components should be omitted from the Hierarchy.
 
Method Summary
 boolean contains(Component c)
          Returns whether the given component is reachable from any of the root windows.
 void dispose(Window w)
          Dispose of the given Window, but only if it currently exists within the hierarchy.
 Collection getComponents(Component c)
          Returns all sub-components of the given Component, omitting those which are currently filtered.
 Collection getRoots()
          Returns all available root Windows, excluding those which have been filtered.
 void ignoreExisting()
          Make all currently extant components invisible to this Hierarchy, without affecting their current state.
 boolean isFiltered(Component c)
          Returns true if the given component will not be considered when walking the hierarchy.
 void setFiltered(Component c, boolean filter)
          Indicates whether the given component is to be included in the Hierarchy.
 
Methods inherited from class abbot.finder.AWTHierarchy
getDefault, getParent, setDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestHierarchy

public TestHierarchy()
Create a new TestHierarchy which does not contain any UI Components which might already exist.


TestHierarchy

public TestHierarchy(boolean ignoreExisting)
Create a new TestHierarchy, indicating whether extant Components should be omitted from the Hierarchy.

Method Detail

contains

public boolean contains(Component c)
Description copied from class: AWTHierarchy
Returns whether the given component is reachable from any of the root windows. The default is to consider all components to be contained in the hierarchy, whether they are reachable or not (NOTE: isReachable is a distinctly different operation).

Specified by:
contains in interface Hierarchy
Overrides:
contains in class AWTHierarchy

dispose

public void dispose(Window w)
Dispose of the given Window, but only if it currently exists within the hierarchy. It will no longer appear in this Hierarchy or be reachable in a hierarchy walk.

Specified by:
dispose in interface Hierarchy
Overrides:
dispose in class AWTHierarchy

ignoreExisting

public void ignoreExisting()
Make all currently extant components invisible to this Hierarchy, without affecting their current state.


getRoots

public Collection getRoots()
Returns all available root Windows, excluding those which have been filtered.

Specified by:
getRoots in interface Hierarchy
Overrides:
getRoots in class AWTHierarchy

getComponents

public Collection getComponents(Component c)
Returns all sub-components of the given Component, omitting those which are currently filtered.

Specified by:
getComponents in interface Hierarchy
Overrides:
getComponents in class AWTHierarchy

isFiltered

public boolean isFiltered(Component c)
Returns true if the given component will not be considered when walking the hierarchy. A Component is filtered if it has explicitly been filtered via setFiltered(Component,boolean), or if any Window ancestor has been filtered.


setFiltered

public void setFiltered(Component c,
                        boolean filter)
Indicates whether the given component is to be included in the Hierarchy. If the component is a Window, recursively applies the action to all owned Windows.



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

SourceForge