public final class SingleComponentHierarchy extends Object implements ComponentHierarchy
ComponentHierarchy
created with a specified AWT or Swing Component
as root.Constructor and Description |
---|
SingleComponentHierarchy(Container root,
ComponentHierarchy hierarchy)
Creates a new
SingleComponentHierarchy . |
Modifier and Type | Method and Description |
---|---|
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 . |
Container |
root() |
Collection<Container> |
roots() |
public SingleComponentHierarchy(@Nonnull Container root, @Nonnull ComponentHierarchy hierarchy)
SingleComponentHierarchy
.root
- the root Component
for this hierarchy.hierarchy
- the base ComponentHierarchy
.public Container root()
Component
in this hierarchy.@Nullable public Container parentOf(@Nonnull Component c)
Component
.parentOf
in interface ComponentHierarchy
c
- the given Component
.Component
.@Nonnull public Collection<Container> roots()
roots
in interface ComponentHierarchy
Component
in this hierarchy.@Nonnull public Collection<Component> childrenOf(@Nonnull Component c)
ComponentHierarchy
Component
.childrenOf
in interface ComponentHierarchy
c
- the given Component
.Component
.public boolean contains(@Nonnull Component c)
ComponentHierarchy
ComponentHierarchy
contains the given AWT or Swing Component
.contains
in interface ComponentHierarchy
c
- the given Component
.true
if this ComponentHierarchy
contains the given Component
, false
otherwise.public void dispose(@Nonnull Window w)
ComponentHierarchy
Window
, appropriate to this ComponentHierarchy
.
After disposal, the Window
and its descendants will no longer be reachable from this
ComponentHierarchy
.dispose
in interface ComponentHierarchy
w
- the Window
to dispose.Copyright © 2014-2015 AssertJ. All Rights Reserved.