use of com.jfoenix.controls.cells.editors.base.JFXTreeTableCell in project JFoenix by jfoenixadmin.
the class JFXTreeTableColumn method init.
private void init() {
this.setCellFactory(new Callback<TreeTableColumn<S, T>, TreeTableCell<S, T>>() {
@Override
public TreeTableCell<S, T> call(TreeTableColumn<S, T> param) {
return new JFXTreeTableCell<S, T>() {
@Override
protected void updateItem(T item, boolean empty) {
if (item == getItem())
return;
super.updateItem(item, empty);
if (item == null) {
super.setText(null);
super.setGraphic(null);
} else if (item instanceof Node) {
super.setText(null);
super.setGraphic((Node) item);
} else {
super.setText(item.toString());
super.setGraphic(null);
}
}
};
}
});
Platform.runLater(() -> {
final ContextMenu contextMenu = new ContextMenu();
// contextMenu.setOnShowing((showing)->{
// System.out.println("showing");
// });
// contextMenu.setOnShown((shown)->{
// System.out.println("shown");
// });
MenuItem item1 = new MenuItem("Group");
item1.setOnAction((action) -> {
((JFXTreeTableView) getTreeTableView()).group(this);
});
MenuItem item2 = new MenuItem("UnGroup");
item2.setOnAction((action) -> {
((JFXTreeTableView) getTreeTableView()).unGroup(this);
});
contextMenu.getItems().addAll(item1, item2);
setContextMenu(contextMenu);
});
}
Aggregations