All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.factoryfx.javafx.widget.tableview.TableDataColumnSpec Maven / Gradle / Ivy

package de.factoryfx.javafx.widget.tableview;

import java.util.function.Function;

import de.factoryfx.data.Data;
import javafx.beans.value.ObservableValue;
import javafx.scene.control.TableColumn;

public class TableDataColumnSpec {

    private final String columnName;
    private final Function> cellValueProvider;
    private final String cssColumnClass;

    public TableDataColumnSpec(String columnName, Function> cellValueProvider, String cssColumnClass) {
        this.columnName = columnName;
        this.cellValueProvider = cellValueProvider;
        this.cssColumnClass = cssColumnClass;
    }

    public TableColumn create(){
        TableColumn column = new TableColumn<>(columnName);
        column.setCellValueFactory(param->cellValueProvider.apply(param.getValue()));
        if (cssColumnClass!=null){
            column.getStyleClass().add(cssColumnClass);
        }
        return column;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy