Search in sources :

Example 1 with CustomTreeCell

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());
}
Also used : CustomTreeCell(fvarrui.sysadmin.editor.components.tree.CustomTreeCell) TreeCell(javafx.scene.control.TreeCell) CustomTreeCell(fvarrui.sysadmin.editor.components.tree.CustomTreeCell) TreeView(javafx.scene.control.TreeView) ChallengeTreeItem(fvarrui.sysadmin.editor.components.tree.ChallengeTreeItem)

Aggregations

ChallengeTreeItem (fvarrui.sysadmin.editor.components.tree.ChallengeTreeItem)1 CustomTreeCell (fvarrui.sysadmin.editor.components.tree.CustomTreeCell)1 TreeCell (javafx.scene.control.TreeCell)1 TreeView (javafx.scene.control.TreeView)1