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

List/TableCell: must not fire event in startEdit if already editing

XMLWordPrintable

      though unspecified, I would expect the event to be fired only if there's a state transition from not-editing -> editing. TreeCell behaves as expected, List/TableCell don't

      Failing test for ListCell:

          @Test
          public void testListEditStartOnCellTwiceStandalone() {
              ListView<String> control = new ListView<>(FXCollections
                      .observableArrayList("Item1", "Item2", "Item3", "Item4"));
              control.setEditable(true);
              control.setCellFactory(TextFieldListCell.forListView());
              new StageLoader(control);
              int editIndex = 1;
              IndexedCell cell = getCell(control, editIndex);
              SimpleIntegerProperty counter = new SimpleIntegerProperty(0);
              control.addEventHandler(ListView.editStartEvent(), e -> counter.set(counter.get() + 1));
             
              // start edit on control
              cell.startEdit();
              // start again -> nothing changed, no event
              cell.startEdit();
              // test editEvent
              assertEquals("second start on editing cell must not fire event", 1, counter.get());
          }
          

            fastegal Jeanette Winzenburg
            fastegal Jeanette Winzenburg
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: