FEST

Add selectedRow() to TableCell and TableCellByColumnName (issue 226)

Details

  • Type: New Feature New Feature
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: FEST-Swing 1.1
  • Fix Version/s: FEST-Swing 1.2a4
  • Component/s: Swing
  • Labels:
    None
  • Number of attachments :
    0

Description

From Ken Geis:

I would like to have a method on TableCell and TableCellByColumnName so that I could do something like

tableFixture.cell(TableCell.selectedRow().column(1)).enterValue("foo");

I would expect selectedRow() to throw an exception (or return null, but I that would just lead to an annoying NPE that the developer needs to track down) if no row is selected. If multiple rows are selected, it would throw an exception.


Original report: Issue 226 (Google Code)

Activity

Hide
Alex Ruiz added a comment -

It is really not possible to add the method selectedRow to TableCell, without getting into a "weird" API. TableCell only cares about row and column indices, and has no idea which is the selected row of any JTable, because it is not bound to any JTable. I tried to add a "useSelectedRow" flag, but the state of the TableCell looks pretty weird to me.

Instead, I added the method selectedRow to JTableFixture, so at least we can write something like:

JTableCellFixture cell = table.cell(row(table.selectedRow()).column(0));
Show
Alex Ruiz added a comment - It is really not possible to add the method selectedRow to TableCell, without getting into a "weird" API. TableCell only cares about row and column indices, and has no idea which is the selected row of any JTable, because it is not bound to any JTable. I tried to add a "useSelectedRow" flag, but the state of the TableCell looks pretty weird to me. Instead, I added the method selectedRow to JTableFixture, so at least we can write something like:
JTableCellFixture cell = table.cell(row(table.selectedRow()).column(0));
Hide
Alex Ruiz added a comment -

Finally I figured out a way to fix this issue properly.

Show
Alex Ruiz added a comment - Finally I figured out a way to fix this issue properly.
Hide
Alex Ruiz added a comment -

Fixed for real this time. Now it is possible to do the following:

JTableCellFixture cell = dialog.table("records").cell(TableCellInSelectedRow.selectedRow().column(2));
Show
Alex Ruiz added a comment - Fixed for real this time. Now it is possible to do the following:
JTableCellFixture cell = dialog.table("records").cell(TableCellInSelectedRow.selectedRow().column(2));

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: