org.fest.swing.data
Class TableCellInRowByValue

java.lang.Object
  extended by org.fest.swing.data.TableCellInRowByValue
All Implemented Interfaces:
TableCellFinder

public class TableCellInRowByValue
extends Object
implements 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;
 TableCell cell = dialog.table("records").cell(rowWithValue("column1", "column2", "column3").column(2));
 

Since:
1.2
Author:
Alex Ruiz

Nested Class Summary
static class TableCellInRowByValue.TableCellBuilder
          Understands creation of TableCellInSelectedRows.
 
Constructor Summary
protected TableCellInRowByValue(String[] values, int column)
          Creates a new TableCellInRowByValue.
 
Method Summary
 TableCell findCell(JTable table, JTableCellReader cellReader)
          Finds a cell in the given JTable that: is located in the first row whose values match the given ones has a matching row index
static TableCellInRowByValue.TableCellBuilder rowWithValue(String... values)
          Starting point for the creation of a TableCellInRowByValue.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableCellInRowByValue

protected TableCellInRowByValue(String[] values,
                                int column)
Creates a new TableCellInRowByValue.

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 Detail

rowWithValue

public static TableCellInRowByValue.TableCellBuilder rowWithValue(String... values)
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 is null.

findCell

@RunsInEDT
public TableCell findCell(JTable table,
                                    JTableCellReader cellReader)
Finds a cell in the given JTable that:
  1. is located in the first row whose values match the given ones
  2. has a matching row index

Specified by:
findCell in interface TableCellFinder
Parameters:
table - the target JTable.
cellReader - knows how to read the contents of a cell in a JTable.
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 given JTable.
ActionFailedException - if a matching cell could not be found.

toString

public String toString()
Overrides:
toString in class Object


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