public class ExistingHierarchy extends Object implements ComponentHierarchy
Constructor and Description |
---|
ExistingHierarchy() |
Modifier and Type | Method and Description |
---|---|
Collection<Component> |
childrenOf(Component c)
Returns all descendants of interest of the given AWT or Swing
Component . |
boolean |
contains(Component c)
Returns whether the given AWT or Swing
Component is reachable from any of the root windows. |
void |
dispose(Window w)
Properly disposes of the given
Window , making it and its native resources available for garbage collection. |
Container |
parentOf(Component c)
Returns the parent for the given AWT or Swing
Component . |
Collection<Container> |
roots() |
@Nonnull public Collection<Container> roots()
roots
in interface ComponentHierarchy
Container
s in the ComponentHierarchy
.@RunsInCurrentThread public Container parentOf(@Nonnull Component c)
Returns the parent for the given AWT or Swing Component
.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT). Client code must call this method from the EDT.
parentOf
in interface ComponentHierarchy
c
- the given Component
.Component
.public boolean contains(@Nonnull Component c)
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.contains
in interface ComponentHierarchy
c
- the given Component
.true
.@RunsInCurrentThread @Nonnull public Collection<Component> childrenOf(@Nonnull Component c)
Returns all descendants of interest of the given AWT or Swing Component
.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT). Client code must call this method from the EDT.
childrenOf
in interface ComponentHierarchy
c
- the given Component
.Component
.@RunsInCurrentThread public void dispose(@Nonnull Window w)
Properly disposes of the given Window
, making it and its native resources available for garbage collection.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT). Client code must call this method from the EDT.
dispose
in interface ComponentHierarchy
w
- the Window
to dispose.Copyright © 2014–2019 AssertJ. All rights reserved.