Java Code Examples for javafx.scene.layout.VBox#setFillWidth()

The following examples show how to use javafx.scene.layout.VBox#setFillWidth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BooleanEditorFactory.java    From constellation with Apache License 2.0 6 votes vote down vote up
@Override
protected Node createEditorControls() {
    final VBox controls = new VBox();
    controls.setAlignment(Pos.CENTER);
    controls.setFillWidth(true);

    checkBox = new CheckBox("True");
    checkBox.setAlignment(Pos.CENTER);
    checkBox.selectedProperty().addListener((v, o, n) -> {
        update();
    });

    controls.getChildren().add(checkBox);

    return controls;
}
 
Example 2
Source File: CircleProperties.java    From UndoFX with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void start(Stage primaryStage) {
    Pane pane = new Pane();
    pane.setPrefWidth(400);
    pane.setPrefHeight(400);
    pane.getChildren().add(circle);

    HBox undoPanel = new HBox(20.0, undoBtn, redoBtn, saveBtn);

    VBox root = new VBox(10.0,
            pane,
            labeled("Color", colorPicker),
            labeled("Radius", radius),
            labeled("X", centerX),
            labeled("Y", centerY),
            undoPanel);
    root.setAlignment(Pos.CENTER);
    root.setFillWidth(false);

    Scene scene = new Scene(root);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
Example 3
Source File: ControlPropertiesEditorPane.java    From arma-dialog-creator with MIT License 6 votes vote down vote up
/** @return a titled pane for the accordion that holds all properties of a certain {@link ConfigPropertyCategory} */
@NotNull
private PlaceholderTitledPane getPropertiesTitledPane(@NotNull String title, @NotNull ConfigPropertyCategory category) {
	final VBox vb = new VBox(10);
	vb.setFillWidth(true);
	vb.setPadding(new Insets(5));
	final Label lblNoProps = new Label(bundle.getString("ControlPropertiesConfig.no_properties_available"));
	final PlaceholderTitledPane tp = new PlaceholderTitledPane(title, lblNoProps, vb, true);
	final ScrollPane scrollPane = tp.getScrollPane();
	if (scrollPane != null) {
		scrollPane.setFitToWidth(true);
		scrollPane.setStyle("-fx-background-color:transparent");
	}
	tp.setAnimated(false);

	return tp;
}
 
Example 4
Source File: CycleStepTileSkin.java    From tilesfx with Apache License 2.0 6 votes vote down vote up
@Override protected void initGraphics() {
    super.initGraphics();

    chartItems = new ArrayList<>();
    double sum = tile.getChartData().stream().mapToDouble(chartData -> chartData.getValue()).sum();
    tile.getChartData().forEach(chartData -> chartItems.add(new ChartItem(chartData, sum)));

    chartBox = new VBox(0);
    chartBox.setFillWidth(true);
    chartBox.getChildren().addAll(chartItems);

    titleText = new Text();
    titleText.setFill(tile.getTitleColor());
    Helper.enableNode(titleText, !tile.getTitle().isEmpty());

    text = new Text(tile.getText());
    text.setFill(tile.getUnitColor());
    Helper.enableNode(text, tile.isTextVisible());

    getPane().getChildren().addAll(titleText, text, chartBox);
}
 
Example 5
Source File: DetailsTab.java    From scenic-view with GNU General Public License v3.0 6 votes vote down vote up
public DetailsTab(final ScenicViewGui view, final Consumer<String> loader) {
    super(TAB_NAME);
    this.scenicView = view;
    this.loader = loader;

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    scrollPane.setFitToWidth(true);
    vbox = new VBox();
    vbox.setFillWidth(true);
    scrollPane.setContent(vbox);
    getStyleClass().add("all-details-pane");
    
    setGraphic(new ImageView(DisplayUtils.getUIImage("details.png")));
    setContent(scrollPane);
    setClosable(false);
}
 
Example 6
Source File: ADCCanvasView.java    From arma-dialog-creator with MIT License 5 votes vote down vote up
ADCCanvasView() {
	EditorManager editorManager = EditorManager.instance;
	this.display = editorManager.getEditingDisplay();
	canvasControls = new CanvasControls(this);
	this.uiCanvasEditor = new UICanvasEditor(editorManager.getResolution(), canvasControls, display);
	initializeUICanvasEditor(display);

	//init notification pane
	{
		VBox vboxNotifications = new VBox(10);
		vboxNotifications.setFillWidth(true);
		vboxNotifications.setAlignment(Pos.BOTTOM_RIGHT);
		vboxNotifications.setPadding(new Insets(5));
		vboxNotifications.setMinWidth(120);

		notificationPane = new NotificationPane(vboxNotifications);
		Notifications.setDefaultNotificationPane(notificationPane);
	}

	final StackPane stackPane = new StackPane(uiCanvasEditor, notificationPane.getContentPane());
	notificationPane.getContentPane().setMouseTransparent(true);

	this.getChildren().addAll(stackPane, canvasControls);
	HBox.setHgrow(canvasControls, Priority.ALWAYS);

	setOnMouseMoved(new CanvasViewMouseEvent(this));
	focusToCanvas(true);
}
 
Example 7
Source File: DrawFlagsEditorFactory.java    From constellation with Apache License 2.0 5 votes vote down vote up
@Override
protected Node createEditorControls() {
    final VBox controls = new VBox();
    controls.setFillWidth(true);

    drawNodesCheckBox = new CheckBox("Nodes");
    drawNodesCheckBox.selectedProperty().addListener((v, o, n) -> {
        update();
    });

    drawConnectionsCheckBox = new CheckBox("Connections");
    drawConnectionsCheckBox.selectedProperty().addListener((v, o, n) -> {
        update();
    });

    drawNodeLabelsCheckBox = new CheckBox("Node Labels");
    drawNodeLabelsCheckBox.selectedProperty().addListener((v, o, n) -> {
        update();
    });

    drawConnectionLabelsCheckBox = new CheckBox("Connection Labels");
    drawConnectionLabelsCheckBox.selectedProperty().addListener((v, o, n) -> {
        update();
    });

    drawBlazesCheckBox = new CheckBox("Blazes");
    drawBlazesCheckBox.selectedProperty().addListener((v, o, n) -> {
        update();
    });

    controls.getChildren().addAll(drawNodesCheckBox, drawConnectionsCheckBox, drawNodeLabelsCheckBox, drawConnectionLabelsCheckBox, drawBlazesCheckBox);

    return controls;
}
 
Example 8
Source File: ChooseConfigClassDialog.java    From arma-dialog-creator with MIT License 5 votes vote down vote up
public CategoryNode() {
	setAlignment(Pos.TOP_CENTER);

	taComment.setEditable(false);

	Label lblComment = new Label(bundle.getString("Popups.ChooseCustomControl.Category.All.comment"));
	lblComment.setAlignment(Pos.TOP_CENTER);

	VBox vbox = new VBox(5, lblComment, stackPaneComment);
	VBox.setVgrow(stackPaneComment, Priority.ALWAYS);
	stackPaneComment.setAlignment(Pos.TOP_CENTER);
	vbox.setAlignment(Pos.TOP_CENTER);
	vbox.setFillWidth(true);
	getChildren().add(vbox);
}
 
Example 9
Source File: ChooseMacroDialog.java    From arma-dialog-creator with MIT License 5 votes vote down vote up
@NotNull
private VBox getVboxLanguage(Language language, String languageToken) {
	VBox vboxLanguage = new VBox(5);
	vboxLanguage.setFillWidth(true);
	vboxLanguage.getChildren().add(new Label(language.getName()));

	StringTableLanguageTokenEditor editor = new StringTableLanguageTokenEditor();
	editor.setWrapText(true);
	editor.setEditable(false);
	editor.replaceText(languageToken);
	vboxLanguage.getChildren().add(editor);
	return vboxLanguage;
}
 
Example 10
Source File: StringTableEditorPopup.java    From arma-dialog-creator with MIT License 5 votes vote down vote up
public ConfigTab(@NotNull StringTableEditorPopup popup, @NotNull StringTable table, @NotNull ValueObserver<Language> previewLanguageObserver) {
	super(bundle.getString("StringTableEditorPopup.Tab.Config.tab_title"));
	VBox root = new VBox(10);
	root.setPadding(new Insets(10));
	root.setFillWidth(true);
	setContent(root);
	setGraphic(new ImageView(ADCIcons.ICON_GEAR));
	setClosable(false);

	ComboBox<Language> comboBoxLanguage = new ComboBox<>();
	comboBoxLanguage.getItems().addAll(KnownLanguage.values());
	comboBoxLanguage.getSelectionModel().select(previewLanguageObserver.getValue());
	comboBoxLanguage.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Language>() {
		@Override
		public void changed(ObservableValue<? extends Language> observable, Language oldValue, Language newValue) {
			previewLanguageObserver.updateValue(newValue);
		}
	});
	Label lblPreviewLanguage = new Label(bundle.getString("StringTableEditorPopup.Tab.Config.preview_language"), comboBoxLanguage);
	lblPreviewLanguage.setContentDisplay(ContentDisplay.RIGHT);
	root.getChildren().add(lblPreviewLanguage);

	Label lblSize = new Label(String.format(bundle.getString("StringTableEditorPopup.Tab.Config.number_of_keys_f"), table.getKeys().size()));
	root.getChildren().add(lblSize);

	Consumer<Object> keyListener = o -> {
		lblSize.setText(String.format(bundle.getString("StringTableEditorPopup.Tab.Config.number_of_keys_f"), table.getKeys().size()));
	};

	popup.listenersToRemoveFromTable.add((list, c) -> {
		keyListener.accept(null);
	});
	table.getKeys().addListener((list, change) -> {
		keyListener.accept(null);
	});
}
 
Example 11
Source File: DriversInstall.java    From ns-usbloader with GNU General Public License v3.0 4 votes vote down vote up
public DriversInstall(ResourceBundle rb){

        if (DriversInstall.isRunning)
            return;

        DriversInstall.isRunning = true;

        DownloadDriversTask downloadTask = new DownloadDriversTask();

        Button cancelButton = new Button(rb.getString("btn_Cancel"));

        HBox hBoxInformation = new HBox();
        hBoxInformation.setAlignment(Pos.TOP_LEFT);
        hBoxInformation.getChildren().add(new Label(rb.getString("windowBodyDownloadDrivers")));

        ProgressBar progressBar = new ProgressBar();
        progressBar.setPrefWidth(Double.MAX_VALUE);
        progressBar.progressProperty().bind(downloadTask.progressProperty());

        Label downloadStatusLabel = new Label();
        downloadStatusLabel.setWrapText(true);
        downloadStatusLabel.textProperty().bind(downloadTask.messageProperty());

        runInstallerStatusLabel = new Label();
        runInstallerStatusLabel.setWrapText(true);

        Pane fillerPane1 = new Pane();
        Pane fillerPane2 = new Pane();

        VBox parentVBox = new VBox();
        parentVBox.setAlignment(Pos.TOP_CENTER);
        parentVBox.setFillWidth(true);
        parentVBox.setSpacing(5.0);
        parentVBox.setPadding(new Insets(5.0));
        parentVBox.setFillWidth(true);
        parentVBox.getChildren().addAll(
                hBoxInformation,
                fillerPane1,
                downloadStatusLabel,
                runInstallerStatusLabel,
                fillerPane2,
                progressBar,
                cancelButton
        ); // TODO:FIX

        VBox.setVgrow(fillerPane1, Priority.ALWAYS);
        VBox.setVgrow(fillerPane2, Priority.ALWAYS);

        Stage stage = new Stage();

        stage.setTitle(rb.getString("windowTitleDownloadDrivers"));
        stage.getIcons().addAll(
                new Image("/res/dwnload_ico32x32.png"),    //TODO: REDRAW
                new Image("/res/dwnload_ico48x48.png"),
                new Image("/res/dwnload_ico64x64.png"),
                new Image("/res/dwnload_ico128x128.png")
        );
        stage.setMinWidth(400);
        stage.setMinHeight(150);

        Scene mainScene = new Scene(parentVBox, 405, 155);

        mainScene.getStylesheets().add(AppPreferences.getInstance().getTheme());

        stage.setOnHidden(windowEvent -> {
            downloadTask.cancel(true );
            DriversInstall.isRunning = false;
        });

        stage.setScene(mainScene);
        stage.show();
        stage.toFront();

        downloadTask.setOnSucceeded(event -> {
            cancelButton.setText(rb.getString("btn_Close"));

            String returnedValue = downloadTask.getValue();

            if (returnedValue == null)
                return;

            if (runInstaller(returnedValue))
                stage.close();
        });

        Thread downloadThread = new Thread(downloadTask);
        downloadThread.start();

        cancelButton.setOnAction(actionEvent -> {
            downloadTask.cancel(true );
            stage.close();
        });
    }
 
Example 12
Source File: MainWindow.java    From Quelea with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Create a new main window.
 * <p/>
 *
 * @param setApplicationWindow true if this main window should be set as the
 *                             application-wide main window, false otherwise.
 */
public MainWindow(boolean setApplicationWindow, boolean hasVLC) {
    setTitle("Quelea " + QueleaProperties.VERSION.getVersionString());
    Utils.addIconsToStage(this);
    BorderPane mainPane = new BorderPane();
    VBox.setVgrow(mainPane, Priority.SOMETIMES);
    noticeDialog = new NoticeDialog();
    globalThemeStore = new GlobalThemeStore();
    LOGGER.log(Level.INFO, "Creating main window");
    if (setApplicationWindow) {
        QueleaApp.get().setMainWindow(this);
    }
    setOnCloseRequest(new EventHandler<javafx.stage.WindowEvent>() {
        @Override
        public void handle(javafx.stage.WindowEvent t) {
            new ExitActionHandler().exit(t);
        }
    });
    LOGGER.log(Level.INFO, "Creating options dialog");
    preferencesDialog = new PreferencesDialog(QueleaApp.get().getClass(), hasVLC);

    LOGGER.log(Level.INFO, "Creating bible search dialog");
    bibleSearchDialog = new BibleSearchDialog();
    LOGGER.log(Level.INFO, "Creating bible browse dialog");
    bibleBrowseDialog = new BibleBrowseDialog();
    mainpanel = new MainPanel();
    LOGGER.log(Level.INFO, "Creating translation dialog");
    translationChoiceDialog = new TranslationChoiceDialog();

    menuBar = new MainMenuBar();

    HBox toolbarPanel = new HBox();
    mainToolbar = new MainToolbar();
    HBox.setHgrow(mainToolbar, Priority.ALWAYS);
    toolbarPanel.getChildren().add(mainToolbar);

    if (Utils.isMac()) {
        LOGGER.log(Level.INFO, "Is mac: true, using system menu bar");
        menuBar.setUseSystemMenuBar(true);
    }

    LOGGER.log(Level.INFO, "Creating menu box");
    VBox menuBox = new VBox();
    menuBox.setFillWidth(true);
    menuBox.getChildren().add(menuBar);
    menuBox.getChildren().add(toolbarPanel);
    menuBox.getChildren().add(mainPane);

    mainPane.setCenter(mainpanel);
    
    LOGGER.log(Level.INFO, "Setting scene info");
    SceneInfo sceneInfo = QueleaProperties.get().getSceneInfo();
    if (sceneInfo != null && !Utils.isOffscreen(sceneInfo)) { //Shouldn't be null unless something goes wrong, but guard against it anyway
        setScene(getScene(menuBox, (double)sceneInfo.getWidth(), (double)sceneInfo.getHeight()));
        setWidth(sceneInfo.getWidth());
        setHeight(sceneInfo.getHeight());
        setX(sceneInfo.getX());
        setY(sceneInfo.getY());
        if (Utils.isMac()) {
            setMinWidth(400);
            setMinHeight(300);

        } else {
            setMaximized(sceneInfo.isMaximised());
        }
    }
    else {
        setScene(getScene(menuBox));
    }
    LOGGER.log(Level.INFO, "Created main window.");
}
 
Example 13
Source File: SearchBox.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public SearchBox() {
    setId("SearchBox");
    setMinHeight(24);
    setPrefSize(150, 24);
    setMaxHeight(24);
    textBox = new TextField();
    textBox.setPromptText("Search");
    clearButton = new Button();
    clearButton.setVisible(false);
    getChildren().addAll(textBox, clearButton);
    clearButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent actionEvent) {
            textBox.setText("");
            textBox.requestFocus();
        }
    });
    textBox.setOnKeyReleased(new EventHandler<KeyEvent>() {
        @Override public void handle(KeyEvent keyEvent) {
            if (keyEvent.getCode() == KeyCode.DOWN) {
                ///System.out.println("SearchBox.handle DOWN");
                contextMenu.setFocused(true);
            }
        }
    });
    textBox.textProperty().addListener(new ChangeListener<String>() {
        @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            clearButton.setVisible(textBox.getText().length() != 0);
            if (textBox.getText().length() == 0) {
                if (contextMenu != null) contextMenu.hide();
                showError(null);
            } else {
                boolean haveResults = false;
                Map<DocumentType, List<SearchResult>> results = null;
                try {
                    if (indexSearcher == null) indexSearcher = new IndexSearcher();
                    results = indexSearcher.search(
                            textBox.getText() + (textBox.getText().matches("\\w+") ? "*" : "")
                    );
                    // check if we have any results
                    for (List<SearchResult> categoryResults: results.values()) {
                        if (categoryResults.size() > 0) {
                            haveResults = true;
                            break;
                        }
                    }
                } catch (ParseException e) {
                    showError(e.getMessage().substring("Cannot parse ".length()));
                }
                if (haveResults) {
                    showError(null);
                    populateMenu(results);
                    if (!contextMenu.isShowing()) contextMenu.show(SearchBox.this, Side.BOTTOM, 10,-5);
                } else {
                    if (searchErrorTooltip.getText() == null) showError("No matches");
                    contextMenu.hide();
                }
                contextMenu.setFocused(true);
            }
        }
    });
    // create info popup
    infoBox = new VBox();
    infoBox.setId("search-info-box");
    infoBox.setFillWidth(true);
    infoBox.setMinWidth(USE_PREF_SIZE);
    infoBox.setPrefWidth(350);
    infoName = new Label();
    infoName.setId("search-info-name");
    infoName.setMinHeight(USE_PREF_SIZE);
    infoName.setPrefHeight(28);
    infoDescription = new Label();
    infoDescription.setId("search-info-description");
    infoDescription.setWrapText(true);
    infoDescription.setPrefWidth(infoBox.getPrefWidth()-24);
    infoBox.getChildren().addAll(infoName,infoDescription);
    extraInfoPopup.getContent().add(infoBox);
    // hide info popup when context menu is hidden
    contextMenu.setOnHidden(new EventHandler<WindowEvent>() {
        @Override public void handle(WindowEvent windowEvent) {
            extraInfoPopup.hide();
        }
    });
}
 
Example 14
Source File: SearchBox.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public SearchBox() {
    setId("SearchBox");
    setMinHeight(24);
    setPrefSize(150, 24);
    setMaxHeight(24);
    textBox = new TextField();
    textBox.setPromptText("Search");
    clearButton = new Button();
    clearButton.setVisible(false);
    getChildren().addAll(textBox, clearButton);
    clearButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent actionEvent) {
            textBox.setText("");
            textBox.requestFocus();
        }
    });
    textBox.setOnKeyReleased(new EventHandler<KeyEvent>() {
        @Override public void handle(KeyEvent keyEvent) {
            if (keyEvent.getCode() == KeyCode.DOWN) {
                ///System.out.println("SearchBox.handle DOWN");
                contextMenu.setFocused(true);
            }
        }
    });
    textBox.textProperty().addListener(new ChangeListener<String>() {
        @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            clearButton.setVisible(textBox.getText().length() != 0);
            if (textBox.getText().length() == 0) {
                if (contextMenu != null) contextMenu.hide();
                showError(null);
            } else {
                boolean haveResults = false;
                Map<DocumentType, List<SearchResult>> results = null;
                try {
                    if (indexSearcher == null) indexSearcher = new IndexSearcher();
                    results = indexSearcher.search(
                            textBox.getText() + (textBox.getText().matches("\\w+") ? "*" : "")
                    );
                    // check if we have any results
                    for (List<SearchResult> categoryResults: results.values()) {
                        if (categoryResults.size() > 0) {
                            haveResults = true;
                            break;
                        }
                    }
                } catch (ParseException e) {
                    showError(e.getMessage().substring("Cannot parse ".length()));
                }
                if (haveResults) {
                    showError(null);
                    populateMenu(results);
                    if (!contextMenu.isShowing()) contextMenu.show(SearchBox.this, Side.BOTTOM, 10,-5);
                } else {
                    if (searchErrorTooltip.getText() == null) showError("No matches");
                    contextMenu.hide();
                }
                contextMenu.setFocused(true);
            }
        }
    });
    // create info popup
    infoBox = new VBox();
    infoBox.setId("search-info-box");
    infoBox.setFillWidth(true);
    infoBox.setMinWidth(USE_PREF_SIZE);
    infoBox.setPrefWidth(350);
    infoName = new Label();
    infoName.setId("search-info-name");
    infoName.setMinHeight(USE_PREF_SIZE);
    infoName.setPrefHeight(28);
    infoDescription = new Label();
    infoDescription.setId("search-info-description");
    infoDescription.setWrapText(true);
    infoDescription.setPrefWidth(infoBox.getPrefWidth()-24);
    infoBox.getChildren().addAll(infoName,infoDescription);
    extraInfoPopup.getContent().add(infoBox);
    // hide info popup when context menu is hidden
    contextMenu.setOnHidden(new EventHandler<WindowEvent>() {
        @Override public void handle(WindowEvent windowEvent) {
            extraInfoPopup.hide();
        }
    });
}
 
Example 15
Source File: AttributeEditorDialog.java    From constellation with Apache License 2.0 4 votes vote down vote up
public AttributeEditorDialog(final boolean restoreDefaultButton, final AbstractEditor<?> editor) {
    final VBox root = new VBox();
    root.setPadding(new Insets(10));
    root.setAlignment(Pos.CENTER);
    root.setFillWidth(true);

    errorLabel = new Label("");
    errorLabel.setId("error");

    okButton = new Button("Ok");
    cancelButton = new Button("Cancel");
    defaultButton = new Button("Restore Default");

    okButton.setOnAction(e -> {
        editor.performEdit();
        hideDialog();
    });

    cancelButton.setOnAction(e -> {
        hideDialog();
    });

    defaultButton.setOnAction(e -> {
        editor.setDefaultValue();
    });

    okCancelHBox = new HBox(20);
    okCancelHBox.setPadding(new Insets(10));
    okCancelHBox.setAlignment(Pos.CENTER);
    if (restoreDefaultButton) {
        okCancelHBox.getChildren().addAll(okButton, cancelButton, defaultButton);
    } else {
        okCancelHBox.getChildren().addAll(okButton, cancelButton);
    }

    okButton.disableProperty().bind(editor.getEditDisabledProperty());
    errorLabel.visibleProperty().bind(editor.getEditDisabledProperty());
    errorLabel.textProperty().bind(editor.getErrorMessageProperty());
    final Node ec = editor.getEditorControls();
    VBox.setVgrow(ec, Priority.ALWAYS);
    root.getChildren().addAll(editor.getEditorHeading(), ec, errorLabel, okCancelHBox);

    final Scene scene = new Scene(root);
    scene.setFill(Color.rgb(0, 0, 0, 0));
    scene.getStylesheets().add(AttributeEditorDialog.class.getResource(DARK_THEME).toExternalForm());
    fxPanel.setScene(scene);
}
 
Example 16
Source File: ErrorDialog.java    From phoenicis with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Creates the expandable content component of the {@link ErrorDialog}
 *
 * @return The expandable content component of the {@link ErrorDialog}
 */
private VBox createExpandableContent() {
    final Label label = new Label(tr("Stack trace:"));

    final TextArea textArea = new TextArea();
    textArea.setEditable(false);

    textArea.textProperty().bind(StringBindings.map(exceptionProperty(), ExceptionUtils::getFullStackTrace));

    VBox.setVgrow(textArea, Priority.ALWAYS);

    final VBox container = new VBox(label, textArea);

    container.setFillWidth(true);

    return container;
}
 
Example 17
Source File: TimelinePanel.java    From constellation with Apache License 2.0 4 votes vote down vote up
/**
     * Creates organises the TimelinePanel's layers.
     */
    private void doLayout() {
        // Layer that contains the timelinechart component:
        final BorderPane timelinePane = new BorderPane();

        timelinePane.setCenter(timeline);
        // The layer that contains the time extent labels:
        final BorderPane labelsPane = new BorderPane();
        BorderPane.setAlignment(lowerTime, Pos.CENTER);
        BorderPane.setAlignment(upperTime, Pos.CENTER);
        BorderPane.setMargin(lowerTime, new Insets(-32.0, -40.0, 0.0, -60.0));
        BorderPane.setMargin(upperTime, new Insets(-32.0, -60.0, 0.0, -40.0));
        labelsPane.setLeft(lowerTime);
        labelsPane.setRight(upperTime);
        labelsPane.setMouseTransparent(true);

        // Layer that combines the newly constructed time-extents with the timeline layer:
        final StackPane stackPane = new StackPane();
        StackPane.setAlignment(labelsPane, Pos.CENTER);
//        extentLabelPane.maxHeightProperty().bind(stackPane.heightProperty());
        StackPane.setAlignment(timelinePane, Pos.CENTER);
//        timelinePane.prefHeightProperty().bind(stackPane.heightProperty());
        stackPane.setPadding(Insets.EMPTY);
        stackPane.getChildren().addAll(timelinePane, labelsPane);

        // Layout the menu bar and the timeline object:
        final VBox vbox = new VBox();
//        stackPane.prefHeightProperty().bind(vbox.heightProperty());
        VBox.setVgrow(toolbar, Priority.NEVER);
        VBox.setVgrow(stackPane, Priority.ALWAYS);
        vbox.getChildren().addAll(toolbar, stackPane);
        vbox.setAlignment(Pos.TOP_CENTER);
        vbox.setFillWidth(true);

        // Organise the inner pane:
        AnchorPane.setTopAnchor(vbox, 0d);
        AnchorPane.setBottomAnchor(vbox, 0d);
        AnchorPane.setLeftAnchor(vbox, 0d);
        AnchorPane.setRightAnchor(vbox, 0d);
        innerPane.getChildren().add(vbox);
        innerPane.prefHeightProperty().bind(super.heightProperty());
        innerPane.prefWidthProperty().bind(super.widthProperty());

        // Attach the inner pane to the root:
        this.getChildren().add(innerPane);
    }