Java Code Examples for javafx.scene.layout.HBox#setMargin()

The following examples show how to use javafx.scene.layout.HBox#setMargin() . 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: AlertCell.java    From DashboardFx with GNU General Public License v3.0 6 votes vote down vote up
private void config(){
    this.getStyleClass().add("alert-cell");
    this.setAlignment(Pos.CENTER_LEFT);
    this.setPrefHeight(40D);
    this.title.setStyle("-fx-font-size : 14;");
    this.text.getStyleClass().addAll("h6");
    this.text.setStyle("-fx-fill : -text-color;");
    this.time.setStyle("-fx-text-fill : -text-color; -fx-font-style : italic; ");
    textFlow.getChildren().addAll(text);
    this.content.getChildren().addAll(this.title, textFlow, this.time);
    this.content.setAlignment(Pos.CENTER_LEFT);
    this.getChildren().add(content);
    this.setAlignment(Pos.CENTER);
    HBox.setHgrow(content, Priority.ALWAYS);
    GridPane.setHalignment(this.time, HPos.RIGHT);
    GridPane.setValignment(this.time, VPos.CENTER);
    GridPane.setHgrow(this.time, Priority.ALWAYS);
    HBox.setMargin(this.content, new Insets(0,0,0,10));
}
 
Example 2
Source File: JsonTabController.java    From dev-tools with Apache License 2.0 6 votes vote down vote up
@Override
public void initialize(URL location, ResourceBundle resources) {
    jsonArea.setPrefHeight(1024);
    jsonArea.setWrapText(true);
    jsonArea.textProperty().addListener((obs, oldText, newText) -> {
        jsonArea.setStyleSpans(0, computeHighlighting(newText));
    });
    jsonMessage.setPadding(new Insets(5));
    jsonMessage.setTextFill(Color.RED);

    HBox.setMargin(clearSpacesButton, new Insets(0, 5, 10, 0));
    HBox.setMargin(formatButton, new Insets(0, 5, 10, 0));
    HBox.setMargin(clearButton, new Insets(0, 5, 10, 0));
    HBox.setMargin(jsonMessage, new Insets(0, 5, 10, 0));

    barSearch.setVisible(false);
    barSearch.setManaged(false);
}
 
Example 3
Source File: ExpandButton.java    From pdfsam with GNU Affero General Public License v3.0 6 votes vote down vote up
public ExpandButton() {
    getStyleClass().add("quickbar-expand-button");
    toggle.getStyleClass().addAll("pdfsam-toolbar-button", "quickbar-expand-toggle");
    expand.setContent("M0,-5L5,0L0,5Z");
    expand.getStyleClass().add("quickbar-button-arrow");
    collapse.setContent("M0,-5L-5,0L0,5Z");
    collapse.getStyleClass().add("quickbar-button-arrow");
    toggle.setGraphic(expand);
    toggle.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue) {
            toggle.setGraphic(collapse);
        } else {
            toggle.setGraphic(expand);
        }
    });
    HBox.setMargin(toggle, new Insets(0, 7, 0, 7));
    getChildren().add(toggle);
}
 
Example 4
Source File: TextTreeItem.java    From PDF4Teachers with Apache License 2.0 6 votes vote down vote up
public void updateIcon(){ // Re définis les children de la pane
	int cellHeight = (Main.settings.isSmallFontInTextsList() ? 14 : 18);

	pane.getChildren().clear();

	HBox spacer = new HBox();
	spacer.setPrefWidth(15 + (3 + 4 + 3));
	spacer.setAlignment(Pos.TOP_RIGHT);
	if(core != null) spacer.getChildren().add(linkImage);


	rect.setWidth(4);
	rect.setHeight(4);
	rect.setFill(StyleManager.convertColor(Color.WHITE));
	HBox.setMargin(rect, new Insets(((cellHeight - 4) / 2.0), 3, 0, 3));
	spacer.getChildren().add(rect);

	pane.getChildren().addAll(spacer, name);

}
 
Example 5
Source File: PluginParametersPane.java    From constellation with Apache License 2.0 6 votes vote down vote up
@Override
public Pane getParamPane(final PluginParametersNode node) {
    if (node.getChildren().isEmpty()) {
        return null;
    }
    if (currentChild == -1) {
        titleLabel = new Label(title);
        titleLabel.setFont(Font.font(Font.getDefault().getFamily(), FontPosture.ITALIC, fontSize));
        final Separator separator = new Separator();
        separator.setStyle("-fx-background-color:#444444;");
        HBox separatorBox = new HBox(separator);
        HBox.setHgrow(separator, Priority.ALWAYS);
        HBox.setMargin(separator, new Insets(PADDING, 0, 0, 0));
        return new VBox(titleLabel, separatorBox);
    }
    final Pane paramPane = super.getParamPane(node);
    final SimpleDoubleProperty updated = new SimpleDoubleProperty();
    updated.bind(Bindings.max(maxParamWidth, paramPane.widthProperty()));
    maxParamWidth = updated;
    if (titleLabel != null) {
        titleLabel.prefWidthProperty().bind(maxParamWidth);
    }
    return paramPane;
}
 
Example 6
Source File: Builders.java    From PDF4Teachers with Apache License 2.0 6 votes vote down vote up
public static void setHBoxPosition(Region element, double width, double height, Insets margin){

        if(width == -1){
            HBox.setHgrow(element, Priority.ALWAYS);
            element.setMaxWidth(Double.MAX_VALUE);
        }else if(width != 0){
            element.setPrefWidth(width);
            element.minWidthProperty().bind(new SimpleDoubleProperty(width));
        }
        if(height == -1){
            VBox.setVgrow(element, Priority.ALWAYS);
        }else if(height != 0){
            element.setPrefHeight(height);
            element.minHeightProperty().bind(new SimpleDoubleProperty(height));
        }
        HBox.setMargin(element, margin);
    }
 
Example 7
Source File: ArtistsMainController.java    From MusicPlayer with MIT License 6 votes vote down vote up
ArtistCell() {
    super();
    artistImage.setFitWidth(40);
    artistImage.setFitHeight(40);
    artistImage.setPreserveRatio(true);
    artistImage.setSmooth(true);
    artistImage.setCache(true);
    title.setTextOverrun(OverrunStyle.CLIP);
    cell.getChildren().addAll(artistImage, title);
    cell.setAlignment(Pos.CENTER_LEFT);
    HBox.setMargin(artistImage, new Insets(0, 10, 0, 0));
    this.setPrefWidth(248);
    
    this.setOnMouseClicked(event -> artistList.getSelectionModel().select(artist));
    
    this.setOnDragDetected(event -> {
    	Dragboard db = this.startDragAndDrop(TransferMode.ANY);
    	ClipboardContent content = new ClipboardContent();
        content.putString("Artist");
        db.setContent(content);
    	MusicPlayer.setDraggedItem(artist);
    	db.setDragView(this.snapshot(null, null), 125, 25);
    	event.consume();
    });
}
 
Example 8
Source File: EpochController.java    From dev-tools with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(URL location, ResourceBundle resources) {
    HBox.setMargin(currentEpochLabel, new Insets(15, 5, 10, 0));
    HBox.setMargin(currentEpoch, new Insets(10, 5, 10, 0));
    HBox.setMargin(currentEpochRefreshButton, new Insets(10, 5, 10, 0));
    HBox.setMargin(tsToHumanField, new Insets(10, 5, 10, 0));
    HBox.setMargin(tsToHumanButton, new Insets(10, 5, 10, 0));
    HBox.setMargin(millisToTimeButton, new Insets(10, 5, 10, 0));

    GridPane.setMargin(epochYear, new Insets(10, 5, 0, 0));
    GridPane.setMargin(epochMonth, new Insets(10, 5, 0, 0));
    GridPane.setMargin(epochDay, new Insets(10, 5, 0, 0));
    GridPane.setMargin(epochHour, new Insets(10, 5, 0, 0));
    GridPane.setMargin(epochMinute, new Insets(10, 5, 0, 0));
    GridPane.setMargin(epochSecond, new Insets(10, 5, 0, 0));
    GridPane.setMargin(humanToTsButton, new Insets(10, 5, 0, 0));
    GridPane.setMargin(timeZoneComboBox, new Insets(10, 5, 0, 0));

    long now = System.currentTimeMillis();
    currentEpoch.setText(Long.toString(now));
    tsToHumanField.setText(Long.toString(now));

    LocalDateTime date = LocalDateTime.now();
    epochYear.setText(String.valueOf(date.getYear()));
    epochMonth.setText(String.valueOf(date.getMonthValue()));
    epochDay.setText(String.valueOf(date.getDayOfMonth()));
    epochHour.setText(String.valueOf(date.getHour()));
    epochMinute.setText(String.valueOf(date.getMinute()));
    epochSecond.setText(String.valueOf(date.getSecond()));

    timeZoneComboBox.getItems().setAll(TimeZone.getAvailableIDs());
    timeZoneComboBox.setValue("UTC");
    timeZoneComboBoxIndex = 0;
}
 
Example 9
Source File: SaveSetTab.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
private javafx.scene.Node getTabGraphic(){
    HBox container = new HBox();
    Image icon = ImageCache.getImage(SnapshotTab.class, "/icons/save-and-restore/saveset.png");
    ImageView imageView = new ImageView(icon);
    Label label = new Label("");
    label.textProperty().bindBidirectional(tabTitleProperty);
    HBox.setMargin(label, new Insets(3, 5, 0,5));
    container.getChildren().addAll(imageView, label);

    return container;
}
 
Example 10
Source File: HashController.java    From dev-tools with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void initialize(URL location, ResourceBundle resources) {
    hashAlgoSelector.getItems().setAll("md5", "sha1", "sha256", "murmur3_128",
            "Url encode", "Url decode",
            "Base64 encode", "Base64 decode");
    hashMessage.setPadding(new Insets(5));
    hashMessage.setTextFill(Color.RED);

    HBox.setMargin(hashAlgoSelector, new Insets(10, 5, 10, 0));
    HBox.setMargin(hashCalculateButton, new Insets(10, 5, 10, 0));
    HBox.setMargin(hashMoveUpButton, new Insets(10, 5, 10, 0));
    HBox.setMargin(hashClearButton, new Insets(10, 5, 10, 0));
    HBox.setMargin(hashMessage, new Insets(10, 5, 10, 0));
}
 
Example 11
Source File: ApplicationController.java    From TerasologyLauncher with Apache License 2.0 5 votes vote down vote up
VersionListCell() {
    root = new HBox();
    labelVersion = new Label();
    iconStatus = new ImageView(ICON_CHECK);

    final Pane separator = new Pane();
    HBox.setHgrow(separator, Priority.ALWAYS);
    HBox.setMargin(iconStatus, MARGIN);
    root.getChildren().addAll(labelVersion, separator, iconStatus);
}
 
Example 12
Source File: PercentSliderControl.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void layoutParts() {
    node.getChildren().addAll(slider, valueLabel);
    HBox.setHgrow(slider, Priority.ALWAYS);
    valueLabel.setAlignment(Pos.CENTER);
    valueLabel.setMinWidth(VALUE_LABEL_PADDING);
    node.setSpacing(VALUE_LABEL_PADDING);
    HBox.setMargin(valueLabel, new Insets(0, VALUE_LABEL_PADDING, 0, 0));
}
 
Example 13
Source File: IntegerSliderControl.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void layoutParts() {
  node.getChildren().addAll(slider, valueLabel);
  HBox.setHgrow(slider, Priority.ALWAYS);
  valueLabel.setAlignment(Pos.CENTER);
  valueLabel.setMinWidth(VALUE_LABEL_PADDING);
  node.setSpacing(VALUE_LABEL_PADDING);
  HBox.setMargin(valueLabel, new Insets(0, VALUE_LABEL_PADDING, 0, 0));
}
 
Example 14
Source File: GradeTreeItem.java    From PDF4Teachers with Apache License 2.0 4 votes vote down vote up
public HBox getEditGraphics(int width, ContextMenu menu){

        Region spacer = new Region();
        Text name = new Text();

        Text value = new Text();
        Text slash = new Text("/");
        Text total = new Text();

        HBox pane = new HBox();
        pane.setAlignment(Pos.CENTER);
        pane.setPrefHeight(18);
        pane.setStyle("-fx-padding: -6 -6 -6 0;"); // top - right - bottom - left

        name.textProperty().bind(core.nameProperty());

        HBox.setMargin(value, new Insets(0, 0, 0, 5));
        value.textProperty().bind(Bindings.createStringBinding(() -> (core.getValue() == -1 ? "?" : Main.format.format(core.getValue())), core.valueProperty()));

        HBox.setMargin(total, new Insets(0, 5, 0, 0));
        total.textProperty().bind(Bindings.createStringBinding(() -> Main.format.format(core.getTotal()), core.totalProperty()));

        // SETUP

        HBox.setHgrow(spacer, Priority.ALWAYS);

        gradeField.setText(core.getValue() == -1 ? "" : Main.format.format(core.getValue()));
        if(!isRoot() && getParent() != null){
            if(((GradeTreeItem) getParent()).isExistTwice(core.getName())) core.setName(core.getName() + "(1)");
        }

        if(hasSubGrade()){
            pane.getChildren().addAll(name, spacer, value, slash, total);
        }else{
            pane.getChildren().addAll(name, spacer, gradeField, slash, total);
            Platform.runLater(() -> {
                gradeField.requestFocus();
            });
        }

        pageContextMenu = menu;

        pane.setOnMouseEntered(e -> {
            gradeField.requestFocus();
        });
        pane.setPrefWidth(width);
        return pane;
    }
 
Example 15
Source File: SnapshotTab.java    From phoebus with Eclipse Public License 1.0 4 votes vote down vote up
public SnapshotTab(org.phoebus.applications.saveandrestore.model.Node node, SaveAndRestoreService saveAndRestoreService){

        this.saveAndRestoreService = saveAndRestoreService;

        if(node.getNodeType().equals(NodeType.SNAPSHOT)) {
            setId(node.getUniqueId());
        }

        SpringFxmlLoader springFxmlLoader = new SpringFxmlLoader();
        try {

            VBox borderPane = (VBox)springFxmlLoader.load("ui/snapshot/SnapshotEditor.fxml");
            setContent(borderPane);

            regularImage = ImageCache.getImage(SnapshotTab.class, "/icons/save-and-restore/snapshot.png");
            goldenImage = ImageCache.getImage(SnapshotTab.class, "/icons/save-and-restore/snapshot-golden.png");

            HBox container = new HBox();
            ImageView imageView = new ImageView();
            imageView.imageProperty().bind(tabGraphicImageProperty);
            Label label = new Label("");
            label.textProperty().bind(tabTitleProperty);
            HBox.setMargin(label, new Insets(1, 0, 0,5));
            container.getChildren().addAll(imageView, label);

            setGraphic(container);

            snapshotController = springFxmlLoader.getLoader().getController();
            snapshotController.setSnapshotTab(this);
            tabTitleProperty.set(node.getNodeType().equals(NodeType.SNAPSHOT) ? node.getName() : Messages.unnamedSnapshot);

            tabGraphicImageProperty.set(Boolean.parseBoolean(node.getProperty("golden")) ? goldenImage : regularImage);

        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        setOnCloseRequest(event -> {
            if(!snapshotController.handleSnapshotTabClosed()){
                event.consume();
            }
        });
    }
 
Example 16
Source File: ClosedTradesView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void initialize() {
	txFeeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.txFee")));
	tradeFeeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.tradeFee")));
	buyerSecurityDepositColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.buyerSecurityDeposit")));
	sellerSecurityDepositColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.sellerSecurityDeposit")));
       priceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.price")));
       amountColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode())));
       volumeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amount")));
       marketColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.market")));
       directionColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.offerType")));
       dateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.dateTime")));
       tradeIdColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.tradeId")));
       stateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.state")));
       avatarColumn.setText("");

       tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
       tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noItems", Res.get("shared.trades"))));

       setTradeIdColumnCellFactory();
       setDirectionColumnCellFactory();
       setAmountColumnCellFactory();
	setTxFeeColumnCellFactory();
	setTradeFeeColumnCellFactory();
	setBuyerSecurityDepositColumnCellFactory();
	setSellerSecurityDepositColumnCellFactory();
       setPriceColumnCellFactory();
       setVolumeColumnCellFactory();
       setDateColumnCellFactory();
       setMarketColumnCellFactory();
       setStateColumnCellFactory();
       setAvatarColumnCellFactory();

       tradeIdColumn.setComparator(Comparator.comparing(o -> o.getTradable().getId()));
       dateColumn.setComparator(Comparator.comparing(o -> o.getTradable().getDate()));
       directionColumn.setComparator(Comparator.comparing(o -> o.getTradable().getOffer().getDirection()));
       marketColumn.setComparator(Comparator.comparing(model::getMarketLabel));

       priceColumn.setComparator(nullsFirstComparing(o ->
               o instanceof Trade ? ((Trade) o).getTradePrice() : o.getOffer().getPrice()
       ));
       volumeColumn.setComparator(nullsFirstComparingAsTrade(Trade::getTradeVolume));
       amountColumn.setComparator(nullsFirstComparingAsTrade(Trade::getTradeAmount));
       avatarColumn.setComparator(nullsFirstComparingAsTrade(o ->
               o.getTradingPeerNodeAddress() != null ? o.getTradingPeerNodeAddress().getFullAddress() : null
       ));
       txFeeColumn.setComparator(nullsFirstComparing(o ->
               o instanceof Trade ? ((Trade) o).getTxFee() : o.getOffer().getTxFee()
       ));
       tradeFeeColumn.setComparator(nullsFirstComparing(o ->
               o instanceof Trade ? ((Trade) o).getTakerFee() : o.getOffer().getMakerFee()
       ));
       buyerSecurityDepositColumn.setComparator(nullsFirstComparing(o ->
               o.getOffer() != null ? o.getOffer().getBuyerSecurityDeposit() : null
       ));
       sellerSecurityDepositColumn.setComparator(nullsFirstComparing(o ->
               o.getOffer() != null ? o.getOffer().getSellerSecurityDeposit() : null
       ));
       stateColumn.setComparator(Comparator.comparing(model::getState));

       dateColumn.setSortType(TableColumn.SortType.DESCENDING);
       tableView.getSortOrder().add(dateColumn);

       filterLabel.setText(Res.getWithCol("support.filter"));
       filterTextField.setPromptText(Res.get("support.filter.prompt"));
       HBox.setMargin(filterLabel, new Insets(5, 0, 0, 10));
       filterTextFieldListener = (observable, oldValue, newValue) -> applyFilteredListPredicate(filterTextField.getText());
       footerBox.setSpacing(5);
       HBox.setHgrow(spacer, Priority.ALWAYS);
       exportButton.updateText(Res.get("shared.exportCSV"));
       HBox.setMargin(exportButton, new Insets(0, 10, 0, 0));
   }
 
Example 17
Source File: JFXDecorator.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
private void initializeContainers(Node node, boolean fullScreen, boolean max, boolean min) {
    buttonsContainer = new HBox();
    buttonsContainer.getStyleClass().add("jfx-decorator-buttons-container");
    buttonsContainer.setBackground(new Background(new BackgroundFill(Color.BLACK,
        CornerRadii.EMPTY,
        Insets.EMPTY)));
    // BINDING
    buttonsContainer.setPadding(new Insets(4));
    buttonsContainer.setAlignment(Pos.CENTER_RIGHT);

    // customize decorator buttons
    List<JFXButton> btns = new ArrayList<>();
    if (fullScreen) {
        btns.add(btnFull);
    }
    if (min) {
        btns.add(btnMin);
    }
    if (max) {
        btns.add(btnMax);
        // maximize/restore the window on header double click
        buttonsContainer.addEventHandler(MouseEvent.MOUSE_CLICKED, (mouseEvent) -> {
            if (mouseEvent.getClickCount() == 2) {
                btnMax.fire();
            }
        });
    }
    btns.add(btnClose);

    text = new Text();
    text.getStyleClass().addAll("jfx-decorator-text", "title", "jfx-decorator-title");
    text.setFill(Color.WHITE);
    text.textProperty().bind(title); //binds the Text's text to title
    title.bind(primaryStage.titleProperty()); //binds title to the primaryStage's title

    graphicContainer = new HBox();
    graphicContainer.setPickOnBounds(false);
    graphicContainer.setAlignment(Pos.CENTER_LEFT);
    graphicContainer.getChildren().setAll(text);

    HBox graphicTextContainer = new HBox(graphicContainer, text);
    graphicTextContainer.getStyleClass().add("jfx-decorator-title-container");
    graphicTextContainer.setAlignment(Pos.CENTER_LEFT);
    graphicTextContainer.setPickOnBounds(false);
    HBox.setHgrow(graphicTextContainer, Priority.ALWAYS);
    HBox.setMargin(graphicContainer, new Insets(0, 8, 0, 8));

    buttonsContainer.getChildren().setAll(graphicTextContainer);
    buttonsContainer.getChildren().addAll(btns);
    buttonsContainer.addEventHandler(MouseEvent.MOUSE_ENTERED, (enter) -> allowMove = true);
    buttonsContainer.addEventHandler(MouseEvent.MOUSE_EXITED, (enter) -> {
        if (!isDragging) {
            allowMove = false;
        }
    });
    buttonsContainer.setMinWidth(180);
    contentPlaceHolder.getStyleClass().add("jfx-decorator-content-container");
    contentPlaceHolder.setMinSize(0, 0);
    StackPane clippedContainer = new StackPane(node);
    contentPlaceHolder.getChildren().add(clippedContainer);
    ((Region) node).setMinSize(0, 0);
    VBox.setVgrow(contentPlaceHolder, Priority.ALWAYS);
    contentPlaceHolder.getStyleClass().add("resize-border");
    contentPlaceHolder.setBorder(new Border(new BorderStroke(Color.BLACK,
        BorderStrokeStyle.SOLID,
        CornerRadii.EMPTY,
        new BorderWidths(0, 4, 4, 4))));
    // BINDING

    Rectangle clip = new Rectangle();
    clip.widthProperty().bind(clippedContainer.widthProperty());
    clip.heightProperty().bind(clippedContainer.heightProperty());
    clippedContainer.setClip(clip);
    this.getChildren().addAll(buttonsContainer, contentPlaceHolder);
}
 
Example 18
Source File: TurboIssueEvent.java    From HubTurbo with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static Label octicon(String which) {
    Label label = new Label(which);
    HBox.setMargin(label, new Insets(0, 2, 0, 0));
    label.getStyleClass().addAll("octicon", "issue-event-icon");
    return label;
}
 
Example 19
Source File: TakeOfferView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addPaymentGroup() {
    paymentAccountTitledGroupBg = addTitledGroupBg(gridPane, gridRow, 1, Res.get("takeOffer.paymentInfo"));
    GridPane.setColumnSpan(paymentAccountTitledGroupBg, 2);

    final Tuple4<ComboBox<PaymentAccount>, Label, TextField, HBox> paymentAccountTuple = addComboBoxTopLabelTextField(gridPane,
            gridRow, Res.get("shared.selectTradingAccount"),
            Res.get("shared.paymentMethod"), Layout.FIRST_ROW_DISTANCE);

    paymentAccountsComboBox = paymentAccountTuple.first;
    HBox.setMargin(paymentAccountsComboBox, new Insets(Layout.FLOATING_LABEL_DISTANCE, 0, 0, 0));
    paymentAccountsComboBox.setConverter(GUIUtil.getPaymentAccountsComboBoxStringConverter());
    paymentAccountsComboBox.setCellFactory(model.getPaymentAccountListCellFactory(paymentAccountsComboBox));
    paymentAccountsComboBox.setVisible(false);
    paymentAccountsComboBox.setManaged(false);
    paymentAccountsComboBox.setOnAction(e -> {
        PaymentAccount paymentAccount = paymentAccountsComboBox.getSelectionModel().getSelectedItem();
        if (paymentAccount != null) {
            maybeShowClearXchangeWarning(paymentAccount);
            maybeShowFasterPaymentsWarning(paymentAccount);
        }
        model.onPaymentAccountSelected(paymentAccount);
    });

    paymentMethodLabel = paymentAccountTuple.second;
    paymentMethodTextField = paymentAccountTuple.third;
    paymentMethodTextField.setMinWidth(250);
    paymentMethodTextField.setEditable(false);
    paymentMethodTextField.setMouseTransparent(true);
    paymentMethodTextField.setFocusTraversable(false);

    currencyTextField = new JFXTextField();
    currencyTextField.setMinWidth(250);
    currencyTextField.setEditable(false);
    currencyTextField.setMouseTransparent(true);
    currencyTextField.setFocusTraversable(false);

    final Tuple2<Label, VBox> tradeCurrencyTuple = getTopLabelWithVBox(Res.get("shared.tradeCurrency"), currencyTextField);
    HBox.setMargin(tradeCurrencyTuple.second, new Insets(5, 0, 0, 0));

    final HBox hBox = paymentAccountTuple.fourth;
    hBox.setSpacing(30);
    hBox.setAlignment(Pos.CENTER_LEFT);
    hBox.setPadding(new Insets(10, 0, 18, 0));

    hBox.getChildren().add(tradeCurrencyTuple.second);
}
 
Example 20
Source File: PluginParametersPane.java    From constellation with Apache License 2.0 4 votes vote down vote up
@Override
public Pane getParamPane(final PluginParametersNode node) {
    if (node.getChildren().isEmpty()) {
        return null;
    }
    currentCol = 0;
    paramGroupGridPane = new GridPane();

    final PluginParametersNode firstChild = node.getChildren().get(0);
    final Pane firstPane = firstChild.getFormatter().getParamPane(firstChild);
    final Button firstButton = firstChild.getFormatter().getParamHelp(firstChild);
    addElements(firstChild, firstPane, firstButton);
    HBox.setHgrow(firstPane, shouldHGrow ? Priority.ALWAYS : Priority.NEVER);
    if (firstButton != null) {
        HBox.setMargin(firstButton, new Insets(0, PADDING, 0, 0));
    }

    for (PluginParametersNode child : node.getChildren().subList(1, node.getChildren().size() - 1)) {
        final LabelDescriptionBox label = child.getFormatter().getParamLabel(child);
        label.setStyle("-fx-label-padding: " + -PADDING);
        final Pane paramPane = child.getFormatter().getParamPane(child);
        final Button paramHelp = child.getFormatter().getParamHelp(child);
        label.bindDescriptionToLabel();
        label.setMinWidth(USE_PREF_SIZE);
        addElements(child, label, paramPane, paramHelp);
        HBox.setHgrow(paramPane, shouldHGrow ? Priority.ALWAYS : Priority.NEVER);
        if (paramHelp != null) {
            HBox.setMargin(paramHelp, new Insets(0, PADDING, 0, 0));
        }
    }

    final PluginParametersNode lastChild = node.getChildren().get(node.getChildren().size() - 1);
    final LabelDescriptionBox lastLabel = lastChild.getFormatter().getParamLabel(lastChild);
    lastLabel.setStyle("-fx-label-padding: " + -PADDING);
    lastLabel.bindDescriptionToLabel();
    lastLabel.setMinWidth(USE_PREF_SIZE);
    final Pane lastPane = lastChild.getFormatter().getParamPane(lastChild);
    addElements(lastChild, lastLabel, lastPane);
    HBox.setHgrow(lastPane, shouldHGrow ? Priority.ALWAYS : Priority.NEVER);
    paramGroupGridPane.setPrefWidth(0);
    return paramGroupGridPane;
}