for (@SuppressWarnings("rawtypes") TableColumn column : getTableView().getColumns()) { column.getCellFactory().call(column); // now compiles }
public static TableCell<?, ?> getCellAt(TableView<?> tableView, int row, int column) { TableCell<?, ?> cell = getVisibleCellAt(tableView, row, column); if (cell != null) { return cell; } TableColumn tableColumn = tableView.getColumns().get(column); cell = (TableCell) tableColumn.getCellFactory().call(tableColumn); ObservableValue cellObservableValue = tableColumn.getCellObservableValue(row); if (cellObservableValue == null) return null; Object value = cellObservableValue.getValue(); Method updateItem; try { updateItem = cell.getClass().getDeclaredMethod("updateItem", new Class[] {Object.class, Boolean.TYPE}); updateItem.setAccessible(true); updateItem.invoke(cell, value, false); return cell; } catch (Throwable e) { throw new RuntimeException(e); } }
if (items == null || items.isEmpty()) return; Callback cellFactory = col.getCellFactory(); if (cellFactory == null) return;
/** * 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; }
for (TableColumn column: table.getColumns()) { if (column.isVisible()) { Callback cellFactory = column.getCellFactory(); if (cellFactory != null) { TableCell cell = (TableCell) cellFactory.call(column);