org.fest.swing.driver
Class BasicJTableCellReader

java.lang.Object
  extended by org.fest.swing.driver.BasicJTableCellReader
All Implemented Interfaces:
JTableCellReader

public class BasicJTableCellReader
extends Object
implements JTableCellReader

Understands the default implementation of JTableCellReader.

Author:
Yvonne Wang, Alex Ruiz

Constructor Summary
BasicJTableCellReader()
          Creates a new BasicJTableCellReader that uses a BasicCellRendererReader to read the value from the cell renderer component in a JTable.
BasicJTableCellReader(CellRendererReader reader)
          Creates a new BasicJTableCellReader.
 
Method Summary
 Color backgroundAt(JTable table, int row, int column)
          Returns the background color of the cell renderer for the given table cell.
 Font fontAt(JTable table, int row, int column)
          Returns the font of the cell renderer for the given table cell.
 Color foregroundAt(JTable table, int row, int column)
          Returns the foreground color of the cell renderer for the given table cell.
 String valueAt(JTable table, int row, int column)
          Returns the internal value of a cell in a JTable as expected in a test.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicJTableCellReader

public BasicJTableCellReader()
Creates a new BasicJTableCellReader that uses a BasicCellRendererReader to read the value from the cell renderer component in a JTable.


BasicJTableCellReader

public BasicJTableCellReader(CellRendererReader reader)
Creates a new BasicJTableCellReader.

Parameters:
reader - knows how to read values from the cell renderer component in a JTable.
Throws:
NullPointerException - if reader is null.
Method Detail

valueAt

@RunsInCurrentThread
public String valueAt(JTable table,
                                          int row,
                                          int column)
Returns the internal value of a cell in a JTable as expected in a test. This method first tries to return the value displayed in the JTable's cell renderer. If it fails reading the cell renderer, this method will get the value from the toString implementation of the object stored in the JTable's model at the specified indices.

Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.

Specified by:
valueAt in interface JTableCellReader
Parameters:
table - the given JTable.
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.

fontAt

@RunsInCurrentThread
public Font fontAt(JTable table,
                                       int row,
                                       int column)
Returns the font of the cell renderer for the given table cell.

Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.

Specified by:
fontAt in interface JTableCellReader
Parameters:
table - the given JTable.
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

@RunsInCurrentThread
public Color backgroundAt(JTable table,
                                              int row,
                                              int column)
Returns the background color of the cell renderer for the given table cell.

Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.

Specified by:
backgroundAt in interface JTableCellReader
Parameters:
table - the given JTable.
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

@RunsInCurrentThread
public Color foregroundAt(JTable table,
                                              int row,
                                              int column)
Returns the foreground color of the cell renderer for the given table cell.

Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.

Specified by:
foregroundAt in interface JTableCellReader
Parameters:
table - the given JTable.
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.


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