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);
}
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;
}
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);
}
Aggregations