public final class BasicComponentPrinter extends Object implements ComponentPrinter
ComponentPrinter
.ComponentPrinter
,
Formatting.format(Component)
Modifier | Constructor and Description |
---|---|
protected |
BasicComponentPrinter(ComponentHierarchy hierarchy)
Creates a new
BasicComponentPrinter . |
Modifier and Type | Method and Description |
---|---|
protected ComponentHierarchy |
hierarchy() |
void |
printComponents(PrintStream out)
Prints all the AWT and Swing
Component s in the hierarchy. |
void |
printComponents(PrintStream out,
Class<? extends Component> type)
Prints only the AWT and Swing
Component s of the given type in the hierarchy. |
void |
printComponents(PrintStream out,
Class<? extends Component> type,
Container root)
Prints all the AWT and Swing
Component s of the given type in the hierarchy under the given root. |
void |
printComponents(PrintStream out,
ComponentMatcher matcher)
Prints only the AWT and Swing
Component s that match the given search criteria in the hierarchy. |
void |
printComponents(PrintStream out,
ComponentMatcher matcher,
Container root)
Prints all the AWT and Swing
Component s that match the given search criteria under the given root. |
void |
printComponents(PrintStream out,
Container root)
Prints all the AWT and Swing
Component s in the hierarchy under the given root. |
static ComponentPrinter |
printerWithCurrentAwtHierarchy()
Creates a new
BasicComponentPrinter that has access to all the AWT and Swing Component s in the AWT
hierarchy. |
static ComponentPrinter |
printerWithNewAwtHierarchy()
Creates a new
BasicComponentPrinter with a new AWT hierarchy. |
protected BasicComponentPrinter(@Nonnull ComponentHierarchy hierarchy)
BasicComponentPrinter
.hierarchy
- the component hierarchy to use.@Nonnull public static ComponentPrinter printerWithNewAwtHierarchy()
BasicComponentPrinter
with a new AWT hierarchy. AWT and Swing Component
s created
before the created BasicComponentPrinter
cannot be accessed by the created BasicComponentPrinter
.@Nonnull public static ComponentPrinter printerWithCurrentAwtHierarchy()
BasicComponentPrinter
that has access to all the AWT and Swing Component
s in the AWT
hierarchy.@Nonnull protected final ComponentHierarchy hierarchy()
@RunsInEDT public void printComponents(@Nonnull PrintStream out)
ComponentPrinter
Component
s in the hierarchy.printComponents
in interface ComponentPrinter
out
- the output stream where to print the Component
s to.Formatting.format(Component)
@RunsInEDT public void printComponents(@Nonnull PrintStream out, @Nullable Container root)
ComponentPrinter
Component
s in the hierarchy under the given root.printComponents
in interface ComponentPrinter
out
- the output stream where to print the Component
s to.root
- the root used as the starting point of the search.Formatting.format(Component)
@RunsInEDT public void printComponents(@Nonnull PrintStream out, @Nonnull Class<? extends Component> type)
ComponentPrinter
Component
s of the given type in the hierarchy.printComponents
in interface ComponentPrinter
out
- the output stream where to print the Component
s to.type
- the type of Component
s to print.Formatting.format(Component)
@RunsInEDT public void printComponents(@Nonnull PrintStream out, @Nonnull Class<? extends Component> type, @Nullable Container root)
ComponentPrinter
Component
s of the given type in the hierarchy under the given root.printComponents
in interface ComponentPrinter
out
- the output stream where to print the Component
s to.type
- the type of Component
s to print.root
- the root used as the starting point of the search.Formatting.format(Component)
public void printComponents(@Nonnull PrintStream out, @Nonnull ComponentMatcher matcher)
ComponentPrinter
Component
s that match the given search criteria in the hierarchy.printComponents
in interface ComponentPrinter
out
- the output stream where to print the Component
s to.matcher
- specifies the search criteria to use filter the Component
s to print.Formatting.format(Component)
public void printComponents(@Nonnull PrintStream out, @Nonnull ComponentMatcher matcher, @Nullable Container root)
ComponentPrinter
Component
s that match the given search criteria under the given root.printComponents
in interface ComponentPrinter
out
- the output stream where to print the Component
s to.matcher
- specifies the search criteria to use filter the Component
s to print.root
- the root used as the starting point of the search.Formatting.format(Component)
Copyright © 2014–2019 AssertJ. All rights reserved.