Class BasicJTableCellReader

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

public class BasicJTableCellReader extends Object implements JTableCellReader
Understands the default implementation of JTableCellReader.
  • Field Details

  • Constructor Details

  • Method Details

    • 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 the renderer is a JLabel, this method returns its text
      • if the renderer is a JComboBox, this method returns the value of its selection as a String
      • if the renderer is a JCheckBox, this method returns whether it is selected or not
      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 executed in the event dispatch thread (EDT.) Clients are responsible for invoking this method in 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.
    • valueAsText

      private String valueAsText(JComboBox comboBox)
    • 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 executed in the event dispatch thread (EDT.) Clients are responsible for invoking this method in 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 executed in the event dispatch thread (EDT.) Clients are responsible for invoking this method in 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 executed in the event dispatch thread (EDT.) Clients are responsible for invoking this method in 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.
    • cellRendererIn

      @RunsInCurrentThread private Component cellRendererIn(JTable table, int row, int column)