I'm having problems accessing objects displayed in a TableColumn
Here's a snippet of code where I set the graphics for one column. Just want to show the Name of Person object: (Any better / easier way to do this is welcome)
ownerColumn
.setCellFactory(new Callback<TableColumn<Site, Person>, TableCell<Site, Person>>() {
@Override
public TableCell<Site, Person> call(
TableColumn<Site, Person> param) {
TableCell<Site, Person> ownerCell = new TableCell<Site, Person>() {
@Override
protected void updateItem(Person item, boolean empty) {
if (item != null) {
Label label = new Label(item.getName());
setGraphic(label);
}
}
};
return ownerCell;
}
});
Now I'm trying to skip rows and columns so that each cell generates a report at the end, reflecting the displayed text / graphics in the Tableview. Like this
for (Object r : this.tableview.getItems()) {
for (Object c : this.tableview.getColumns()) {
javafx.scene.control.TableColumn column = (javafx.scene.control.TableColumn) c;
if (column.getCellData(r) != null) {
}
}
}
So the question is, how do I get getGraphics () that I installed in CellFactory?
source
share