Example usage for javafx.scene.control Tab setUserData

List of usage examples for javafx.scene.control Tab setUserData

Introduction

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

Prototype

public void setUserData(Object value) 

Source Link

Document

Convenience method for setting a single Object property that can be retrieved at a later date.

Usage

From source file:be.makercafe.apps.makerbench.Main.java

private Tab createEditor(String text, Path path, File item) {
    Tab t = null;
    if (path != null && path.toFile().isFile()) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("path", path.toFile().getAbsolutePath());
        // We should lookup the type of editor here
        // TODO: refactor quick and dirty implementation
        Editor editor;//from  w  w w.j a  v  a  2s .c  o m
        String absPath = path.toFile().getAbsolutePath();
        if (absPath.endsWith("jfxscad")) {
            editor = new JFXScadEditor(text, path);
        } else if (absPath.endsWith("jfxmill")) {
            editor = new JFXMillEditor(text, path);
        } else if (absPath.endsWith("xml") || absPath.endsWith("xsd")) {
            editor = new XMLEditor(text, path);
        } else if (absPath.endsWith("gcode") || absPath.endsWith("tap")) {
            editor = new GCodeEditor(text, path);
        } else {
            editor = new TextEditor(text, path);
        }
        t = editor.getTab();
        // Hookup the userdata
        t.setUserData(map);
        tabFolder.getTabs().add(t);
    }
    return t;
}