happens when cell index is update from table's editing index to -1, failing test method:
@Test
public void testOffEditingIndex() {
int editingIndex = 2;
int cellIndex = -1;
cell.updateIndex(editingIndex);
table.edit(editingIndex, editingColumn);
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());
}
Looks like a left-over from fixingJDK-8150525 - bubbled up in review for JDK-8264127
The technical reason seems to be updateEditing which backs out if index == -1
private void updateEditing() {
if (getIndex() == -1 || getTableView() == null) return;
should make certain to not be in editing state in this case.
Attaching complete tests, that is also for the fixed state transitions (there are no tests for the former fix).
@Test
public void testOffEditingIndex() {
int editingIndex = 2;
int cellIndex = -1;
cell.updateIndex(editingIndex);
table.edit(editingIndex, editingColumn);
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());
}
Looks like a left-over from fixing
The technical reason seems to be updateEditing which backs out if index == -1
private void updateEditing() {
if (getIndex() == -1 || getTableView() == null) return;
should make certain to not be in editing state in this case.
Attaching complete tests, that is also for the fixed state transitions (there are no tests for the former fix).
- relates to
-
JDK-8265210 TreeCell: cell editing state not updated on cell re-use
- Resolved
-
JDK-8150525 TableView: data corruption when editing newly added item
- Resolved
-
JDK-8264127 ListCell editing status is true, when index changes while editing
- Resolved