get JavaFX Dockable Tab - Java JavaFX

Java examples for JavaFX:TabPane

Description

get JavaFX Dockable Tab

Demo Code


import javafx.collections.ObservableMap;
import javafx.scene.Node;
import javafx.scene.control.Tab;
import java.util.UUID;

public class Main{
    private static String TAB_DOCKABLE = PREFIX + "tab.dockable";
    public static final Dockable getDockable(Node node) {
        return (Dockable) node.getProperties().get(TAB_DOCKABLE);
    }/*from  ww w  . j ava2 s.c o m*/
    /**
     * Get properties from known objects. Currently supported are Node, Tab
     * @param obj
     * @return object properties
     * @throws java.lang.IllegalArgumentException if object types is not supported
     */
    private static ObservableMap<Object, Object> getProperties(Object obj) {
        if (obj instanceof Node)
            ((Node) obj).getProperties();
        if (obj instanceof Tab)
            ((Tab) obj).getProperties();
        throw new IllegalArgumentException("Unknown object type: "
                + obj.getClass().getName());
    }
}

Related Tutorials