Package org.fest.swing.data
Class TableCellInRowByValue
java.lang.Object
org.fest.swing.data.TableCellInRowByValue
- All Implemented Interfaces:
TableCellFinder
Understands lookup of a cell in the first row in
JTable
whose values match the given ones.
Example:
// import static org.fest.swing.data.TableCellInSelectedRow.row;cell = dialog.table("records").cell(
TableCell
rowWithValue
("column1", "column2", "column3").column(2));
- Since:
- 1.2
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TableCellInRowByValue
(String[] values, int column) Creates a newTableCellInRowByValue
. -
Method Summary
Modifier and TypeMethodDescriptionfindCell
(JTable table, JTableCellReader cellReader) Finds a cell in the given
that: is located in the first row whose values match the given ones has a matching row indexJTable
private static int
findRowIndex
(JTable table, JTableCellReader cellReader, String[] values) private static boolean
matchingRow
(JTable table, JTableCellReader cellReader, String[] values, int row) rowWithValue
(String... values) Starting point for the creation of a
.TableCellInRowByValue
toString()
private static void
validateEqualSize
(JTable table, String[] values)
-
Field Details
-
values
-
column
private final int column
-
-
Constructor Details
-
TableCellInRowByValue
Creates a newTableCellInRowByValue
.- Parameters:
values
- the values in the cells of the row we are looking for.column
- the index of the column in the table cell to find.
-
-
Method Details
-
rowWithValue
Starting point for the creation of a
.TableCellInRowByValue
Example:
// import static org.fest.swing.data.TableCellInRowByValue.rowWithValue; TableCellByColumnId cell = rowWithValue("column1", "column2", "column3").column(3);
- Parameters:
values
- the values in the cells of the row we are looking for.- Returns:
- the created builder.
- Throws:
NullPointerException
- if the given array of values isnull
.
-
findCell
Finds a cell in the given
that:JTable
- is located in the first row whose values match the given ones
- has a matching row index
- Specified by:
findCell
in interfaceTableCellFinder
- Parameters:
table
- the targetJTable
.cellReader
- knows how to read the contents of a cell in aJTable
.- Returns:
- the cell found, if any.
- Throws:
IllegalStateException
- if the size of values to look up is not equal to the number of columns in the givenJTable
.ActionFailedException
- if a matching cell could not be found.
-
findRowIndex
@RunsInEDT private static int findRowIndex(JTable table, JTableCellReader cellReader, String[] values) -
validateEqualSize
-
matchingRow
@RunsInCurrentThread private static boolean matchingRow(JTable table, JTableCellReader cellReader, String[] values, int row) -
toString
-