RFR: 8252238: TableView: Editable (pseudo-editable) cells should respect the row editability

Ajit Ghaisas aghaisas at openjdk.java.net
Fri Jun 18 10:17:31 UTC 2021


On Sun, 6 Jun 2021 12:44:00 GMT, Marius Hanl <mhanl at openjdk.org> wrote:

> This PR enables Tree- and TableCells to also check the row editability when an edit should happen. With this a Tree- or TableCell is not editable, when the row where the cell is in is not.
> 
> While this PR fixes the problem described in the ticket, it does not fix the example.
> This is due the example uses the **CheckBoxTableCell**, which is a ready-to-use subclass of **TableCell**. 
> 
> While looking into this, I found out that multiple sub implementations still have this issue, but the fix is not always the same, e.g. CheckBoxTableCell should disable the CheckBox (in **updateItem**), while the ChoiceBoxTableCell should check the row editability in the **startEdit** method (like this PR does).
> 
> I created a follow-up issues for fixing all the sub Tree- and TableCell implementation which do not count the row editability in:
> [JDK-8268295](https://bugs.openjdk.java.net/browse/JDK-8268295)

modules/javafx.controls/src/main/java/javafx/scene/control/TableCell.java line 310:

> 308:                 (table != null && !table.isEditable()) ||
> 309:                 (column != null && !column.isEditable()) ||
> 310:                 (row != null) && !row.isEditable()) {

Incorrect Line ---- "(row != null) && !row.isEditable())"
Correction required ----  "(row != null && !row.isEditable()))"

Refer similar line which is rightly implemented in TreeTableCell.java.

modules/javafx.controls/src/test/java/test/javafx/scene/control/TableCellTest.java line 327:

> 325: 
> 326:     @Test
> 327:     public void testCellInUneditableRowIsNotEditable() {

I recommend adding tests for cell.startEdit() using all combinations of TableView, TableColumn and TableRow editable states.

modules/javafx.controls/src/test/java/test/javafx/scene/control/TreeTableCellTest.java line 638:

> 636:     @Test
> 637:     public void testCellInUneditableRowIsNotEditable() {
> 638:         tree.setEditable(true);

I recommend adding tests for cell.startEdit() using all combinations of TreeTableView, TreeTableColumn and TreeTableRow editable states.

-------------

PR: https://git.openjdk.java.net/jfx/pull/529


More information about the openjfx-dev mailing list