JavaFX 8 : Iterate through TableView cells and get graphics


I'm having troubles accessing the objects displayed in the TableColumn

Here's the code snippet where I set the graphics of one Column. Only want to show the Name of the Person object: (Any better/easier way in doing that is welcome)

            .setCellFactory(new Callback<TableColumn<Site, Person>, TableCell<Site, Person>>() {

                public TableCell<Site, Person> call(
                        TableColumn<Site, Person> param) {

                    TableCell<Site, Person> ownerCell = new TableCell<Site, Person>() {

                        protected void updateItem(Person item, boolean empty) {
                            if (item != null) {
                                Label label = new Label(item.getName());
                    return ownerCell;

Now I'm trying to loop through the rows and columns go get every cell to generate 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) {
                // I get the object bound to the cell here, but I only want
                // to have what i've set as graphics - what the user sees on UI
                // How to use getGraphics() ?

So the question is, how do I get the getGraphics() I've set in the CellFactory?

11/8/2014 9:00:11 AM

A static method for any type of cell content.

Method getItems() gets the value of the property items. Property is the underlying data model for the TableView. Note that it has a generic type that must match the type of the TableView itself.

  private static ArrayList<String> getTableViewValues(TableView tableView) {
    ArrayList<String> values = new ArrayList<>();
    ObservableList<TableColumn> columns = tableView.getColumns();

    for (Object row : tableView.getItems()) {
      for (TableColumn column : columns) {
          (String) column.

    return values;
1/15/2016 12:15:02 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow