similar to pre-fix of JDK-8150525, the cell's editing property is not updated when updating its index, examples of failing tests:
int editingIndex = 2;
int cellIndex = 1;
@Test
public void testOffEditingIndex() {
cell.updateIndex(editingIndex);
TreeItem<String> editingItem = table.getTreeItem(editingIndex);
table.edit(editingItem);
cell.updateIndex(cellIndex);
assertEquals("sanity: cell index changed", cellIndex, cell.getIndex());
assertFalse("cell must not be editing on update from editingIndex" + editingIndex
+ " to cellIndex " + cellIndex, cell.isEditing());
}
@Test
public void testToEditingIndex() {
cell.updateIndex(cellIndex);
TreeItem<String> editingItem = table.getTreeItem(editingIndex);
table.edit(editingItem);
cell.updateIndex(editingIndex);
assertEquals("sanity: cell at editing index", editingIndex, cell.getIndex());
assertTrue("cell must be editing on update from " + cellIndex
+ " to editingIndex " + editingIndex, cell.isEditing());
}
fix might be similar like that for TableCell (force updateEditing always) - doing so still leaves some unhandled transitions. Needs further digging.
int editingIndex = 2;
int cellIndex = 1;
@Test
public void testOffEditingIndex() {
cell.updateIndex(editingIndex);
TreeItem<String> editingItem = table.getTreeItem(editingIndex);
table.edit(editingItem);
cell.updateIndex(cellIndex);
assertEquals("sanity: cell index changed", cellIndex, cell.getIndex());
assertFalse("cell must not be editing on update from editingIndex" + editingIndex
+ " to cellIndex " + cellIndex, cell.isEditing());
}
@Test
public void testToEditingIndex() {
cell.updateIndex(cellIndex);
TreeItem<String> editingItem = table.getTreeItem(editingIndex);
table.edit(editingItem);
cell.updateIndex(editingIndex);
assertEquals("sanity: cell at editing index", editingIndex, cell.getIndex());
assertTrue("cell must be editing on update from " + cellIndex
+ " to editingIndex " + editingIndex, cell.isEditing());
}
fix might be similar like that for TableCell (force updateEditing always) - doing so still leaves some unhandled transitions. Needs further digging.
- relates to
-
JDK-8266969 All Cells: cancelEvent must return correct editing location
- Closed
-
JDK-8150525 TableView: data corruption when editing newly added item
- Resolved
-
JDK-8267094 TreeCell: cancelEvent must return correct editing location
- Resolved
-
JDK-8264127 ListCell editing status is true, when index changes while editing
- Resolved
-
JDK-8265206 Tree-/TableCell: editing state not updated on cell re-use
- Resolved
(2 links to)