Package org.fest.swing.driver
Class BasicJTableCellReader
java.lang.Object
org.fest.swing.driver.BasicJTableCellReader
- All Implemented Interfaces:
JTableCellReader
Understands the default implementation of
JTableCellReader
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BasicJComboBoxCellReader
private final CellRendererReader
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newBasicJTableCellReader
that uses a
to read the value from the cell renderer component in aBasicCellRendererReader
JTable
.Creates a newBasicJTableCellReader
. -
Method Summary
Modifier and TypeMethodDescriptionbackgroundAt
(JTable table, int row, int column) Returns the background color of the cell renderer for the given table cell.private Component
cellRendererIn
(JTable table, int row, int column) Returns the font of the cell renderer for the given table cell.foregroundAt
(JTable table, int row, int column) Returns the foreground color of the cell renderer for the given table cell.private String
valueAsText
(JComboBox comboBox) Returns the internal value of a cell in a
as expected in a test.JTable
-
Field Details
-
rendererReader
-
comboBoxCellReader
-
-
Constructor Details
-
BasicJTableCellReader
public BasicJTableCellReader()Creates a newBasicJTableCellReader
that uses a
to read the value from the cell renderer component in aBasicCellRendererReader
JTable
. -
BasicJTableCellReader
Creates a newBasicJTableCellReader
.- Parameters:
reader
- knows how to read values from the cell renderer component in aJTable
.- Throws:
NullPointerException
- ifreader
isnull
.
-
-
Method Details
-
valueAt
Returns the internal value of a cell in a
as expected in a test. This method first tries to return the value displayed in theJTable
JTable
's cell renderer.- if the renderer is a
, this method returns its textJLabel
- if the renderer is a
, this method returns the value of its selection as aJComboBox
String
- if the renderer is a
, this method returns whether it is selected or notJCheckBox
toString
implementation of the object stored in theJTable
's model at the specified indices.Note: This method is not executed in the event dispatch thread (EDT.) Clients are responsible for invoking this method in the EDT.
- Specified by:
valueAt
in interfaceJTableCellReader
- Parameters:
table
- the givenJTable
.row
- the row index of the cell.column
- the column index of the cell.- Returns:
- the internal value of a cell in a
JTable
as expected in a test.
- if the renderer is a
-
valueAsText
-
fontAt
Returns the font of the cell renderer for the given table cell.Note: This method is not executed in the event dispatch thread (EDT.) Clients are responsible for invoking this method in the EDT.
- Specified by:
fontAt
in interfaceJTableCellReader
- Parameters:
table
- the givenJTable
.row
- the row index of the cell.column
- the column index of the cell.- Returns:
- the font of the cell renderer for the given table cell.
-
backgroundAt
Returns the background color of the cell renderer for the given table cell.Note: This method is not executed in the event dispatch thread (EDT.) Clients are responsible for invoking this method in the EDT.
- Specified by:
backgroundAt
in interfaceJTableCellReader
- Parameters:
table
- the givenJTable
.row
- the row index of the cell.column
- the column index of the cell.- Returns:
- the background color of the cell renderer for the given table cell.
-
foregroundAt
Returns the foreground color of the cell renderer for the given table cell.Note: This method is not executed in the event dispatch thread (EDT.) Clients are responsible for invoking this method in the EDT.
- Specified by:
foregroundAt
in interfaceJTableCellReader
- Parameters:
table
- the givenJTable
.row
- the row index of the cell.column
- the column index of the cell.- Returns:
- the foreground color of the cell renderer for the given table cell.
-
cellRendererIn
-