Example usage for javafx.scene.control.cell ComboBoxTableCell forTableColumn

List of usage examples for javafx.scene.control.cell ComboBoxTableCell forTableColumn

Introduction

In this page you can find the example usage for javafx.scene.control.cell ComboBoxTableCell forTableColumn.

Prototype

public static <S, T> Callback<TableColumn<S, T>, TableCell<S, T>> forTableColumn(
        final ObservableList<T> items) 

Source Link

Document

Creates a ComboBox cell factory for use in TableColumn controls.

Usage

From source file:demo.projects.ui.ProjectsPresenter.java

private void configureTasksTable() {

    taskNameColumn.setCellValueFactory(new PropertyValueFactory<Task, String>("name"));
    taskDescriptionColumn.setCellValueFactory(new PropertyValueFactory<Task, String>("description"));

    taskStatusColumn.setCellValueFactory(new PropertyValueFactory<Task, Task.Status>("status"));
    taskStatusColumn.setCellFactory(ComboBoxTableCell.forTableColumn(Task.Status.values()));

    taskStatusColumn.setOnEditCommit(edit -> {
        edit.getRowValue().setStatus(edit.getNewValue());
        projectTrackingService.save(edit.getRowValue());
    });//  w w w.  j a  v  a 2s .c  o  m
}