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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 9
    • Fix Version/s: tbd
    • Component/s: javafx
    • Environment:

      9ea180

      Description

      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());
          }
          

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated: