| Package | Description |
|---|---|
| org.assertj.swing.awt |
Utility methods related to AWT.
|
| org.assertj.swing.cell |
Support for reading from and writing to cells in
JComponents (for example: JLists, JTables,
etc.) |
| org.assertj.swing.core |
Low-level components that enable functional testing of AWT and Swing
Components. |
| org.assertj.swing.core.matcher |
Common-use implementations of
GenericTypeMatcher. |
| org.assertj.swing.driver |
Component-specific test drivers. |
| org.assertj.swing.edt |
Ensure that
Component access is done in the event dispatch thread (EDT.) |
| org.assertj.swing.format |
Formatters that create better and shorter
String representations of AWT and Swing Components. |
| org.assertj.swing.hierarchy |
Scoped
Component hierarchies. |
| org.assertj.swing.query |
Common-use implementations of
GuiQuery. |
| org.assertj.swing.text |
Utilities for reading the text displayed in AWT or Swing
Components. |
| Modifier and Type | Method and Description |
|---|---|
static Point |
AWT.centerOf(Component c)
Returns a point at the center of the given AWT or Swing
Component. |
static Point |
AWT.centerOf(Rectangle r)
Returns a point at the center of the given
Rectangle. |
static Point |
AWT.centerOfVisibleRect(JComponent c)
Returns a point at the center of the visible rectangle of the given
JComponent. |
static Insets |
AWT.insetsFrom(Container c)
Returns the insets of the given AWT or Swing
Container, or an empty one if no insets can be found. |
static Component |
AWT.invokerOf(Component c)
Returns the invoker, if any, of the given AWT or Swing
Component; or null, if the Component
is not on a pop-up of any sort. |
static boolean |
AWT.isHeavyWeightPopup(Component c)
Returns whether the given AWT or Swing
Component is a heavy-weight pop-up, that is, a container for a
JPopupMenu that is implemented with a heavy-weight component (usually an AWT or Swing Window). |
static Point |
AWT.locationOnScreenOf(Component c)
Safe version of
Component.getLocationOnScreen, which avoids lockup if an AWT pop-up menu is showing. |
static Point |
AWT.translate(Component c,
int x,
int y)
Translates the given coordinates to the location on screen of the given AWT or Swing
Component. |
| Modifier and Type | Interface and Description |
|---|---|
interface |
JComboBoxCellReader
Reads the content of a cell in
JComboBox, as it appears to the user. |
interface |
JListCellReader
Reads the content of a cell in
Jlist, as it appears to the user. |
interface |
JTableCellReader
Reads the content of a cell in
JTable, as it appears to the user. |
interface |
JTreeCellReader
Reads the content, as shown to the user, of a cell in a
JTable. |
| Modifier and Type | Method and Description |
|---|---|
static Component |
FocusOwnerFinder.focusOwner()
Returns the focus owner.
|
protected abstract boolean |
GenericTypeMatcher.isMatching(T component)
Verifies that the given AWT or Swing
Component matches some search criteria. |
boolean |
BasicRobot.isReadyForInput(Component c)
Indicates whether the given AWT or Swing
Component is ready for input. |
boolean |
TypeMatcher.matches(Component c)
Indicates whether the type and visibility of the given AWT or Swing
Component matches the value specified
in this matcher. |
boolean |
NameMatcher.matches(Component c)
Indicates whether the name and visibility of the given AWT or Swing
Component matches the value specified
in this matcher. |
boolean |
GenericTypeMatcher.matches(Component c)
Verifies that the given AWT or Swing
Component:
Is an instance of the generic type specified in this ComponentMatcher
Matches some search criteria
|
boolean |
LabelMatcher.matches(Component c)
Indicates whether the given AWT or Swing
Component matches the criteria specified in this matcher:
the text of the JLabel attached to the Component to look for matches the text specified in this
matcher
the Component to look for is of the type specified in this matcher (if specified)
visibility of the given Component matches the value specified in this matcher
|
protected boolean |
AbstractComponentMatcher.requireShowingMatches(Component c)
Indicates if the value of the "showing" property of the given AWT or Swing
Component matches the value
specified in this matcher. |
static Window |
WindowAncestorFinder.windowAncestorOf(Component c)
Similar to
javax.swing.SwingUtilities#getWindowAncestor(Component), but returns the AWT or Swing
Component itself if it is a Window, or the invoker's Window if on a pop-up. |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
DialogMatcher.isMatching(Dialog dialog)
Indicates whether the name and title of the given AWT or Swing
Dialog match the ones in this matcher. |
protected boolean |
FrameMatcher.isMatching(Frame frame)
Indicates whether the name and title of the given AWT or Swing
Frame match the ones in this matcher. |
protected boolean |
JButtonMatcher.isMatching(JButton button)
Indicates whether the name and text of the given
JButton match the ones in this matcher. |
protected boolean |
JLabelMatcher.isMatching(JLabel label)
Indicates whether the name and text of the given
JLabel match the ones in this matcher. |
protected boolean |
JTextComponentMatcher.isMatching(JTextComponent textComponent)
Indicates whether the text of the given
JTextComponent is equal to the text in this matcher. |
| Modifier and Type | Method and Description |
|---|---|
Color |
BasicJTableCellReader.backgroundAt(JTable table,
int row,
int column)
Returns the background color of the cell renderer for the given
JTable cell. |
Point |
JScrollBarLocation.blockLocationToScrollDown(JScrollBar scrollBar)
Returns the location where to move the mouse pointer to scroll one block down (or left.)
|
Point |
JScrollBarLocation.blockLocationToScrollUp(JScrollBar scrollBar)
Returns the location where to move the mouse pointer to scroll one block up (or right.)
|
Rectangle |
JTableLocation.cellBounds(JTable table,
int row,
int column)
Returns the bounds of the given row and column.
|
Rectangle |
JTableLocation.cellBounds(JTable table,
TableCell cell)
Returns the bounds of the given cell.
|
static void |
JTableCellPreconditions.checkCellIndicesInBounds(JTable table,
int row,
int column)
Verifies that the given indices regarding the given table.
|
static void |
JTableCellPreconditions.checkCellIndicesInBounds(JTable table,
TableCell cell)
Verifies that the given table cell is non
null and its indices are not out of bounds. |
static void |
JTableCellPreconditions.checkColumnInBounds(JTable table,
int column)
Verifies that the given column index exists in the given table.
|
static void |
ComponentPreconditions.checkEnabled(Component c)
Verifies that the
Component is enabled. |
static void |
ComponentPreconditions.checkEnabledAndShowing(Component c)
Verifies that the
Component is enabled and showing. |
static void |
JTableCellPreconditions.checkRowInBounds(JTable table,
int row)
Verifies that the given row index exists in the given table.
|
int |
JTreeLocation.checkRowInBounds(JTree tree,
int row)
Validates that the given row index is valid.
|
static void |
ComponentPreconditions.checkShowing(Component c)
Verifies that the
Component is showing on the screen. |
Point |
JToolBarLocation.dockLocation(JToolBar toolBar,
Container dock,
String constraint)
Returns the location where to dock the given
JToolBar, at the given constraint position. |
protected static <T extends Component> |
AbstractJTableCellWriter.editor(JTable table,
int row,
int column,
Class<T> supportedType)
Finds the AWT or Swing
Component used as editor for the given JTable. |
Font |
BasicJTableCellReader.fontAt(JTable table,
int row,
int column)
Returns the font of the cell renderer for the given
JTable cell. |
Color |
BasicJTableCellReader.foregroundAt(JTable table,
int row,
int column)
Returns the foreground color of the cell renderer for the given
JTable cell. |
int |
JTabbedPaneLocation.indexOf(JTabbedPane tabbedPane,
String title)
Returns the index of the first tab that matches the given
String. |
int |
JTabbedPaneLocation.indexOf(JTabbedPane tabbedPane,
TextMatcher matcher)
Returns the index of the first tab whose title matches the value in the given
TextMatcher. |
int |
JTableHeaderLocation.indexOf(JTableHeader tableHeader,
TextMatcher matcher)
Returns the index of the column which name matches the value in the given
TextMatcher, or -1 if a matching
column was not found. |
protected boolean |
ContainerDriver.isResizable(Container c) |
protected boolean |
JComponentDriver.isVisible(JComponent c,
Point p)
|
protected static boolean |
JComponentDriver.isVisible(JComponent c,
Rectangle r)
Indicates whether the given
JComponent's visible Rectangle contains the given one. |
boolean |
JMenuItemMatcher.matches(Component c)
Indicates whether the given component is a
JMenuItem whose text matches the path specified in this matcher. |
Pair<Rectangle,Point> |
JTreeLocation.pathBoundsAndCoordinates(JTree tree,
TreePath path)
Returns the bounds and visible coordinates of the given path.
|
TreePath |
JTreeLocation.pathFor(JTree tree,
int row)
Returns the path for the given row.
|
protected void |
ComponentDriver.performAccessibleActionOf(Component c)
Performs the
AccessibleAction in the given AWT or Swing Component's event queue. |
Point |
JSliderLocation.pointAt(JSlider slider,
int value)
Returns the coordinates of the given value in the given
JSlider. |
Point |
JTabbedPaneLocation.pointAt(JTabbedPane tabbedPane,
int index)
Returns the coordinates of the tab under the given index.
|
Point |
JTableHeaderLocation.pointAt(JTableHeader tableHeader,
int index)
Returns the coordinates of the column under the given index.
|
Pair<Integer,Point> |
JTableHeaderLocation.pointAt(JTableHeader tableHeader,
TextMatcher matcher)
Returns the index and the coordinates of the column which name matches the value in the given
TextMatcher. |
Point |
JTableLocation.pointAt(JTable table,
int row,
int column)
Converts the given row and column into a coordinate pair.
|
Point |
JToolBarLocation.pointToGrab(JToolBar toolBar)
Returns the point where to grab the given
JToolBar. |
Pair<Rectangle,Point> |
JTreeLocation.rowBoundsAndCoordinates(JTree tree,
int row)
Returns the bounds and visible coordinates of the given row.
|
protected static void |
AbstractJTableCellWriter.scrollToCell(JTable table,
int row,
int column,
JTableLocation location)
Scrolls the given
JTable to the given cell. |
protected void |
JComponentDriver.scrollToVisible(JComponent c,
Rectangle r)
Invokes
JComponent.scrollRectToVisible(Rectangle) on the given JComponent. |
Point |
JScrollBarLocation.thumbLocation(JScrollBar scrollBar,
int position)
Returns the location where to move the mouse pointer to scroll to the given position.
|
Point |
JScrollBarLocation.unitLocationToScrollDown(JScrollBar scrollBar)
Returns the location where to move the mouse pointer to scroll one unit down (or left.)
|
Point |
JScrollBarLocation.unitLocationToScrollUp(JScrollBar scrollBar)
Returns the location where to move the mouse pointer to scroll one unit up (or right.)
|
protected static void |
AbstractJTableCellWriter.validate(JTable table,
int row,
int column)
Validates that:
the given
JTable is enabled and showing on the screen
the row and column indices are correct (not out of bounds)
the table cell at the given indices is editable
|
static void |
JTableCellPreconditions.validateCellIsEditable(JTable table,
int row,
int column)
Verifies that the table cell in the given coordinates is editable.
|
String |
BasicJComboBoxCellReader.valueAt(JComboBox comboBox,
int index)
Returns the internal value of a cell in a
JComboBox as expected in a test. |
String |
BasicJListCellReader.valueAt(JList list,
int index)
Returns the internal value of a cell in a
JList as expected in a test. |
String |
BasicJTableCellReader.valueAt(JTable table,
int row,
int column)
Returns the internal value of a cell in a
JTable as expected in a test. |
String |
BasicJTreeCellReader.valueAt(JTree tree,
Object modelValue)
Returns the internal value of a cell in a
JTree as expected in a test. |
String |
BasicCellRendererReader.valueFrom(Component c)
Reads the value in the given cell renderer
Component, or returns null if the renderer belongs to an
unknown type. |
String |
CellRendererReader.valueFrom(Component c)
Reads the value in the given cell renderer
Component, or returns null if the component is not
recognized by this reader. |
protected boolean |
ComponentDriver.waitForShowing(Component c,
long timeout)
Wait the given number of milliseconds for the AWT or Swing
Component to be showing and ready. |
| Constructor and Description |
|---|
JMenuItemLocation(JMenuItem menuItem)
Creates a new
JMenuItemLocation. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract String |
GuiLazyLoadingDescription.loadDescription()
Returns the lazy-loaded text of this description.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
JComboBoxFormatter.doFormat(Component c)
Returns the
String representation of the given Component, which should be a JComboBox. |
protected String |
IntrospectionComponentFormatter.doFormat(Component c)
Returns a
String representation of the given AWT or Swing Component, showing only the properties
specified in this formatter's constructor. |
protected String |
JOptionPaneFormatter.doFormat(Component c)
Returns the
String representation of the given Component, which should be a JOptionPane. |
protected String |
JFileChooserFormatter.doFormat(Component c)
Returns the
String representation of the given Component, which should be a JFileChooser. |
protected String |
JListFormatter.doFormat(Component c)
Returns the
String representation of the given Component, which should be a JList. |
protected abstract String |
ComponentFormatterTemplate.doFormat(Component c)
Returns the
String representation of the given AWT or Swing Component. |
static String |
Formatting.format(Component c)
Returns a
String representation of the given AWT or Swing Component. |
String |
ComponentFormatter.format(Component c)
Returns a
String representation of the given AWT or Swing Component. |
String |
ComponentFormatterTemplate.format(Component c)
Returns the
String representation of the given AWT or Swing Component. |
| Modifier and Type | Interface and Description |
|---|---|
interface |
ComponentHierarchy
Provides access to all AWT or Swing
Components in a hierarchy. |
| Modifier and Type | Method and Description |
|---|---|
Collection<Component> |
ExistingHierarchy.childrenOf(Component c)
Returns all descendants of interest of the given AWT or Swing
Component. |
Collection<Component> |
NewHierarchy.childrenOf(Component c)
Returns all the children of the given AWT or Swing
Component, omitting those which are currently filtered. |
boolean |
NewHierarchy.contains(Component c)
Returns
true if the given AWT or Swing Component is not ignored. |
void |
ExistingHierarchy.dispose(Window w)
Properly disposes of the given
Window, making it and its native resources available for garbage collection. |
void |
NewHierarchy.dispose(Window w)
Disposes the given
Window, but only if it currently exists within the hierarchy. |
void |
NewHierarchy.ignoreExisting()
Makes all currently existing AWT and Swing
Component invisible to this hierarchy, without affecting their
current state. |
Container |
ExistingHierarchy.parentOf(Component c)
Returns the parent for the given AWT or Swing
Component. |
void |
NewHierarchy.recognize(Component c)
Make the given AWT or Swing
Component visible to this hierarchy. |
| Modifier and Type | Method and Description |
|---|---|
static int |
JTableColumnByIdentifierQuery.columnIndexByIdentifier(JTable table,
Object identifier)
Returns the index of a column in a
JTable whose identifier matches the given one. |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
AbstractButtonTextReader.checkContainsText(AbstractButton button,
String text)
Indicates whether the given Swing
AbstractButton displays the given text. |
protected boolean |
JLabelTextReader.checkContainsText(JLabel label,
String text)
Indicates whether the given
JLabel displays the given text. |
protected boolean |
JListTextReader.checkContainsText(JList list,
String text)
Indicates whether the text representation of any of the elements in the given
JList contains the given
text. |
protected boolean |
JTextComponentTextReader.checkContainsText(JTextComponent textComponent,
String text)
Indicates whether the given
JTextComponent displays the given text. |
protected abstract boolean |
TextReader.checkContainsText(T component,
String text)
Indicates whether the given AWT or Swing
Component contains or displays the given text. |
boolean |
TextReader.containsText(Component c,
String text)
Indicates whether the given AWT or Swing
Component contains or displays the given text. |
Copyright © 2014 AssertJ. All rights reserved.