Closed GoogleCodeExporter closed 9 years ago
Hi again,
It would be nice if TableCell could be constructed directly with the column
name.
This would require TableCell to have access to the JTable instance.
Giving TableCell "direct" access to the table would be just too low level.
A TableCell instance shouldn't really exist without a JTableFixture instance.
I would consider making TableCell an internal class of JTableFixture.
JTableFixture could have a method to return a TableCell for any cell.
All cell manipulation, like editing, could be handled by TableCell.
Manipulation of multiple cells could still be handled by JTableFixture.
I've implemented something similar for a custom component.
There are some issues to take into account.
TableCell would have a more complex driver, it would need access to the JTable.
I would make this driver an internal class of JTableDriver.
I would also make the target of JTableDriver (the JTable) an instance variable.
This way the inner driver (that of TableCell) could have access to it.
Making the target of a driver an instance variable wouldn't be a problem as
currently
there's one driver per fixture.
This would also eliminate the extra parameter (the target component) from
driver methods.
I would appreciate some feedback, some pros and cons to the approach detailed
above.
Maybe some design decisions regarding JTableFixture, TableCell and their
drivers.
Regards,
Csabi
Original comment by csaba.ju...@gmail.com
on 7 Jul 2008 at 9:20
Original comment by Alex.Rui...@gmail.com
on 7 Jul 2008 at 5:58
Hi Csabi,
I finished implementing this new feature. Here is what I did:
1. Added method 'columnIndexFor(Object)' in
org.fest.swing.fixture.JTableFixture.
2. Added method 'cell(TableCellByColumnName cell)' to
org.fest.swing.fixture.JTableFixture that returns a JTableCellFixture from a row
index and column name.
3. Replaced org.fest.swing.driver.JTableCell and
org.fest.swing.fixture.TableCell
with org.fest.swing.data.TableCell.
Although I agree that TableCell be an internal class of JTableFixture, I'd
prefer to
leave just as a "fluent" way to specify row and column indices (just a struct).
I
created TableCellByColumnName which is another struct but this one has a row
index
and a columnName. I tried to unified this two classes, but it was becoming
cumbersome
for the user to know when to use a column index or when to use a column name.
At the
end, I thought it will make more sense to leave them as two separate classes.
Original comment by Alex.Rui...@gmail.com
on 14 Oct 2008 at 6:11
Hi Alex,
Thank you very much for implementing this feature.
I'll give you some feedback as soon as I can.
Csabi
Original comment by csaba.ju...@gmail.com
on 14 Oct 2008 at 6:47
Original issue reported on code.google.com by
csaba.ju...@gmail.com
on 7 Jul 2008 at 8:59