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