use of fvarrui.sysadmin.editor.components.tree.CustomTreeCell in project Challenger4SysAdmins by fvarrui.
the class TreeEditorController method initialize.
@Override
public void initialize(URL location, ResourceBundle resources) {
treeView.setCellFactory(new Callback<TreeView<Object>, TreeCell<Object>>() {
public TreeCell<Object> call(TreeView<Object> param) {
return new CustomTreeCell();
}
});
challenge.addListener((o, ov, nv) -> {
if (nv != null)
treeView.setRoot(new ChallengeTreeItem(nv));
else
treeView.setRoot(null);
});
selectedItem.addListener((o, ov, nv) -> {
if (nv != null) {
seleccionado.set(nv.getValue());
} else {
seleccionado.set(null);
}
});
selectedItem.bind(treeView.getSelectionModel().selectedItemProperty());
addButton.disableProperty().bind(seleccionado.isNull());
deleteButton.disableProperty().bind(seleccionado.isNull());
}
Aggregations