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:se.trixon.filebydate.ui.ProfilePanel.java

private void createUI() {
    //setGridLinesVisible(true);

    Label nameLabel = new Label(Dict.NAME.toString());
    Label descLabel = new Label(Dict.DESCRIPTION.toString());
    Label filePatternLabel = new Label(Dict.FILE_PATTERN.toString());
    Label dateSourceLabel = new Label(Dict.DATE_SOURCE.toString());
    mDatePatternLabel = new Label(Dict.DATE_PATTERN.toString());
    Label operationLabel = new Label(Dict.OPERATION.toString());
    Label caseBaseLabel = new Label(Dict.BASENAME.toString());
    Label caseExtLabel = new Label(Dict.EXTENSION.toString());

    mLinksCheckBox = new CheckBox(Dict.FOLLOW_LINKS.toString());
    mRecursiveCheckBox = new CheckBox(Dict.RECURSIVE.toString());
    mReplaceCheckBox = new CheckBox(Dict.REPLACE.toString());

    mCaseBaseComboBox = new ComboBox<>();
    mDatePatternComboBox = new ComboBox<>();
    mDateSourceComboBox = new ComboBox<>();
    mFilePatternComboBox = new ComboBox<>();
    mOperationComboBox = new ComboBox<>();
    mCaseExtComboBox = new ComboBox<>();

    mNameTextField = new TextField();
    mDescTextField = new TextField();

    mSourceChooserPane = new FileChooserPane(Dict.OPEN.toString(), Dict.SOURCE.toString(), ObjectMode.DIRECTORY,
            SelectionMode.SINGLE);/*from  w w w  . j a v  a 2s  . com*/
    mDestChooserPane = new FileChooserPane(Dict.OPEN.toString(), Dict.DESTINATION.toString(),
            ObjectMode.DIRECTORY, SelectionMode.SINGLE);

    mFilePatternComboBox.setEditable(true);
    mDatePatternComboBox.setEditable(true);
    //mDatePatternLabel.setPrefWidth(300);

    int col = 0;
    int row = 0;

    add(nameLabel, col, row, REMAINING, 1);
    add(mNameTextField, col, ++row, REMAINING, 1);
    add(descLabel, col, ++row, REMAINING, 1);
    add(mDescTextField, col, ++row, REMAINING, 1);
    add(mSourceChooserPane, col, ++row, REMAINING, 1);
    add(mDestChooserPane, col, ++row, REMAINING, 1);

    GridPane patternPane = new GridPane();
    patternPane.addRow(0, filePatternLabel, dateSourceLabel, mDatePatternLabel);
    patternPane.addRow(1, mFilePatternComboBox, mDateSourceComboBox, mDatePatternComboBox);
    patternPane.setHgap(8);
    addRow(++row, patternPane);

    GridPane.setHgrow(mFilePatternComboBox, Priority.ALWAYS);
    GridPane.setHgrow(mDateSourceComboBox, Priority.ALWAYS);
    GridPane.setHgrow(mDatePatternComboBox, Priority.ALWAYS);

    GridPane.setFillWidth(mFilePatternComboBox, true);
    GridPane.setFillWidth(mDateSourceComboBox, true);
    GridPane.setFillWidth(mDatePatternComboBox, true);

    double width = 100.0 / 3.0;
    ColumnConstraints col1 = new ColumnConstraints();
    col1.setPercentWidth(width);
    ColumnConstraints col2 = new ColumnConstraints();
    col2.setPercentWidth(width);
    ColumnConstraints col3 = new ColumnConstraints();
    col3.setPercentWidth(width);
    patternPane.getColumnConstraints().addAll(col1, col2, col3);

    mFilePatternComboBox.setMaxWidth(Double.MAX_VALUE);
    mDateSourceComboBox.setMaxWidth(Double.MAX_VALUE);
    mDatePatternComboBox.setMaxWidth(Double.MAX_VALUE);
    GridPane subPane = new GridPane();
    //subPane.setGridLinesVisible(true);
    subPane.addRow(0, operationLabel, new Label(), new Label(), new Label(), caseBaseLabel, caseExtLabel);
    subPane.addRow(1, mOperationComboBox, mLinksCheckBox, mRecursiveCheckBox, mReplaceCheckBox,
            mCaseBaseComboBox, mCaseExtComboBox);
    subPane.setHgap(8);
    add(subPane, col, ++row, REMAINING, 1);

    final Insets rowInsets = new Insets(0, 0, 8, 0);

    GridPane.setMargin(mNameTextField, rowInsets);
    GridPane.setMargin(mDescTextField, rowInsets);
    GridPane.setMargin(mSourceChooserPane, rowInsets);
    GridPane.setMargin(mDestChooserPane, rowInsets);
    GridPane.setMargin(patternPane, rowInsets);

    mFilePatternComboBox.setItems(FXCollections.observableArrayList("*", "{*.jpg,*.JPG}", "{*.mp4,*.MP4}"));

    mDatePatternComboBox.setItems(FXCollections.observableArrayList("yyyy/MM/yyyy-MM-dd",
            "yyyy/MM/yyyy-MM-dd/HH", "yyyy/MM/dd", "yyyy/ww", "yyyy/ww/u"));

    mCaseBaseComboBox.setItems(FXCollections.observableArrayList(Arrays.asList(NameCase.values())));
    mCaseExtComboBox.setItems(FXCollections.observableArrayList(Arrays.asList(NameCase.values())));
    mDateSourceComboBox.setItems(FXCollections.observableArrayList(Arrays.asList(DateSource.values())));
    mOperationComboBox.setItems(FXCollections.observableArrayList(Arrays.asList(Command.COPY, Command.MOVE)));
}

From source file:org.jacp.demo.perspectives.ContactPerspective.java

private void createPerspectiveLayout(final PerspectiveLayout perspectiveLayout) {

    // bind width and height to ensure that the gridpane is always on
    // fullspan!/*from   w ww.  j a  va2  s .  c om*/
    chartView.minWidthProperty().bind(chartAnchor.widthProperty());
    chartView.minHeightProperty().bind(chartAnchor.heightProperty());

    detailView.minWidthProperty().bind(detailAnchor.widthProperty());
    detailView.minHeightProperty().bind(detailAnchor.heightProperty());

    GridPane.setVgrow(perspectiveLayout.getRootComponent(), Priority.ALWAYS);
    GridPane.setHgrow(perspectiveLayout.getRootComponent(), Priority.ALWAYS);
    perspectiveLayout.registerTargetLayoutComponent("PleftMenu", gridPane1);
    // register main content Top
    perspectiveLayout.registerTargetLayoutComponent(this.topId, gridPane2);
    // register main content Bottom
    perspectiveLayout.registerTargetLayoutComponent(this.bottomId, chartView);
    perspectiveLayout.registerTargetLayoutComponent(this.detailId, detailView);
}

From source file:org.specvis.view.screenandlumscale.ViewFitLumScaleController.java

private void initLineChart() {

    // 1. Define axes.
    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();
    xAxis.setLabel("HSB Brightness (%)");
    yAxis.setLabel("Luminance (cd/m2)");

    // 2. Init lineChart.
    lineChart = new LineChart<>(xAxis, yAxis);
    lineChart.setTitle("Screen luminance scale");

    // 3. Define chart series.
    XYChart.Series seriesFittedLuminance = new XYChart.Series();
    seriesFittedLuminance.setName("Fitted luminance");

    XYChart.Series seriesMeasuredLuminance = new XYChart.Series();
    seriesMeasuredLuminance.setName("Measured luminance");

    // 4. Get luminance scale.
    LuminanceScale luminanceScale;/*from  ww  w  . ja v a  2s .  c  o  m*/
    if (StartApplication.getSpecvisData().getUiSettingsScreenAndLuminanceScale()
            .isThisWindowOpenedForStimulus()) {
        luminanceScale = StartApplication.getSpecvisData().getUiSettingsScreenAndLuminanceScale()
                .getStimulusLuminanceScale();
    } else {
        luminanceScale = StartApplication.getSpecvisData().getUiSettingsScreenAndLuminanceScale()
                .getBackgroundLuminanceScale();
    }

    // 5. Create short brightness vector.
    double[] shortBrightnessVector = new double[] { 0, 20, 40, 60, 80, 100 };

    // 6. Get measured luminance values.
    double[] measuredLuminances = new double[] { luminanceScale.getLuminanceForBrightness0(),
            luminanceScale.getLuminanceForBrightness20(), luminanceScale.getLuminanceForBrightness40(),
            luminanceScale.getLuminanceForBrightness60(), luminanceScale.getLuminanceForBrightness80(),
            luminanceScale.getLuminanceForBrightness100() };

    // 7. Create full brightness vector.
    double[] fullBrightnessVector = functions.createBrightnessVector(101);

    // 8. Nest data in series.
    for (int i = 0; i < fullBrightnessVector.length; i++) {
        seriesFittedLuminance.getData().add(new XYChart.Data(fullBrightnessVector[i],
                luminanceScale.getFittedLuminanceForEachBrightnessValue()[i]));
    }

    for (int i = 0; i < shortBrightnessVector.length; i++) {
        seriesMeasuredLuminance.getData()
                .add(new XYChart.Data(shortBrightnessVector[i], measuredLuminances[i]));
    }

    // 9. Add series to lineChart.
    lineChart.getData().addAll(seriesFittedLuminance, seriesMeasuredLuminance);
    vBox.getChildren().remove(vBox.getChildren().size() - 1);
    vBox.getChildren().add(lineChart);
    VBox.setVgrow(lineChart, Priority.ALWAYS);
}

From source file:de.pixida.logtest.designer.logreader.LogReaderEditor.java

public VBox createRunForm() {
    // CHECKSTYLE:OFF Yes, we are using lots of constants here. It does not make sense to name them using final variables.
    final VBox lines = new VBox();
    lines.setSpacing(10d);/*  ww w. j ava2s .  c  o  m*/
    final HBox inputTypeLine = new HBox();
    inputTypeLine.setSpacing(30d);
    final ToggleGroup group = new ToggleGroup();
    final RadioButton inputTypeText = new RadioButton("Paste/Enter text");
    inputTypeText.setToggleGroup(group);
    final RadioButton inputTypeFile = new RadioButton("Read log file");
    inputTypeFile.setToggleGroup(group);
    inputTypeLine.getChildren().add(inputTypeText);
    inputTypeLine.getChildren().add(inputTypeFile);
    inputTypeText.setSelected(true);
    final TextField pathInput = new TextField();
    HBox.setHgrow(pathInput, Priority.ALWAYS);
    final Button selectLogFileButton = SelectFileButton.createButtonWithFileSelection(pathInput,
            LOG_FILE_ICON_NAME, "Select log file", null, null);
    final Text pathInputLabel = new Text("Log file path: ");
    final HBox fileInputConfig = new HBox();
    fileInputConfig.setAlignment(Pos.CENTER_LEFT);
    fileInputConfig.visibleProperty().bind(inputTypeFile.selectedProperty());
    fileInputConfig.managedProperty().bind(fileInputConfig.visibleProperty());
    fileInputConfig.getChildren().addAll(pathInputLabel, pathInput, selectLogFileButton);
    final TextArea logInputText = new TextArea();
    HBox.setHgrow(logInputText, Priority.ALWAYS);
    logInputText.setPrefRowCount(10);
    logInputText.setStyle("-fx-font-family: monospace");
    final HBox enterTextConfig = new HBox();
    enterTextConfig.getChildren().add(logInputText);
    enterTextConfig.visibleProperty().bind(inputTypeText.selectedProperty());
    enterTextConfig.managedProperty().bind(enterTextConfig.visibleProperty());
    final Button startBtn = new Button("Read Log");
    startBtn.setPadding(new Insets(8d));
    // CHECKSTYLE:ON
    startBtn.setGraphic(Icons.getIconGraphics("control_play_blue"));
    HBox.setHgrow(startBtn, Priority.ALWAYS);
    startBtn.setMaxWidth(Double.MAX_VALUE);
    startBtn.setOnAction(event -> this.runLogFileReader(inputTypeFile, pathInput, logInputText));
    final HBox startLine = new HBox();
    startLine.getChildren().add(startBtn);
    lines.getChildren().addAll(inputTypeLine, fileInputConfig, enterTextConfig, startLine, new Text("Results:"),
            this.parsedLogEntries);
    return lines;
}

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

@Override
public void init(ObservableList<SimpleDisplayConcept> conceptList) {
    root.setHgap(10);// w  w  w .j  a  v a 2  s.  c o m
    root.setVgap(10);

    super.init(conceptList);

    String date = new SimpleDateFormat("MM-dd-yyyy HH-mm-ss").format(new Date());
    fileName = "VA_USCRS_Submission_File_" + date;

    //this.chooseFileName(); TODO: Finish the file name system
    fileChooser.setTitle("Save USCRS Concept Request File");
    fileChooser.getExtensionFilters().addAll(new ExtensionFilter("Excel Files .xls .xlsx", "*.xls", "*.xlsx"));
    fileChooser.setInitialFileName(fileName);
    //      outputProperty.set(outputField.textProperty());

    openFileChooser.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(final ActionEvent e) {
            file = fileChooser.showSaveDialog(null);
            if (file != null) {
                if (file.getAbsolutePath() != null && file.getAbsolutePath() != "") {
                    outputField.setText(file.getAbsolutePath());
                    filePath = file.getAbsolutePath();
                    logger_.info("File Path Changed: " + filePath);
                }
            }
        }
    });
    outputField.setOnAction( //TODO: So you can manually type in a file path and it validates (break this out)
            new EventHandler<ActionEvent>() {
                @Override
                public void handle(final ActionEvent e) {
                    filePath = outputField.getText();
                    file = new File(filePath);
                }
            });

    allFieldsValid = new ValidBooleanBinding() {
        {
            bind(outputField.textProperty());
            setComputeOnInvalidate(true);
        }

        /* (non-Javadoc)
         * @see javafx.beans.binding.BooleanBinding#computeValue()
         */
        @Override
        protected boolean computeValue() {
            if (outputField.getText() != "" || !outputField.getText().trim().isEmpty()) {
                String fieldOutput = outputField.getText();
                if (filePath != null && !fieldOutput.isEmpty() && file != null) //fieldOutput is repetetive but necessary
                {
                    int lastSeperatorPosition = outputField.getText().lastIndexOf(File.separator);
                    String path = "";
                    if (lastSeperatorPosition > 0) {
                        path = outputField.getText().substring(0, lastSeperatorPosition);
                    } else {
                        path = outputField.getText();
                    }

                    logger_.debug("Output Directory: " + path);
                    File f = new File(path);
                    if (file.isFile()) { //If we want to prevent file overwrite
                        this.setInvalidReason("The file " + filePath + " already exists");
                        return false;
                    } else if (f.isDirectory()) {
                        return true;
                    } else {
                        this.setInvalidReason("Output Path is not a directory");
                        return false;
                    }
                } else {
                    this.setInvalidReason("File Output Directory is not set - output field null!!");
                    return false;
                }
            } else {
                this.setInvalidReason("Output field is empty, output directory is not set");
                return false;
            }
        }
    };

    root.add(openFileChooser, 2, 0);
    GridPane.setHalignment(openFileChooser, HPos.LEFT);

    Label outputLocationLabel = new Label("Output Location");
    root.add(outputLocationLabel, 0, 0);

    GridPane.setHalignment(outputLocationLabel, HPos.LEFT);

    StackPane sp = ErrorMarkerUtils.setupErrorMarker(outputField, null, allFieldsValid);
    root.add(sp, 1, 0);
    GridPane.setHgrow(sp, Priority.ALWAYS);
    GridPane.setHalignment(sp, HPos.LEFT);

    Label datePickerLabel = new Label("Export Date Filter");
    root.add(datePickerLabel, 0, 1);
    GridPane.setHalignment(datePickerLabel, HPos.LEFT);
    root.add(datePicker, 1, 1);

    Label allDatesLabel = new Label("Export All Concepts");
    root.add(allDatesLabel, 0, 2);
    skipFilterCheckbox.setText("Export All Concepts (No Filters)");
    skipFilterCheckbox.setSelected(false);
    root.add(skipFilterCheckbox, 1, 2);

    super.root_ = root;
}

From source file:pah9qdmoviereviews.MovieReviewsFXMLController.java

public void displayExceptionAlert(Exception ex) {
    Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.setTitle("Exception");
    alert.setHeaderText("An Exception Occurred!");
    alert.setContentText(//  w  ww . java2s . c  om
            "An exception occurred.  View the exception information below by clicking Show Details.");

    // Create expandable Exception.
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    ex.printStackTrace(pw);
    String exceptionText = sw.toString();

    Label label = new Label("The exception stacktrace was:");

    TextArea textArea = new TextArea(exceptionText);
    textArea.setEditable(false);
    textArea.setWrapText(true);

    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(textArea, Priority.ALWAYS);
    GridPane.setHgrow(textArea, Priority.ALWAYS);

    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);

    // Set expandable Exception into the dialog pane.
    alert.getDialogPane().setExpandableContent(expContent);

    alert.showAndWait();
}

From source file:Main.java

Parent getContent() {
    StackPane stack = StackPaneBuilder.create().children(new Label("Thanks!")).build();
    VBox.setVgrow(stack, Priority.ALWAYS);
    return stack;
}

From source file:dpfmanager.shell.interfaces.gui.component.dessign.DessignView.java

private void addTreeView() {
    // Root node (my computer)
    CheckBoxTreeItem<String> rootNode = new CheckBoxTreeItem<>(getHostName(),
            new ImageView(new Image("images/computer.png")));
    checkTreeView = new CheckTreeView<>(rootNode);
    rootNode.addEventHandler(TreeItem.<Object>branchExpandedEvent(), new ExpandEventHandler(checkTreeView));
    rootNode.addEventHandler(TreeItem.<Object>branchCollapsedEvent(), new CollapseEventHandler());

    // Root items
    Iterable<Path> rootDirectories = FileSystems.getDefault().getRootDirectories();
    for (Path name : rootDirectories) {
        if (Files.isDirectory(name)) {
            FilePathTreeItem treeNode = new FilePathTreeItem(name);
            rootNode.getChildren().add(treeNode);
        }/*from w  ww  .  j a v  a  2  s.c om*/
    }
    rootNode.setExpanded(true);

    // Add data and add to gui
    treeViewHBox.getChildren().clear();
    treeViewHBox.getChildren().add(checkTreeView);
    HBox.setHgrow(checkTreeView, Priority.ALWAYS);
}

From source file:AudioPlayer3.java

@Override
protected Node initView() {
    final Button openButton = createOpenButton();
    controlPanel = createControlPanel();
    volumeSlider = createSlider("volumeSlider");
    statusLabel = createLabel("Buffering", "statusDisplay");
    positionSlider = createSlider("positionSlider");
    totalDurationLabel = createLabel("00:00", "mediaText");
    currentTimeLabel = createLabel("00:00", "mediaText");

    positionSlider.valueChangingProperty().addListener(new PositionListener());

    final ImageView volLow = new ImageView();
    volLow.setId("volumeLow");

    final ImageView volHigh = new ImageView();
    volHigh.setId("volumeHigh");

    final GridPane gp = new GridPane();
    gp.setHgap(1);//www. jav a2s  .co m
    gp.setVgap(1);
    gp.setPadding(new Insets(10));

    final ColumnConstraints buttonCol = new ColumnConstraints(100);
    final ColumnConstraints spacerCol = new ColumnConstraints(40, 80, 80);
    final ColumnConstraints middleCol = new ColumnConstraints();
    middleCol.setHgrow(Priority.ALWAYS);

    gp.getColumnConstraints().addAll(buttonCol, spacerCol, middleCol, spacerCol, buttonCol);

    GridPane.setValignment(openButton, VPos.BOTTOM);
    GridPane.setHalignment(volHigh, HPos.RIGHT);
    GridPane.setValignment(volumeSlider, VPos.TOP);
    GridPane.setHalignment(statusLabel, HPos.RIGHT);
    GridPane.setValignment(statusLabel, VPos.TOP);
    GridPane.setHalignment(currentTimeLabel, HPos.RIGHT);

    gp.add(openButton, 0, 0, 1, 3);
    gp.add(volLow, 1, 0);
    gp.add(volHigh, 1, 0);
    gp.add(volumeSlider, 1, 1);
    gp.add(controlPanel, 2, 0, 1, 2);
    gp.add(statusLabel, 3, 1);
    gp.add(currentTimeLabel, 1, 2);
    gp.add(positionSlider, 2, 2);
    gp.add(totalDurationLabel, 3, 2);

    return gp;
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXEnumTagAttrPane.java

public CFBamJavaFXEnumTagAttrPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamEnumTagObj argFocus) {//from   w  w w .j a va  2s.  c o m
    super();
    Control ctrl;
    CFLabel label;
    CFReferenceEditor reference;
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    setJavaFXFocusAsEnumTag(argFocus);
    setPadding(new Insets(5));
    setHgap(5);
    setVgap(5);
    setAlignment(Pos.CENTER);
    ColumnConstraints column1 = new ColumnConstraints(125);
    ColumnConstraints column2 = new ColumnConstraints(125, 300, 500);
    column2.setHgrow(Priority.ALWAYS);
    getColumnConstraints().addAll(column1, column2);
    int gridRow = 0;
    label = getJavaFXLabelLookupDefSchema();
    setHalignment(label, HPos.LEFT);
    add(label, 0, gridRow);

    reference = getJavaFXReferenceLookupDefSchema();
    setHalignment(reference, HPos.LEFT);
    add(reference, 1, gridRow);

    gridRow++;

    label = getJavaFXLabelId();
    setHalignment(label, HPos.LEFT);
    add(label, 0, gridRow);

    ctrl = getJavaFXEditorId();
    setHalignment(ctrl, HPos.LEFT);
    add(ctrl, 1, gridRow);

    gridRow++;

    label = getJavaFXLabelEnumCode();
    setHalignment(label, HPos.LEFT);
    add(label, 0, gridRow);

    ctrl = getJavaFXEditorEnumCode();
    setHalignment(ctrl, HPos.LEFT);
    add(ctrl, 1, gridRow);

    gridRow++;

    label = getJavaFXLabelName();
    setHalignment(label, HPos.LEFT);
    add(label, 0, gridRow);

    ctrl = getJavaFXEditorName();
    setHalignment(ctrl, HPos.LEFT);
    add(ctrl, 1, gridRow);

    gridRow++;

    populateFields();
    adjustComponentEnableStates();
    javafxIsInitializing = false;
}