Example usage for javafx.scene.control TabPane getProperties

List of usage examples for javafx.scene.control TabPane getProperties

Introduction

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

Prototype

public final ObservableMap<Object, Object> getProperties() 

Source Link

Document

Returns an observable map of properties on this node for use primarily by application developers.

Usage

From source file:com.thomaskuenneth.tkmactuning.TKMacTuning.java

private void addPlugin(TabPane tabPane, String className, String pluginName) {
    try {//from   ww  w  . ja va  2  s .  co  m
        Class clazz = Class.forName(className);
        Constructor cons = clazz.getConstructor(TKMacTuning.class, String.class);
        AbstractPlugin plugin = (AbstractPlugin) cons.newInstance(this, pluginName);
        String primaryUICategory = plugin.getPrimaryUICategory();
        Tab tab = (Tab) tabPane.getProperties().get(primaryUICategory);
        if (tab == null) {
            tab = new Tab(primaryUICategory);
            tabPane.getProperties().put(primaryUICategory, tab);
            tabPane.getTabs().add(tab);
            VBox content = new VBox();
            content.setPadding(LayoutConstants.PADDING_1);
            content.setSpacing(LayoutConstants.VERTICAL_CONTROL_GAP);
            tab.setContent(content);
        }
        VBox content = (VBox) tab.getContent();
        Node node = plugin.getNode();
        if (node != null) {
            String secondaryUICategory = plugin.getSecondaryUICategory();
            if (AbstractPlugin.ROOT.equals(secondaryUICategory)) {
                content.getChildren().add(node);
            } else {
                Pane group = (Pane) tabPane.getProperties().get(GROUP + secondaryUICategory);
                if (group == null) {
                    group = new VBox(LayoutConstants.VERTICAL_CONTROL_GAP);
                    tabPane.getProperties().put(GROUP + secondaryUICategory, group);
                    HBox headline = new HBox();
                    headline.setStyle(
                            "-fx-border-insets: 0 0 1 0; -fx-border-color: transparent transparent -fx-text-box-border transparent; -fx-border-width: 1;");
                    headline.getChildren().add(new Label(secondaryUICategory));
                    group.getChildren().add(headline);
                    content.getChildren().add(group);
                }
                group.getChildren().add(node);
            }
        } else {
            LOGGER.log(Level.SEVERE, "could not create control for plugin {0}({1})",
                    new Object[] { className, pluginName });
        }
    } catch (InstantiationException | ClassNotFoundException | NoSuchMethodException | SecurityException
            | InvocationTargetException | IllegalAccessException ex) {
        LOGGER.log(Level.SEVERE, "addPlugin()", ex);
    }
}