Example usage for javafx.scene.layout Priority ALWAYS

List of usage examples for javafx.scene.layout Priority ALWAYS

Introduction

In this page you can find the example usage for javafx.scene.layout Priority ALWAYS.

Prototype

Priority ALWAYS

To view the source code for javafx.scene.layout Priority ALWAYS.

Click Source Link

Document

Layout area will always try to grow (or shrink), sharing the increase (or decrease) in space with other layout areas that have a grow (or shrink) of ALWAYS.

Usage

From source file:org.samcrow.frameviewer.ui.db.DatabaseConnectionDialog.java

public DatabaseConnectionDialog(String connectionTypeName) {
    this.connectionTypeName = connectionTypeName;
    setTitle("Database connection");
    // Placeholder
    root.getChildren().add(new Region());

    // Buttons/*  w  w w  .  j  a va  2s.c om*/
    {
        final HBox buttonBox = new HBox();
        buttonBox.setPadding(new Insets(10));

        cancelButton.setCancelButton(true);
        buttonBox.getChildren().add(cancelButton);
        cancelButton.setOnAction((ActionEvent t) -> {
            hide();
        });

        final Region spacer = new Region();
        buttonBox.getChildren().add(spacer);
        HBox.setHgrow(spacer, Priority.ALWAYS);

        nextButton.setDefaultButton(true);
        buttonBox.getChildren().add(nextButton);

        root.getChildren().add(buttonBox);
    }

    switchToConnection();

    final Scene scene = new Scene(root, 220, root.getPrefHeight());
    setScene(scene);
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    Scene scene = new Scene(box, 200, 200);
    stage.setScene(scene);//  w  w w  .j av a  2  s  . c o m
    stage.setTitle("ListViewSample");
    box.getChildren().addAll(list, label);
    VBox.setVgrow(list, Priority.ALWAYS);

    label.setLayoutX(10);
    label.setLayoutY(115);
    label.setFont(Font.font("Verdana", 20));

    list.setItems(data);

    list.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {
        @Override
        public ListCell<String> call(ListView<String> list) {
            return new ColorRectCell();
        }
    });

    list.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
        public void changed(ObservableValue<? extends String> ov, String old_val, String new_val) {
            label.setText(new_val);
            label.setTextFill(Color.web(new_val));
        }
    });
    stage.show();
}

From source file:gov.va.isaac.gui.listview.operations.ParentReplace.java

@Override
public void init(ObservableList<SimpleDisplayConcept> conceptList) {
    super.init(conceptList);
    root_.add(new Label("Replace: "), 0, 0);

    replaceOptions_ = new ComboBox<>();
    replaceOptions_.setMaxWidth(Double.MAX_VALUE);
    replaceOptions_.setPromptText("-Populate the Concepts List-");
    root_.add(ErrorMarkerUtils.setupErrorMarker(replaceOptions_, replaceOptionsInvalidString_), 1, 0);
    ComboBoxSetupTool.setupComboBox(replaceOptions_);

    root_.add(new Label("With Parent: "), 0, 1);
    withConcept_ = new ConceptNode(null, true);
    root_.add(withConcept_.getNode(), 1, 1);

    GridPane.setHgrow(withConcept_.getNode(), Priority.ALWAYS);
    FxUtils.preventColCollapse(root_, 0);
    initActionListeners();/*w w  w.j a va  2 s  .c o  m*/
    replaceOptions_.getItems().addAll(conceptList);
}

From source file:intelligent.wiki.editor.gui.fx.dialogs.ModifyLinkDialog.java

private void initContent() {
    content.add(new Label(i18n.getString("insert-link-dialog.url-label-text")), 0, 0);
    content.add(urlInput, 1, 0);//from   w  ww  .j  a v a2s  . c  om
    GridPane.setHgrow(urlInput, Priority.ALWAYS);

    content.add(new Label(i18n.getString("insert-link-dialog.caption-label-text")), 0, 1);
    content.add(captionInput, 1, 1);
    GridPane.setHgrow(captionInput, Priority.ALWAYS);
}

From source file:gov.va.isaac.gui.listview.operations.ParentRetire.java

@Override
public void init(ObservableList<SimpleDisplayConcept> conceptList) {
    super.init(conceptList);
    root_.add(new Label("Retire as parent"), 0, 0);
    retireAsParent_.setPromptText("-Populate the Concepts List-");
    Node n = ErrorMarkerUtils.setupErrorMarker(retireAsParent_, replaceOptionsInvalidString_);
    root_.add(n, 1, 0);//from  ww  w .  jav a2 s . com

    ComboBoxSetupTool.setupComboBox(retireAsParent_);
    // TODO populate retireAsParentCombo

    retireAsParent_.setMaxWidth(Double.MAX_VALUE);
    GridPane.setHgrow(n, Priority.ALWAYS);
    FxUtils.preventColCollapse(root_, 0);

    retireAsParent_.getItems().addListener(new ListChangeListener<SimpleDisplayConcept>() {
        @Override
        public void onChanged(javafx.collections.ListChangeListener.Change<? extends SimpleDisplayConcept> c) {
            if (retireAsParent_.getItems().size() > 0) {
                replaceOptionsInvalidString_.set(null);
                if (retireAsParent_.getSelectionModel().getSelectedItem() == null) {
                    retireAsParent_.getSelectionModel().selectFirst();
                }
            } else {
                replaceOptionsInvalidString_.set("A concept must be selected from this drop down");
                retireAsParent_.getSelectionModel().clearSelection();
                retireAsParent_.setValue(null);
                retireAsParent_.setPromptText("-Populate the Concepts List-");
            }
        }
    });

    allValid_ = new BooleanBinding() {
        {
            super.bind(replaceOptionsInvalidString_);
        }

        @Override
        protected boolean computeValue() {
            return StringUtils.isBlank(replaceOptionsInvalidString_.get());
        }
    };

}

From source file:org.pdfsam.ui.module.Footer.java

public Footer(RunButton runButton, OpenButton openButton, String ownerModule) {
    this.ownerModule = defaultString(ownerModule);
    this.openButton = openButton;
    this.runButton = runButton;
    this.getStyleClass().addAll("pdfsam-container", "footer-pane");
    this.statusLabel.getStyleClass().add("status-label");
    this.statusLabel.setVisible(false);
    this.bar.setMaxWidth(Double.MAX_VALUE);
    this.bar.getStyleClass().add("pdfsam-footer-bar");
    this.statusLabel.setMaxHeight(Double.MAX_VALUE);
    VBox progressPane = new VBox(statusLabel, bar);
    progressPane.getStyleClass().add("progress-pane");
    VBox.setVgrow(statusLabel, Priority.ALWAYS);
    HBox.setHgrow(bar, Priority.ALWAYS);
    HBox.setHgrow(progressPane, Priority.ALWAYS);
    this.failed.setVisible(false);
    StackPane buttons = new StackPane(failed, openButton);
    buttons.setAlignment(Pos.CENTER_LEFT);
    this.getChildren().addAll(runButton, buttons, progressPane);
    eventStudio().add(TaskExecutionRequestEvent.class, e -> {
        if (e.getModuleId().equals(ownerModule)) {
            failed.setVisible(false);//from   w ww. jav a 2 s  . c o m
            openButton.setVisible(false);
            statusLabel.setVisible(true);
            statusLabel.setText(DefaultI18nContext.getInstance().i18n("Requested"));
            bar.setProgress(0);
        }
    });
    eventStudio().addAnnotatedListeners(this);
}

From source file:org.pdfsam.ui.module.ProgressPane.java

public ProgressPane() {
    this.getStyleClass().add("progress-pane");
    this.statusLabel.getStyleClass().add("progress-status");
    this.failed.setVisible(false);
    this.open.setVisible(false);
    this.bar.getStyleClass().add("pdfsam-footer-bar");
    StackPane buttons = new StackPane(failed, open);
    HBox progressStatusBox = new HBox(statusLabel, buttons);
    progressStatusBox.getStyleClass().add("progress-status-pane");
    HBox.setHgrow(statusLabel, Priority.ALWAYS);
    statusLabel.setMaxWidth(Double.MAX_VALUE);
    getChildren().addAll(progressStatusBox, bar);
    eventStudio().addAnnotatedListeners(this);
}

From source file:org.pdfsam.ui.news.News.java

News(NewsData data) {
    this.getStyleClass().add("news-box");
    TextFlow flow = new TextFlow();
    if (data.isImportant()) {
        Text megaphone = GlyphsDude.createIcon(FontAwesomeIcon.BULLHORN, "1.2em");
        megaphone.getStyleClass().clear();
        megaphone.getStyleClass().add("news-box-title-important");
        flow.getChildren().addAll(megaphone, new Text(" "));
    }// w  w w .  j  a v a2s .com

    Text titleText = new Text(data.getTitle() + System.lineSeparator());
    titleText.setOnMouseClicked(e -> eventStudio().broadcast(new OpenUrlRequest(data.getLink())));
    titleText.getStyleClass().add("news-box-title");

    Text contentText = new Text(data.getContent());
    contentText.setTextAlignment(TextAlignment.JUSTIFY);
    contentText.getStyleClass().add("news-content");

    flow.getChildren().addAll(titleText, contentText);
    flow.setTextAlignment(TextAlignment.JUSTIFY);
    Label labelDate = new Label(FORMATTER.format(data.getDate()),
            GlyphsDude.createIcon(MaterialDesignIcon.CLOCK));
    labelDate.setPrefWidth(Integer.MAX_VALUE);
    HBox.setHgrow(labelDate, Priority.ALWAYS);
    HBox bottom = new HBox(labelDate);
    bottom.setAlignment(Pos.CENTER_LEFT);
    bottom.getStyleClass().add("news-box-footer");
    if (isNotBlank(data.getLink())) {
        Button link = UrlButton.urlButton(null, data.getLink(), FontAwesomeIcon.EXTERNAL_LINK_SQUARE,
                "pdfsam-toolbar-button");
        bottom.getChildren().add(link);
    }
    getChildren().addAll(flow, bottom);
}

From source file:net.noctuasource.noctua.core.ui.ExceptionDialog.java

protected ExceptionDialog(Exception exception) {
    this.exception = exception;

    VBox root = new VBox();

    stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setTitle("Exception");
    Scene scene = new Scene(root);
    scene.getStylesheets().add(getClass().getResource(CSS_FILE).toExternalForm());
    stage.setScene(scene);//from w w w  .  j  a  v  a2s.  co m

    FXMLLoader loader = new FXMLLoader();
    loader.setClassLoader(getClass().getClassLoader());
    loader.setController(this);
    loader.setLocation(getClass().getResource(FXML_FILE));

    try {
        Node node = (Node) loader.load();
        root.getChildren().add(node);
        VBox.setVgrow(node, Priority.ALWAYS);
    } catch (IOException e) {
        logger.error("Error while creating view: ", e);
        stage.close();
        return;
    }

    messageField.setText(exception.getLocalizedMessage());
    fullExceptionField.setText(ExceptionUtils.getFullStackTrace(exception));

    //stage.sizeToScene();
    stage.centerOnScreen();
    stage.show();
}

From source file:org.blockedit.utils.ExceptionDialog.java

/**
 * Create a exception alert that is displayed to the user.
 *
 * @param message The message to show the user
 * @param title The title of the window/*  w  w  w  . j a  v  a  2  s . c o m*/
 * @param header The message header
 * @param exception The exception that triggered this window to be displayed to the user
 * @return A created alert
 */
private static Alert createDialog(String message, String title, String header, Exception exception) {
    Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.setTitle(title);
    alert.setHeaderText(header);
    alert.setContentText(message);
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    String exceptionText = ExceptionUtils.getStackTrace(exception);
    exception.printStackTrace();
    Label label = new Label("The exception stacktrace was:");
    TextArea exceptionArea = new TextArea(
            exceptionText + "\n\n==User Information==\njava.version = " + System.getProperty("java.version")
                    + "\nos.name = " + System.getProperty("os.name") + "\nos.arch = "
                    + System.getProperty("os.arch") + "\nos.version = " + System.getProperty("os.version"));
    exceptionArea.setEditable(false);
    exceptionArea.setWrapText(true);
    exceptionArea.setMaxWidth(UserInformation.getWindowWidth() / 2);
    exceptionArea.setMaxHeight(UserInformation.getWindowHeight() / 2);
    GridPane.setVgrow(exceptionArea, Priority.ALWAYS);
    GridPane.setHgrow(exceptionArea, Priority.ALWAYS);
    GridPane expContent = new GridPane();
    expContent.setMaxWidth(UserInformation.getWindowWidth() / 2);
    expContent.add(label, 0, 0);
    expContent.add(exceptionArea, 0, 1);
    alert.getDialogPane().setExpandableContent(expContent);
    return alert;
}