Search in sources :

Example 1 with Divider

use of javafx.scene.control.SplitPane.Divider in project phoebus by ControlSystemStudio.

the class EditorGUI method showProperties.

/**
 * @param show Show properties?
 */
public void showProperties(final boolean show) {
    if (show == arePropertiesShown())
        return;
    if (show) {
        double tdiv = prefs.getDouble(DisplayEditorInstance.TREE_DIVIDER, 0.2);
        double pdiv = prefs.getDouble(DisplayEditorInstance.PROP_DIVIDER, 0.8);
        center_split.getItems().add(properties_box);
        if (isWidgetTreeShown())
            Platform.runLater(() -> setDividerPositions(tdiv, pdiv));
        else
            Platform.runLater(() -> setDividerPositions(pdiv));
    } else
        center_split.getItems().remove(properties_box);
    for (Divider div : center_split.getDividers()) {
        div.positionProperty().removeListener(divider_listener);
        div.positionProperty().addListener(divider_listener);
    }
    // Update pref about last prop state
    prefs.putBoolean(SHOW_PROPS, show);
}
Also used : Divider(javafx.scene.control.SplitPane.Divider)

Example 2 with Divider

use of javafx.scene.control.SplitPane.Divider in project phoebus by ControlSystemStudio.

the class EditorGUI method createElements.

private Parent createElements() {
    editor = new DisplayEditor(toolkit, org.csstudio.display.builder.editor.Preferences.undo_stack_size);
    tree = new WidgetTree(editor);
    property_panel = new PropertyPanel(editor);
    // Left: Widget tree
    Label header = new Label("Widgets");
    header.setMaxWidth(Double.MAX_VALUE);
    header.getStyleClass().add("header");
    tree.configureHeaderDnD(header);
    final Control tree_control = tree.create();
    VBox.setVgrow(tree_control, Priority.ALWAYS);
    hookWidgetTreeContextMenu(tree_control);
    tree_box = new VBox(header, tree_control);
    // Center: Editor
    final Node editor_scene = editor.create();
    // Right: Properties
    header = new Label("Properties");
    header.setMaxWidth(Double.MAX_VALUE);
    header.getStyleClass().add("header");
    properties_box = new VBox(header, property_panel);
    center_split = new SplitPane(tree_box, editor_scene, properties_box);
    double ldiv = prefs.getDouble(DisplayEditorInstance.TREE_DIVIDER, 0.2);
    double rdiv = prefs.getDouble(DisplayEditorInstance.PROP_DIVIDER, 0.8);
    center_split.setDividerPositions(ldiv, rdiv);
    for (Divider div : center_split.getDividers()) {
        div.positionProperty().addListener(divider_listener);
    }
    if (!prefs.getBoolean(SHOW_TREE, true))
        showWidgetTree(false);
    if (!prefs.getBoolean(SHOW_PROPS, true))
        showProperties(false);
    final BorderPane layout = new BorderPane();
    layout.setCenter(center_split);
    BorderPane.setAlignment(center_split, Pos.TOP_LEFT);
    editor_scene.addEventFilter(MouseEvent.MOUSE_MOVED, mouse_tracker);
    // Handle copy/paste/...
    layout.addEventFilter(KeyEvent.KEY_PRESSED, key_handler);
    return layout;
}
Also used : WidgetTree(org.csstudio.display.builder.editor.tree.WidgetTree) Control(javafx.scene.control.Control) BorderPane(javafx.scene.layout.BorderPane) Node(javafx.scene.Node) Label(javafx.scene.control.Label) SplitPane(javafx.scene.control.SplitPane) VBox(javafx.scene.layout.VBox) Divider(javafx.scene.control.SplitPane.Divider) PropertyPanel(org.csstudio.display.builder.editor.properties.PropertyPanel)

Example 3 with Divider

use of javafx.scene.control.SplitPane.Divider in project phoebus by ControlSystemStudio.

the class EditorGUI method showWidgetTree.

/**
 * @param show Show widget tree?
 */
public void showWidgetTree(final boolean show) {
    if (show == isWidgetTreeShown())
        return;
    double tdiv = prefs.getDouble(DisplayEditorInstance.TREE_DIVIDER, 0.2);
    double pdiv = prefs.getDouble(DisplayEditorInstance.PROP_DIVIDER, 0.8);
    if (show) {
        center_split.getItems().add(0, tree_box);
        if (arePropertiesShown())
            Platform.runLater(() -> setDividerPositions(tdiv, pdiv));
        else
            Platform.runLater(() -> setDividerPositions(tdiv));
    } else {
        center_split.getItems().remove(tree_box);
        if (arePropertiesShown())
            Platform.runLater(() -> setDividerPositions(pdiv));
    }
    for (Divider div : center_split.getDividers()) {
        div.positionProperty().removeListener(divider_listener);
        div.positionProperty().addListener(divider_listener);
    }
    // Update pref about last tree state
    prefs.putBoolean(SHOW_TREE, show);
}
Also used : Divider(javafx.scene.control.SplitPane.Divider)

Aggregations

Divider (javafx.scene.control.SplitPane.Divider)3 Node (javafx.scene.Node)1 Control (javafx.scene.control.Control)1 Label (javafx.scene.control.Label)1 SplitPane (javafx.scene.control.SplitPane)1 BorderPane (javafx.scene.layout.BorderPane)1 VBox (javafx.scene.layout.VBox)1 PropertyPanel (org.csstudio.display.builder.editor.properties.PropertyPanel)1 WidgetTree (org.csstudio.display.builder.editor.tree.WidgetTree)1