-
Task
-
Resolution: Delivered
-
P3
-
jfx16
assuming we have an editing cell at editingIndex and a editCancel handler, the cancel event we receive in the handler must carry editingIndex as its cancelled edit location, something like
control.edit(editingIndex);
control.setOnEditCancel(e -> assertEquals(editingIndex, e.getIndex()));
This invariant must hold always, independent of how the edit is cancelled:
- cancel on control
- cancel on cell
- cell re-use
- implicitly by modifying the items
- tree/tableCell only: on collapse the parent
currently, this invariant is broken differently for different cell types:
- TreeCell (detected while fixingJDK-8265210) on cell re-use
- ListCell (reported inJDK-8187226 and JDK-8165214) on cancel on control
- Tree/TableCell (reported inJDK-8187229) on cancel on control
that happens because the implementations either take the control's or the cell's editing location _at the time of sending_ the event:
// ListCell, Tree/TableCell: use control's location
editingLocation = control.getEditingLocation();
fire(new XXEvent(...editingLocation...);
// TreeCell
editingLocation = this.getTreeItem();
fire(new XXEvent(...editingLocation...)
Both are wrong, leading to cell specific failures as noted in the related issues. The correct location is that _at the time of starting_ the cell edit.
Locally, I have experimented with fixing TreeCell and it might be as simple as keeping track of the editing location in startEdit. If that really fixes the cancel (not fully tested yet), it should be applied to all cell types.
control.edit(editingIndex);
control.setOnEditCancel(e -> assertEquals(editingIndex, e.getIndex()));
This invariant must hold always, independent of how the edit is cancelled:
- cancel on control
- cancel on cell
- cell re-use
- implicitly by modifying the items
- tree/tableCell only: on collapse the parent
currently, this invariant is broken differently for different cell types:
- TreeCell (detected while fixing
- ListCell (reported in
- Tree/TableCell (reported in
that happens because the implementations either take the control's or the cell's editing location _at the time of sending_ the event:
// ListCell, Tree/TableCell: use control's location
editingLocation = control.getEditingLocation();
fire(new XXEvent(...editingLocation...);
// TreeCell
editingLocation = this.getTreeItem();
fire(new XXEvent(...editingLocation...)
Both are wrong, leading to cell specific failures as noted in the related issues. The correct location is that _at the time of starting_ the cell edit.
Locally, I have experimented with fixing TreeCell and it might be as simple as keeping track of the editing location in startEdit. If that really fixes the cancel (not fully tested yet), it should be applied to all cell types.
- is blocked by
-
JDK-8187229 Tree/TableCell: cancel event must return correct editing location
- Resolved
-
JDK-8267094 TreeCell: cancelEvent must return correct editing location
- Resolved
-
JDK-8165214 ListView.EditEvent.getIndex() does not return the correct index
- Resolved
-
JDK-8187226 ListView: EditEvent on cancel has incorrect index
- Closed
- relates to
-
JDK-8265210 TreeCell: cell editing state not updated on cell re-use
- Resolved