Reputation: 133
I have to create my own implementation of CellFactory for TreeTableView. My cell can contain two types of values - String and Enums. Based on this type I want to have another implementation of displaying this item.
The easy way is verifying the type in Cell#updateItem and split in this method.
But how to separate this on the CellFactory level? Pseudocode to better describe.
public class EditableDataObjectValueCellFactory implements Callback<TreeTableColumn<ITableEntry, ?>,
TreeTableCell<ITableEntry, ?>> {
@Override
public TreeTableCell<ITableEntry, ?> call( TreeTableColumn<ITableEntry, ?> aColumn ) {
if(aColumn.getRenderedRow().getValue() instanceOf Enum)
return new EnumTreeCell();
return new BasicTreeCell();
}
}
Upvotes: 0
Views: 59