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

ComboBoxTableCell: combo must not commit on navigation in drop-down

XMLWordPrintable

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

      To reproduce: run example, double-click into combo cell to open drop-down

      - press up (or down) to navigate to another item
      - expected: drop-down still open and editing
      - actual: drop-down closed and edit committed

      choice behaves as expected

      The example:

      import javafx.application.Application;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.scene.Parent;
      import javafx.scene.Scene;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableView;
      import javafx.scene.control.cell.ChoiceBoxTableCell;
      import javafx.scene.control.cell.ComboBoxTableCell;
      import javafx.scene.control.cell.PropertyValueFactory;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.shape.*;
      import javafx.stage.Stage;

      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<Shape, StrokeType>("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.show();
          }

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

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

              Created:
              Updated:
              Resolved: