Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8265206

Tree-/TableCell: editing state not updated on cell re-use

    XMLWordPrintable

    Details

      Description

      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 fixing JDK-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).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              fastegal Jeanette Winzenburg
              Reporter:
              fastegal Jeanette Winzenburg
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: