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

Regression - ComboBoxTableCell: editable combo doesn't commit




      To reproduce, run the example below,

      - start editing such that the popup is open (notice that the current cell value is selected)
      - type some char
      - press enter
      - expected: the edited value is committed (that is same in first column)
      - actual: the edit is canceled (that is value unchanged)

      Additional observation:
      - start editing such that the popup is not open
      - type some char and press enter (not committing at this point is yet another misbehavior;)
      - open popup: notice that nothing is selected
      - press enter
      - expected and actual: edited value is committed

      Worked as expected in both scenarios in release 8u60, could be introduced by https://bugs.openjdk.java.net/browse/JDK-8138683 - using the showing property of the popup is not a good trigger for committing ..

      The example, slightly changed version of the older issue, to allow editable combo cells

      import javafx.application.Application;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.scene.Node;
      import javafx.scene.Parent;
      import javafx.scene.Scene;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableView;
      import javafx.scene.control.cell.ComboBoxTableCell;
      import javafx.scene.control.cell.PropertyValueFactory;
      import javafx.scene.control.cell.TextFieldTableCell;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.shape.Arc;
      import javafx.scene.shape.Line;
      import javafx.scene.shape.Rectangle;
      import javafx.scene.shape.Shape;
      import javafx.stage.Stage;

      import java.util.List;
      import java.util.logging.Logger;
      import java.util.stream.Collectors;

      public class ComboCellIssuesContinued extends Application {
          private Parent getContent() {
              ObservableList<Shape> items = FXCollections.observableArrayList(
                     new Line(), new Rectangle(), new Arc());
              items.forEach(p -> p.setId(p.getClass().getSimpleName()));
              List<String> names = items.stream().map(Node::getId).collect(Collectors.toList());
              TableView<Shape> table = new TableView<>(items);
              TableColumn<Shape, String> plain = new TableColumn<>("Plain");
              plain.setCellValueFactory(new PropertyValueFactory("id"));
              TableColumn<Shape, String> combo = new TableColumn<>("Combo");
              combo.setCellValueFactory(new PropertyValueFactory("id"));
              combo.setCellFactory(p -> {
                  ComboBoxTableCell tc = new ComboBoxTableCell(names.toArray()); //"someId", "other", "orNothing");
                  return tc;
              Parent content = new BorderPane(table);
              return content;

          public void start(Stage primaryStage) throws Exception {
              primaryStage.setScene(new Scene(getContent()));

          public static void main(String[] args) {
          private static final Logger LOG = Logger





            jgiles Jonathan Giles
            fastegal Jeanette Winzenburg
            0 Vote for this issue
            2 Start watching this issue