Example usage for javafx.scene.control TreeItem TreeItem

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

Introduction

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

Prototype

public TreeItem(final T value, final Node graphic) 

Source Link

Document

Creates a TreeItem with the value property set to the provided object, and the graphic set to the provided Node.

Usage

From source file:main.java.vasolsim.common.GenericUtils.java

/**
 * Creates a tree item// w  w w .  java  2  s  .c om
 *
 * @param resourceLoaderClass
 * @param title
 * @param iconLocation
 * @param imgSize
 *
 * @return
 */
public static TreeItem<String> createTreeItem(Class resourceLoaderClass, String title, String iconLocation,
        int imgSize) {
    if (resourceLoaderClass == null || title == null || iconLocation == null || imgSize <= 0)
        return null;

    ImageView examsIcon = new ImageView(
            new Image(resourceLoaderClass.getResource(iconLocation).toExternalForm()));
    examsIcon.setFitHeight(imgSize);
    examsIcon.setFitWidth(imgSize);
    return new TreeItem<String>(title, examsIcon);
}

From source file:main.java.vasolsim.common.GenericUtils.java

public static TreeItem<TreeElement> createTreeItem(Class resourceLoaderClass, TreeElement box,
        String iconLocation, int imgSize) {
    if (resourceLoaderClass == null || box == null || iconLocation == null || imgSize <= 0)
        return null;

    ImageView examsIcon = new ImageView(
            new Image(resourceLoaderClass.getResource(iconLocation).toExternalForm()));
    examsIcon.setFitHeight(imgSize);/*from w  w  w  .j  a v a 2  s .  c  o  m*/
    examsIcon.setFitWidth(imgSize);
    return new TreeItem<TreeElement>(box, examsIcon);
}

From source file:net.rptools.tokentool.controller.TokenTool_Controller.java

public void updateRecentOverlayTreeItems(Path filePath) {
    try {/*from   ww  w  .  j a  va 2  s .co m*/
        TreeItem<Path> recentOverlay = new TreeItem<Path>(filePath,
                ImageUtil.getOverlayThumb(new ImageView(), filePath));

        // Remove first so if it is on the list it forces to top of list
        recentOverlayTreeItems.remove(filePath);
        recentOverlayTreeItems.put(filePath, recentOverlay);
    } catch (IOException e) {
        log.error("Error loading recent overlay preference for " + filePath.toString());
    }
}