org.fest.swing.hierarchy
Class SingleComponentHierarchy

java.lang.Object
  extended by org.fest.swing.hierarchy.SingleComponentHierarchy
All Implemented Interfaces:
ComponentHierarchy

public final class SingleComponentHierarchy
extends Object
implements ComponentHierarchy

Understands a component hierarchy created with a specified Component as root.

Author:
Alex Ruiz

Constructor Summary
SingleComponentHierarchy(Container root, ComponentHierarchy hierarchy)
          Creates a new SingleComponentHierarchy.
 
Method Summary
 Collection<Component> childrenOf(Component c)
          Returns all sub-components of the given Component.
 boolean contains(Component c)
          Returns whether the hierarchy contains the given Component.
 void dispose(Window w)
          Provides proper disposal of the given Window, appropriate to this hierarchy.
 Container parentOf(Component c)
          Returns the parent component for the given Component.
 Container root()
          Returns the root component in this hierarchy.
 Collection<? extends Container> roots()
          Returns a collection containing only the root Component in this hierarchy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleComponentHierarchy

public SingleComponentHierarchy(Container root,
                                ComponentHierarchy hierarchy)
Creates a new SingleComponentHierarchy.

Parameters:
root - the root component for this hierarchy
hierarchy - the base component hierarchy.
Method Detail

root

public Container root()
Returns the root component in this hierarchy.

Returns:
the root component in this hierarchy.

parentOf

public Container parentOf(Component c)
Returns the parent component for the given Component.

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

roots

public Collection<? extends Container> roots()
Returns a collection containing only the root Component in this hierarchy.

Specified by:
roots in interface ComponentHierarchy
Returns:
a collection containing only the root Component in this hierarchy.

childrenOf

public Collection<Component> childrenOf(Component c)
Returns all sub-components of the given Component.

Specified by:
childrenOf in interface ComponentHierarchy
Parameters:
c - the given component.
Returns:
all sub-components of the given Component.

contains

public boolean contains(Component c)
Returns whether the hierarchy contains the given Component.

Specified by:
contains in interface ComponentHierarchy
Parameters:
c - the given component.
Returns:
whether the hierarchy contains the given Component.

dispose

public void dispose(Window w)
Provides proper disposal of the given Window, appropriate to this hierarchy. After disposal, the Window and its descendants will no longer be reachable from this hierarchy.

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


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