org.fest.swing.core
Class BasicComponentPrinter

java.lang.Object
  extended by org.fest.swing.core.BasicComponentPrinter
All Implemented Interfaces:
ComponentPrinter

public final class BasicComponentPrinter
extends Object
implements ComponentPrinter

Understands printing the String representation of Components to facilitate debugging.

Author:
Alex Ruiz

Constructor Summary
protected BasicComponentPrinter(ComponentHierarchy hierarchy)
          Creates a new BasicComponentPrinter.
 
Method Summary
protected  ComponentHierarchy hierarchy()
          Returns the component hierarchy used by this printer.
 void printComponents(PrintStream out)
          Prints all the components in the hierarchy.
 void printComponents(PrintStream out, Class<? extends Component> type)
          Prints only the components of the given type in the hierarchy.
 void printComponents(PrintStream out, Class<? extends Component> type, Container root)
          Prints all the components of the given type in the hierarchy under the given root.
 void printComponents(PrintStream out, ComponentMatcher matcher)
          $Prints only the components that match the given search criteria in the hierarchy.
 void printComponents(PrintStream out, ComponentMatcher matcher, Container root)
          $Prints all the components that match the given search criteria under the given root.
 void printComponents(PrintStream out, Container root)
          Prints all the components in the hierarchy under the given root.
static ComponentPrinter printerWithCurrentAwtHierarchy()
          Creates a new BasicComponentPrinter that has access to all the GUI components in the AWT hierarchy.
static ComponentPrinter printerWithNewAwtHierarchy()
          Creates a new BasicComponentPrinter with a new AWT hierarchy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicComponentPrinter

protected BasicComponentPrinter(ComponentHierarchy hierarchy)
Creates a new BasicComponentPrinter.

Parameters:
hierarchy - the component hierarchy to use.
Method Detail

printerWithNewAwtHierarchy

public static ComponentPrinter printerWithNewAwtHierarchy()
Creates a new BasicComponentPrinter with a new AWT hierarchy. Components created before the created BasicComponentPrinter cannot be accessed by the created BasicComponentPrinter.

Returns:
the created finder.

printerWithCurrentAwtHierarchy

public static ComponentPrinter printerWithCurrentAwtHierarchy()
Creates a new BasicComponentPrinter that has access to all the GUI components in the AWT hierarchy.

Returns:
the created printer.

hierarchy

protected final ComponentHierarchy hierarchy()
Returns the component hierarchy used by this printer.

Returns:
the component hierarchy used by this printer.

printComponents

@RunsInEDT
public void printComponents(PrintStream out)
Prints all the components in the hierarchy.

Specified by:
printComponents in interface ComponentPrinter
Parameters:
out - the output stream where to print the components to.
See Also:
Formatting.format(Component)

printComponents

@RunsInEDT
public void printComponents(PrintStream out,
                                      Container root)
Prints all the components in the hierarchy under the given root.

Specified by:
printComponents in interface ComponentPrinter
Parameters:
out - the output stream where to print the components to.
root - the root used as the starting point of the search.
See Also:
Formatting.format(Component)

printComponents

@RunsInEDT
public void printComponents(PrintStream out,
                                      Class<? extends Component> type)
Prints only the components of the given type in the hierarchy.

Specified by:
printComponents in interface ComponentPrinter
Parameters:
out - the output stream where to print the components to.
type - the type of components to print.
See Also:
Formatting.format(Component)

printComponents

@RunsInEDT
public void printComponents(PrintStream out,
                                      Class<? extends Component> type,
                                      Container root)
Prints all the components of the given type in the hierarchy under the given root.

Specified by:
printComponents in interface ComponentPrinter
Parameters:
out - the output stream where to print the components to.
type - the type of components to print.
root - the root used as the starting point of the search.
See Also:
Formatting.format(Component)

printComponents

public void printComponents(PrintStream out,
                            ComponentMatcher matcher)
$Prints only the components that match the given search criteria in the hierarchy.

Specified by:
printComponents in interface ComponentPrinter
Parameters:
out - the output stream where to print the components to.
matcher - specifies the search criteria to use filter the components to print.
See Also:
Formatting.format(Component)

printComponents

public void printComponents(PrintStream out,
                            ComponentMatcher matcher,
                            Container root)
$Prints all the components that match the given search criteria under the given root.

Specified by:
printComponents in interface ComponentPrinter
Parameters:
out - the output stream where to print the components to.
matcher - specifies the search criteria to use filter the components to print.
root - the root used as the starting point of the search.
See Also:
Formatting.format(Component)


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