Collections.sort(availableBuilders); StringConverter<PropertyTypeId> converter = DesignerUtil.stringConverter(PropertyTypeId::getStringId, PropertyTypeId::lookupMnemonic); propertyTypeColumn.setCellFactory(ChoiceBoxTableCell.forTableColumn(converter, availableBuilders)); propertyNameColumn.setCellValueFactory(new PropertyValueFactory<>("name")); propertyValueColumn.setCellValueFactory(new PropertyValueFactory<>("value")); propertyNameColumn.setCellFactory(TextFieldTableCell.forTableColumn()); propertyValueColumn.setCellFactory(TextFieldTableCell.forTableColumn()); this.setEditable(false);
logDateColumn.setCellFactory(column -> new TableCell<LogEntry, LogEntry>() { logMessageColumn.setCellFactory(col -> { TableCell<LogEntry, String> cell = new TableCell<>(); Text text = new Text();
@Override public TableColumn<SelectionTableRowData, Boolean> getTableColumn() { TableColumn<SelectionTableRowData, Boolean> tableColumn = new TableColumn<>(getColumnTitle()); tableColumn.setCellFactory(CheckBoxTableCell.forTableColumn(tableColumn)); tableColumn.setCellValueFactory( new Callback<CellDataFeatures<SelectionTableRowData, Boolean>, ObservableValue<Boolean>>() { @Override public ObservableValue<Boolean> call(CellDataFeatures<SelectionTableRowData, Boolean> param) { if (param.getValue() != null) { return param.getValue().reverse; } return null; } }); return tableColumn; }
@Override default TableColumn<SelectionTableRowData, T> getTableColumn() { TableColumn<SelectionTableRowData, T> tableColumn = new TableColumn<>(getColumnTitle()); tableColumn.setCellFactory(cellFactory()); tableColumn.setCellValueFactory(cellValueFactory()); tableColumn.setComparator(comparator()); return tableColumn; }
levelOfGrowthColumn.setCellFactory(percantageCellFactory);
@Override public TableColumn<SelectionTableRowData, PdfDescriptorLoadingStatus> getTableColumn() { TableColumn<SelectionTableRowData, PdfDescriptorLoadingStatus> tableColumn = new TableColumn<>(getColumnTitle()); tableColumn.setCellFactory(cellFactory()); tableColumn.setCellValueFactory(cellValueFactory()); tableColumn.setComparator(null); tableColumn.setSortable(false); tableColumn.setMaxWidth(26); tableColumn.setMinWidth(26); return tableColumn; }
public static <T, U> void setTextOverrunCellFactory(TableColumn<T, U> column, final OverrunStyle overrunStyle) { column.setCellFactory(new Callback<TableColumn<T, U>, TableCell<T, U>>() { @Override public TableCell<T, U> call(TableColumn<T, U> param) { TextFieldTableCell<T, U> cell = new TextFieldTableCell<T, U>(); cell.setTextOverrun(overrunStyle); return cell; } }); }
public static <T, U> void setConverterCellFactory(TableColumn<T, U> column, final StringConverter<U> converter) { column.setCellFactory(new Callback<TableColumn<T, U>, TableCell<T, U>>() { @Override public TableCell<T, U> call(TableColumn<T, U> param) { return new TextFieldTableCell<T, U>(converter); } }); }
Callback<TableColumn, TableCell> checkboxCellFactory = new Callback<TableColumn, TableCell>() { @Override public TableCell call(TableColumn p) { return new CheckboxCell(); } }; TableColumn selectColumn = (TableColumn) tbvDatos.getColumns().get(1); selectColumn.setCellValueFactory(new PropertyValueFactory("selected")); selectColumn.setCellFactory(checkboxCellFactory);
@SuppressWarnings("unchecked") protected <T> void processTableFormat(@Nonnull TableColumn<E, T> column, String columnName, int columnIndex) { column.setCellValueFactory(cell -> (ObservableValue<T>) format.getColumnObservableValue(cell.getValue(), columnIndex)); column.setCellFactory(param -> format.getTableCellFactory(columnIndex).createTableCell(param)); }
private void addSelectColumn() { headerCheckboxCol.setPrefWidth(40); headerCheckboxCol.setCellValueFactory(new PropertyValueFactory<>("selected")); headerCheckboxCol.setCellFactory(param -> buildCell()); headerCheckboxCol.setGraphic(headerColCheckbox); headerCheckboxCol.setVisible(false); tableView.getColumns().add(0, headerCheckboxCol); }
@SuppressWarnings({"unchecked"}) private void addSelectColumn() { headerCheckboxCol.setPrefWidth(40); headerCheckboxCol.setCellValueFactory(new PropertyValueFactory<>("selected")); headerCheckboxCol.setCellFactory(param -> buildCell()); headerCheckboxCol.setGraphic(headerColCheckbox); headerCheckboxCol.setVisible(false); tableView.getColumns().add(0, headerCheckboxCol); }
@Override protected void setupTableColumns() { // setup factories for providing cell values tcDate.setCellValueFactory(new PropertyValueFactory<>("dateTime")); tcWeight.setCellValueFactory(new PropertyValueFactory<>("value")); tcComment.setCellValueFactory(cellData -> new SimpleStringProperty( // StringUtils.getFirstLineOfText(cellData.getValue().getComment()))); // setup custom factories for displaying cells tcDate.setCellFactory(new LocalDateCellFactory<>()); tcWeight.setCellFactory(new FormattedNumberCellFactory<>(value -> // value == null ? null : getContext().getFormatUtils().weightToString(value.floatValue(), 2))); }
@SuppressWarnings("unchecked") protected void computeColumns() { for (int i = 0; i < format.getColumnCount(); i++) { final String columnName = format.getColumnName(i); TableColumn column = new TableColumn(columnName); final int columnIndex = i; final TableCellFactory tableCellFactory = format.getTableCellFactory(i); if (tableCellFactory != null) { column.setCellFactory(cell -> tableCellFactory.createTableCell((TableColumn) cell)); } column.setCellValueFactory(cell -> format.getObservableValue((E) ((TableColumn.CellDataFeatures) cell).getValue(), columnIndex)); columns.add(column); } }
public static <T> void setupEditableBooleanColumn(TableColumn<T, Boolean> column, final ColumnBooleanAccessor<T> propertyAccessor) { column.getTableView().setEditable(true); column.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<T, Boolean>, ObservableValue<Boolean>>() { @Override public ObservableValue<Boolean> call(CellDataFeatures<T, Boolean> param) { return propertyAccessor.getProperty(param.getValue()); } }); column.setOnEditCommit(new EventHandler<CellEditEvent<T, Boolean>>() { @Override public void handle(CellEditEvent<T, Boolean> t) { propertyAccessor.getProperty(t.getRowValue()).setValue(t.getNewValue()); } }); column.setCellFactory(CheckBoxTableCell.forTableColumn(column)); column.setEditable(true); }
/** * T Tableobject * Column Display Type */ public static <T> void setupEditableStringColumn(TableColumn<T, String> column, final ColumnStringAccessor<T> propertyAccessor) { column.getTableView().setEditable(true); column.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<T, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(CellDataFeatures<T, String> param) { return propertyAccessor.getProperty(param.getValue()); } }); column.setEditable(true); column.setOnEditCommit(new EventHandler<CellEditEvent<T, String>>() { @Override public void handle(CellEditEvent<T, String> t) { propertyAccessor.getProperty(t.getRowValue()).setValue(t.getNewValue()); } }); column.setCellFactory(new Callback<TableColumn<T, String>, TableCell<T, String>>() { @Override public TableCell<T, String> call(TableColumn<T, String> param) { return new EditingCell<T>(); } }); }
@Override protected void setupTableColumns() { // setup factories for providing cell values tcDate.setCellValueFactory(new PropertyValueFactory<>("dateTime")); tcComment.setCellValueFactory(cellData -> new SimpleStringProperty( // StringUtils.getFirstLineOfText(cellData.getValue().getComment()))); // setup custom factories for displaying cells tcDate.setCellFactory(new LocalDateCellFactory<>()); }
private TableColumn buildRootColumn() { final TableColumn t = new TableColumn(); // cell value factory t.setCellValueFactory(param -> { if (((CellDataFeatures) param).getValue() instanceof OperationData) { final OperationData operationData = (OperationData) ((CellDataFeatures) param).getValue(); final SimpleObjectProperty<OperationData> op = new SimpleObjectProperty(); op.set(operationData); return op; } return null; }); t.setPrefWidth(600); t.setMinWidth(600); // cell factory t.setCellFactory(arg0 -> new FlowTableCell()); return t; }
/** * Creates a totals column from the original bound column. * * @param boundColumn the original column * @return the totals column */ @SuppressWarnings("unchecked") protected TableColumn<S,?> createTotalsColumn(TableColumn<S,?> boundColumn) { TableColumn totalsColumn = new TableColumn<>(); if (isSummable(boundColumn)) { totalsColumn.setCellValueFactory(boundColumn.getCellValueFactory()); totalsColumn.setCellFactory(boundColumn.getCellFactory()); } // sync column widths totalsColumn.prefWidthProperty().bind(boundColumn.widthProperty()); // sync visibility totalsColumn.visibleProperty().bind(boundColumn.visibleProperty()); return totalsColumn; }
private void buildTableViewTab(Tab tab) { GridPane grid = new GridPane(); grid.setPadding(new Insets(5, 5, 5, 5)); grid.setHgap(5); grid.setVgap(5); // create the tableview TableColumn<TestPerson, Boolean> invitedColumn = new TableColumn<TestPerson, Boolean>("Invited"); invitedColumn.setCellValueFactory(new PropertyValueFactory<TestPerson, Boolean>("invited")); TableColumn<TestPerson, String> nameColumn = new TableColumn<TestPerson, String>("First Name"); nameColumn.setCellValueFactory(new PropertyValueFactory<TestPerson, String>("firstName")); TableView<TestPerson> tableView = new TableView<TestPerson>(data); tableView.getColumns().setAll(invitedColumn, nameColumn); // set the cell factory in the invited TableColumn invitedColumn.setCellFactory(CheckBoxTableCell.forTableColumn(invitedColumn)); grid.add(tableView, 0, 0); GridPane.setVgrow(tableView, Priority.ALWAYS); GridPane.setHgrow(tableView, Priority.ALWAYS); tab.setContent(grid); }