Search in sources :

Example 1 with GridCell

use of io.github.vocabhunter.analysis.grid.GridCell in project VocabHunter by VocabHunter.

the class FilterGridController method buildColumn.

private TableColumn<GridLine, GridCell> buildColumn(final FilterGridModel filterModel, final int index) {
    TableColumn<GridLine, GridCell> column = new TableColumn<>(ColumnNameTool.columnName(index));
    column.setSortable(false);
    column.setCellValueFactory(features -> extractValue(features, index));
    column.setCellFactory(c -> new FilterGridWordTableCell(filterModel.getColumnSelections().get(index)));
    if (isScrollableColumnList(filterModel)) {
        column.setPrefWidth(PREFERRED_COLUMN_WIDTH);
    }
    return column;
}
Also used : GridLine(io.github.vocabhunter.analysis.grid.GridLine) FilterGridWordTableCell(io.github.vocabhunter.gui.view.FilterGridWordTableCell) TableColumn(javafx.scene.control.TableColumn) GridCell(io.github.vocabhunter.analysis.grid.GridCell)

Example 2 with GridCell

use of io.github.vocabhunter.analysis.grid.GridCell in project VocabHunter by VocabHunter.

the class FilterGridController method extractValue.

private ObservableValue<GridCell> extractValue(final CellDataFeatures<GridLine, GridCell> features, final int index) {
    List<GridCell> cells = features.getValue().getCells();
    GridCell cell = getCell(cells, index);
    return cellCache.computeIfAbsent(cell, ReadOnlyObjectWrapper::new);
}
Also used : ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) GridCell(io.github.vocabhunter.analysis.grid.GridCell)

Aggregations

GridCell (io.github.vocabhunter.analysis.grid.GridCell)2 GridLine (io.github.vocabhunter.analysis.grid.GridLine)1 FilterGridWordTableCell (io.github.vocabhunter.gui.view.FilterGridWordTableCell)1 ReadOnlyObjectWrapper (javafx.beans.property.ReadOnlyObjectWrapper)1 TableColumn (javafx.scene.control.TableColumn)1