Example usage for javafx.scene.control TreeItem getParent

List of usage examples for javafx.scene.control TreeItem getParent

Introduction

In this page you can find the example usage for javafx.scene.control TreeItem getParent.

Prototype

public final TreeItem<T> getParent() 

Source Link

Document

The parent of this TreeItem.

Usage

From source file:sonicScream.utilities.ScriptParser.java

private static StringBuilder recursiveBuildScript(StringBuilder scriptString, TreeItem<String> node,
        int level) {
    String tabs = "";
    for (int i = 1; i < level; i++) {
        tabs += "\t";
    }// w ww.  j a v  a2 s .  c  o  m

    if (node.getParent() != null) {
        scriptString.append(tabs + node.getValue() + "\n");
    }
    /* 
     * TODO: Figure out a way to track brace placement without just checking to see if a node has children. Maybe 
     * a custom node object that tracks whether a node is followed by braces?
     */
    if (!node.isLeaf()) {
        scriptString.append(tabs + "{\n");
        level++;
        for (int i = 0; i < node.getChildren().size(); i++) {
            scriptString = recursiveBuildScript(scriptString, node.getChildren().get(i), level);
        }
        level--;
        scriptString.append(tabs + "}\n");
    }
    return scriptString;
}

From source file:ubicrypt.ui.ctrl.HomeController.java

private static void removeItem(final TreeItem<ITreeItem> item) {
    final TreeItem<ITreeItem> parent = item.getParent();
    parent.getChildren().remove(item);/*from ww  w .  j  a  va2 s.c  o  m*/
    if (parent.getChildren().isEmpty() && !(parent.getValue() instanceof RootFilesItem)) {
        removeItem(parent);
    }
}

From source file:ubicrypt.ui.files.FilesController.java

private static void removeItem(final TreeItem<ITreeItem> item) {
    final TreeItem<ITreeItem> parent = item.getParent();
    parent.getChildren().remove(item);//from   w  w w .  ja  va 2s  .  c o m
}