org.assertj.swing.hierarchy
Interface ComponentHierarchy

All Known Implementing Classes:
ExistingHierarchy, NewHierarchy, SingleComponentHierarchy

@RunsInCurrentThread
public interface ComponentHierarchy

Provides access to all AWT or Swing Components in a hierarchy.

Note: Methods in this interface are accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT.) Client code must call methods in this interface from the EDT.

Author:
Alex Ruiz, Yvonne Wang

Method Summary
 Collection<Component> childrenOf(Component c)
          Returns all the children of the given AWT or Swing Component.
 boolean contains(Component c)
          Indicates whether this ComponentHierarchy contains the given AWT or Swing Component.
 void dispose(Window w)
          Provides proper disposal of the given AWT or Swing Window, appropriate to this ComponentHierarchy.
 Container parentOf(Component c)
          Returns the parent for the given AWT or Swing Component.
 Collection<Container> roots()
           
 

Method Detail

roots

@Nonnull
Collection<Container> roots()
Returns:
all root Containers in the ComponentHierarchy.

childrenOf

@Nonnull
Collection<Component> childrenOf(@Nonnull
                                         Component c)
Returns all the children of the given AWT or Swing Component.

Parameters:
c - the given Component.
Returns:
all the children of the given Component.

parentOf

@Nullable
Container parentOf(@Nonnull
                            Component c)
Returns the parent for the given AWT or Swing Component.

Parameters:
c - the given Component.
Returns:
the parent for the given Component.

contains

boolean contains(@Nonnull
                 Component c)
Indicates whether this ComponentHierarchy contains the given AWT or Swing Component.

Parameters:
c - the given Component.
Returns:
true if this ComponentHierarchy contains the given Component, false otherwise.

dispose

void dispose(@Nonnull
             Window w)
Provides proper disposal of the given AWT or Swing Window, appropriate to this ComponentHierarchy. After disposal, the Window and its descendants will no longer be reachable from this ComponentHierarchy.

Parameters:
w - the Window to dispose.


Copyright © 2014–2015 AssertJ. All rights reserved.