org.fest.swing.hierarchy
Class ExistingHierarchy

java.lang.Object
  extended by org.fest.swing.hierarchy.ExistingHierarchy
All Implemented Interfaces:
ComponentHierarchy
Direct Known Subclasses:
NewHierarchy

public class ExistingHierarchy
extends Object
implements ComponentHierarchy

Understands access to the current AWT hierarchy.

Author:
Alex Ruiz, Yvonne Wang

Constructor Summary
ExistingHierarchy()
          Creates a new ExistingHierarchy.
 
Method Summary
 Collection<Component> childrenOf(Component c)
          Returns all descendants of interest of the given component.
 boolean contains(Component c)
          Returns whether the given component is reachable from any of the root windows.
 void dispose(Window w)
          Properly dispose of the given window, making it and its native resources available for garbage collection.
 Container parentOf(Component c)
          Return the parent for the given component.
 Collection<? extends Container> roots()
          Provides all root containers in the hierarchy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExistingHierarchy

public ExistingHierarchy()
Creates a new ExistingHierarchy.

Method Detail

roots

public Collection<? extends Container> roots()
Provides all root containers in the hierarchy.

Specified by:
roots in interface ComponentHierarchy
Returns:
all root containers in the hierarchy.

parentOf

@RunsInCurrentThread
public Container parentOf(Component c)
Return the parent for the given component.

Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.

Specified by:
parentOf in interface ComponentHierarchy
Parameters:
c - the given component.
Returns:
the parent for the given component.

contains

public boolean contains(Component c)
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.

Specified by:
contains in interface ComponentHierarchy
Parameters:
c - the given component.
Returns:
true.

childrenOf

@RunsInCurrentThread
public Collection<Component> childrenOf(Component c)
Returns all descendants of interest of the given component.

Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.

Specified by:
childrenOf in interface ComponentHierarchy
Parameters:
c - the given component.
Returns:
all descendants of interest of the given component.

dispose

@RunsInCurrentThread
public void dispose(Window w)
Properly dispose of the given window, making it and its native resources available for garbage collection.

Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.

Specified by:
dispose in interface ComponentHierarchy
Parameters:
w - the window to dispose.


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.