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

ComboBoxTableCell: edit must be committed on selecting old value

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 8u60
    • javafx
    • None

    Description

      To reproduce, run example,

      - double-click cell in combo column to start edit, drop-down opens
      - click selected (= old) value or press enter
      - expected: edit committed, that is combo removed
      - actual: drop-down closed, combo still visible

      similar for choice cell

      public class ComboChoiceCellIssues extends Application {

          private Parent getContent() {
              ObservableList<Shape> items = FXCollections.observableArrayList(
                      new Line(), new Rectangle(), new Arc());
         
              TableView<Shape> table = new TableView<>(items);
              table.setEditable(true);
              TableColumn<Shape, StrokeType> plain = new TableColumn<>("Plain");
              plain.setCellValueFactory(new PropertyValueFactory("strokeType"));
              
              TableColumn<Shape, StrokeType> combo = new TableColumn<>("Combo");
              combo.setCellValueFactory(new PropertyValueFactory("strokeType"));
              combo.setCellFactory(ComboBoxTableCell.forTableColumn(StrokeType.values()));
              
              TableColumn<Shape, StrokeType> choice = new TableColumn<>("Choice");
              choice.setCellValueFactory(new PropertyValueFactory("strokeType"));
              choice.setCellFactory(ChoiceBoxTableCell.forTableColumn(StrokeType.values()));
              
              table.getColumns().addAll(plain, combo, choice);
              
              Parent content = new BorderPane(table);
              return content;
          }

          @Override
          public void start(Stage primaryStage) throws Exception {
              primaryStage.setScene(new Scene(getContent()));
              primaryStage.setTitle(FXUtils.version());
              primaryStage.show();
          }

          public static void main(String[] args) {
              launch(args);
          }
      }

      Attachments

        Activity

          People

            jgiles Jonathan Giles
            fastegal Jeanette Winzenburg
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: