Example usage for javafx.geometry Pos CENTER_LEFT

List of usage examples for javafx.geometry Pos CENTER_LEFT

Introduction

In this page you can find the example usage for javafx.geometry Pos CENTER_LEFT.

Prototype

Pos CENTER_LEFT

To view the source code for javafx.geometry Pos CENTER_LEFT.

Click Source Link

Document

Represents positioning on the center vertically and on the left horizontally.

Usage

From source file:org.pdfsam.ui.selection.single.SingleSelectionPane.java

public SingleSelectionPane(String ownerModule) {
    super(5);//from  w  ww.  j  a v a 2 s  . c  om
    this.ownerModule = defaultString(ownerModule);
    field.enforceValidation(true, false);
    field.getTextField().setPromptText(
            DefaultI18nContext.getInstance().i18n("Select or drag and drop the PDF you want to split"));
    encryptionIndicator = new LoadingStatusIndicator(this, this.ownerModule);
    field.setGraphic(encryptionIndicator);
    HBox.setMargin(encryptionIndicator, new Insets(0, 0, 0, 2));
    HBox topRow = new HBox(5, field);
    HBox.setHgrow(field, Priority.ALWAYS);
    topRow.setAlignment(Pos.CENTER_LEFT);
    getChildren().addAll(topRow, pages);
    field.getTextField().setEditable(false);
    field.getTextField().validProperty().addListener((o, oldVal, newVal) -> {
        if (newVal == ValidationState.VALID) {
            if (descriptor != null) {
                descriptor.invalidate();
            }
            PdfLoadRequestEvent loadEvent = new PdfLoadRequestEvent(getOwnerModule());
            descriptor = PdfDocumentDescriptor
                    .newDescriptorNoPassword(new File(field.getTextField().getText()));
            descriptor.loadedProperty().addListener(new WeakChangeListener<>(onDescriptorLoaded));
            field.getTextField().getContextMenu().getItems().forEach(i -> i.setDisable(false));
            loadEvent.add(descriptor);
            eventStudio().broadcast(loadEvent);
        }
    });
    initContextMenu();
}

From source file:fr.amap.commons.javafx.chart.ChartViewer.java

public void insertChart(JFreeChart chart) {

    final ChartCanvas chartCanvas = new ChartCanvas(chart);

    if ((chartCanvasList.size() / (vBoxPane.getChildren().size())) >= maxChartNumberInARow) {
        currentRowIndex++;/*from   ww w  . j  a  va  2s.com*/
        vBoxPane.getChildren().add(new HBox());
    }

    ((HBox) vBoxPane.getChildren().get(currentRowIndex)).getChildren().add(chartCanvas);
    ((HBox) vBoxPane.getChildren().get(currentRowIndex)).setAlignment(Pos.CENTER_LEFT);

    chartCanvasList.add(chartCanvas);

    refreshChartPositionAndSize();

}

From source file:gov.va.isaac.gui.util.ErrorMarkerUtils.java

/**
 * Setup an 'INFORMATION' info marker on the component. Automatically displays anytime that the initialControl is disabled.
 * Put the initial control in the provided stack pane
 *///from   www  . j a  va  2  s .  c  o  m
public static Node setupDisabledInfoMarker(Control initialControl, StackPane stackPane,
        ObservableStringValue reasonWhyControlDisabled) {
    ImageView information = Images.INFORMATION.createImageView();

    information.visibleProperty().bind(initialControl.disabledProperty());
    Tooltip tooltip = new Tooltip();
    tooltip.textProperty().bind(reasonWhyControlDisabled);
    Tooltip.install(information, tooltip);
    tooltip.setAutoHide(true);

    information.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            tooltip.show(information, event.getScreenX(), event.getScreenY());

        }

    });

    stackPane.setMaxWidth(Double.MAX_VALUE);
    stackPane.getChildren().add(initialControl);
    StackPane.setAlignment(initialControl, Pos.CENTER_LEFT);
    stackPane.getChildren().add(information);
    if (initialControl instanceof Button) {
        StackPane.setAlignment(information, Pos.CENTER);
    } else if (initialControl instanceof CheckBox) {
        StackPane.setAlignment(information, Pos.CENTER_LEFT);
        StackPane.setMargin(information, new Insets(0, 0, 0, 1));
    } else {
        StackPane.setAlignment(information, Pos.CENTER_RIGHT);
        double insetFromRight = (initialControl instanceof ComboBox ? 30.0 : 5.0);
        StackPane.setMargin(information, new Insets(0.0, insetFromRight, 0.0, 0.0));
    }
    return stackPane;
}

From source file:com.github.drbookings.ui.controller.BookingDetailsController.java

private static void addRow4(final Pane content, final BookingBean be) {
    final HBox box = new HBox();
    box.setPadding(new Insets(4));
    box.setAlignment(Pos.CENTER_LEFT);
    box.setFillHeight(true);/*w  ww. ja  va 2s  .  c  om*/
    final TextFlow tf = new TextFlow();
    final Text t0 = new Text("Net Earnings: \t");
    final Text netEarnings = new Text(String.format("%3.2f", be.getNetEarnings()));
    final Text t1 = new Text(" total \t");
    final Text netEarningsDay = new Text(String.format("%3.2f", be.getNetEarnings() / be.getNumberOfNights()));
    final Text t2 = new Text(" /night");
    tf.getChildren().addAll(t0, netEarnings, t1, netEarningsDay, t2);
    box.getChildren().addAll(tf);
    if (be.getNetEarnings() <= 0) {
        box.getStyleClass().addAll("warning", "warning-bg");
    }
    content.getChildren().add(box);

}

From source file:dpfmanager.shell.interfaces.gui.fragment.wizard.Wizard1Fragment.java

private void addCheckBox(String id, String name, String path, boolean selected, boolean delete) {
    HBox hbox = new HBox();
    hbox.setAlignment(Pos.CENTER_LEFT);

    CheckBox chk = new CheckBox(name);
    chk.setId(id);/*from w  ww .  ja v  a 2  s  .  com*/
    chk.getStyleClass().add("checkreport");
    chk.setSelected(selected);
    chk.setEllipsisString(" ... ");
    chk.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);
    chk.setTooltip(new Tooltip(path));
    hbox.getChildren().add(chk);

    // EDIT
    Button edit = new Button();
    edit.getStyleClass().addAll("edit-img", "action-img-16");
    edit.setCursor(Cursor.HAND);
    edit.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            String iso = chk.getId();
            String path = null;
            if (iso.startsWith("external")) {
                iso = chk.getText();
                path = iso;
            } else if (chk.getId().startsWith("config")) {
                iso = chk.getId().replace("config", "");
                path = DPFManagerProperties.getIsosDir() + "/" + iso;
            }
            controller.editIso(iso, path);
        }
    });
    hbox.getChildren().add(edit);
    HBox.setMargin(edit, new Insets(0, 0, 0, 10));

    // DELETE
    if (delete) {
        Button icon = new Button();
        icon.getStyleClass().addAll("delete-img", "action-img-16");
        icon.setCursor(Cursor.HAND);
        icon.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                if (chk.getId().startsWith("external")) {
                    // Only from gui
                    vboxRadios.getChildren().remove(hbox);
                } else if (chk.getId().startsWith("config")) {
                    // From system
                    String name = chk.getId().replace("config", "");
                    File file = new File(DPFManagerProperties.getIsosDir() + "/" + name);
                    if (file.exists() && file.isFile() && acceptDelete(file)) {
                        file.delete();
                        vboxRadios.getChildren().remove(hbox);
                    }
                }
            }
        });
        hbox.getChildren().add(icon);
        HBox.setMargin(icon, new Insets(0, 0, 0, 10));
    }

    vboxRadios.getChildren().add(hbox);
}

From source file:org.sleuthkit.autopsy.timeline.ui.detailview.AggregateEventNode.java

public AggregateEventNode(final AggregateEvent event, AggregateEventNode parentEventNode,
        EventDetailChart chart) {//  www  .  j  ava  2  s . c  om
    this.event = event;
    descLOD.set(event.getLOD());
    this.parentEventNode = parentEventNode;
    this.chart = chart;
    final Region region = new Region();
    HBox.setHgrow(region, Priority.ALWAYS);
    final HBox hBox = new HBox(descrLabel, countLabel, region, minusButton, plusButton);
    hBox.setPrefWidth(USE_COMPUTED_SIZE);
    hBox.setMinWidth(USE_PREF_SIZE);
    hBox.setPadding(new Insets(2, 5, 2, 5));
    hBox.setAlignment(Pos.CENTER_LEFT);

    minusButton.setVisible(false);
    plusButton.setVisible(false);
    minusButton.setManaged(false);
    plusButton.setManaged(false);
    final BorderPane borderPane = new BorderPane(subNodePane, hBox, null, null, null);
    BorderPane.setAlignment(subNodePane, Pos.TOP_LEFT);
    borderPane.setPrefWidth(USE_COMPUTED_SIZE);

    getChildren().addAll(spanRegion, borderPane);

    setAlignment(Pos.TOP_LEFT);
    setMinHeight(24);
    minWidthProperty().bind(spanRegion.widthProperty());
    setPrefHeight(USE_COMPUTED_SIZE);
    setMaxHeight(USE_PREF_SIZE);

    //set up subnode pane sizing contraints
    subNodePane.setPrefHeight(USE_COMPUTED_SIZE);
    subNodePane.setMinHeight(USE_PREF_SIZE);
    subNodePane.setMinWidth(USE_PREF_SIZE);
    subNodePane.setMaxHeight(USE_PREF_SIZE);
    subNodePane.setMaxWidth(USE_PREF_SIZE);
    subNodePane.setPickOnBounds(false);

    //setup description label
    eventTypeImageView.setImage(event.getType().getFXImage());
    descrLabel.setGraphic(eventTypeImageView);
    descrLabel.setPrefWidth(USE_COMPUTED_SIZE);
    descrLabel.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);

    descrLabel.setMouseTransparent(true);
    setDescriptionVisibility(chart.getDescrVisibility().get());

    //setup backgrounds
    final Color evtColor = event.getType().getColor();
    spanFill = new Background(
            new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY));
    setBackground(
            new Background(new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY)));
    setCursor(Cursor.HAND);
    spanRegion.setStyle("-fx-border-width:2 0 2 2; -fx-border-radius: 2; -fx-border-color: "
            + ColorUtilities.getRGBCode(evtColor) + ";"); // NON-NLS
    spanRegion.setBackground(spanFill);

    //set up mouse hover effect and tooltip
    setOnMouseEntered((MouseEvent e) -> {
        //defer tooltip creation till needed, this had a surprisingly large impact on speed of loading the chart
        installTooltip();
        spanRegion.setEffect(new DropShadow(10, evtColor));
        minusButton.setVisible(true);
        plusButton.setVisible(true);
        minusButton.setManaged(true);
        plusButton.setManaged(true);
        toFront();

    });

    setOnMouseExited((MouseEvent e) -> {
        spanRegion.setEffect(null);
        minusButton.setVisible(false);
        plusButton.setVisible(false);
        minusButton.setManaged(false);
        plusButton.setManaged(false);

    });

    setOnMouseClicked(new EventMouseHandler());

    plusButton.disableProperty().bind(descLOD.isEqualTo(DescriptionLOD.FULL));
    minusButton.disableProperty().bind(descLOD.isEqualTo(event.getLOD()));

    plusButton.setOnMouseClicked(e -> {
        final DescriptionLOD next = descLOD.get().next();
        if (next != null) {
            loadSubClusters(next);
            descLOD.set(next);
        }
    });
    minusButton.setOnMouseClicked(e -> {
        final DescriptionLOD previous = descLOD.get().previous();
        if (previous != null) {
            loadSubClusters(previous);
            descLOD.set(previous);
        }
    });
}

From source file:Main.java

private static Node createConfirmationPanel() {
    final Label acceptanceLabel = new Label("Not Available");

    final Button acceptButton = new Button("Accept");
    acceptButton.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(final ActionEvent event) {
            acceptanceLabel.setText("Accepted");
        }//from   ww  w  .  jav  a  2 s.com
    });

    final Button declineButton = new Button("Decline");
    declineButton.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(final ActionEvent event) {
            acceptanceLabel.setText("Declined");
        }
    });

    final HBox panel = createHBox(6, acceptButton, declineButton, acceptanceLabel);
    panel.setAlignment(Pos.CENTER_LEFT);
    configureBorder(panel);

    return panel;
}

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);//from   ww w  . jav a  2 s  . co  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:com.github.drbookings.ui.controller.BookingDetailsController.java

private void addRowNetEarnings(final Pane content, final BookingBean be) {
    final HBox box = new HBox();
    box.setSpacing(boxSpacing);//from   ww w . j a  va  2s.  c  o m
    box.setPadding(boxPadding);
    box.setAlignment(Pos.CENTER_LEFT);
    box.setFillHeight(true);
    final TextField grossEarningsExpression = new TextField(be.getGrossEarningsExpression());
    grossEarningsExpression.setPrefWidth(prefTextInputFieldWidth * 1.5);
    booking2GrossEarnings.put(be, grossEarningsExpression);
    final Text grossEarnings = new Text(decimalFormat.format(be.getGrossEarnings()));
    final TextFlow tf = new TextFlow(new Text("Gross Earnings: "), grossEarningsExpression, new Text(" = "),
            grossEarnings, new Text(""));
    box.getChildren().addAll(tf);
    if (be.getGrossEarnings() <= 0) {
        box.getStyleClass().addAll("warning", "warning-bg");
    }

    final HBox box2 = new HBox();
    box2.setSpacing(boxSpacing);
    box2.setPadding(boxPadding);
    box2.setAlignment(Pos.CENTER_LEFT);
    box2.setFillHeight(true);

    Text text = new Text("Amount received: ");
    TextField textField = new TextField();
    textField.setText(new NumberStringConverter().toString(be.getPaymentSoFar()));
    textField.setEditable(false);
    be.paymentSoFarProperty().addListener((c, o, n) -> {
        textField.setText(new NumberStringConverter().toString(n));
    });
    box2.getChildren().addAll(text, textField);
    content.getChildren().addAll(box, box2);

}

From source file:com.panemu.tiwulfx.control.skin.LookupFieldSkin.java

private void initialize() {
    textField = new TextField();
    textField.setFocusTraversable(true);
    textField.setEditable(!lookupField.getDisableManualInput());
    textField.focusedProperty().addListener(new ChangeListener<Boolean>() {
        @Override/*from   w  w  w . j  av a  2 s .c o m*/
        public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean hasFocus) {
            textField.selectEnd();
        }
    });

    button = new Button();
    button.setFocusTraversable(false);
    button.setGraphic(TiwulFXUtil.getGraphicFactory().createLookupGraphic());
    StackPane.setAlignment(textField, Pos.CENTER_LEFT);
    StackPane.setAlignment(button, Pos.CENTER_RIGHT);
    this.getChildren().addAll(textField, button);
    button.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent t) {
            if (!lookupField.isFocused()) {
                /**
                 * Need to make this control become focused. Otherwise
                 * changing value in LookupColumn while the LookuField cell
                 * editor
                 * is not focused before, won't trigger commitEdit()
                 */
                lookupField.requestFocus();
            }
            getSkinnable().showLookupDialog();
        }
    });
    updateTextField();
    lookupField.valueProperty().addListener(new ChangeListener() {
        @Override
        public void changed(ObservableValue ov, Object t, Object t1) {
            updateTextField();
        }
    });

    lookupField.markInvalidProperty().addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            if (oldValue && !newValue && needValidation) {
                validate();
            }
        }
    });

    textField.textProperty().addListener(new InvalidationListener() {
        @Override
        public void invalidated(Observable o) {
            if (detectTextChanged) {
                if (waitTimer != null) {
                    loaderTimerTask.setObsolete(true);
                    waitTimer.cancel();
                    waitTimer.purge();
                }

                if (textField.getText() == null || textField.getText().trim().isEmpty()) {
                    lookupField.setValue(null);
                    return;
                }
                lookupField.markInvalidProperty().set(true);
                needValidation = true;

                if (lookupField.getShowSuggestionWaitTime() >= 0) {
                    waitTimer = new Timer("lookupTimer");
                    loaderTimerTask = new LoaderTimerTask(waitTimer);
                    waitTimer.schedule(loaderTimerTask, lookupField.getShowSuggestionWaitTime());
                }
            }
        }
    });

}