Skip to content

Commit

Permalink
Merge pull request #5133 from ripcurlx/fix-ui-overlap-for-offer-match…
Browse files Browse the repository at this point in the history
…ing-feature

[v1.5.5] Prevent overlapping in offer book tools bar
  • Loading branch information
sqrrm authored Feb 1, 2021
2 parents 7c81e1e + 1af7e6a commit a819e9e
Showing 1 changed file with 23 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@
import javafx.scene.control.TableView;
import javafx.scene.control.Tooltip;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextAlignment;

Expand All @@ -113,6 +113,8 @@
import java.util.Comparator;
import java.util.Optional;

import org.jetbrains.annotations.NotNull;

import static bisq.desktop.util.FormBuilder.addTitledGroupBg;

@FxmlView
Expand Down Expand Up @@ -173,10 +175,10 @@ public void initialize() {
final TitledGroupBg titledGroupBg = addTitledGroupBg(root, gridRow, 2, Res.get("offerbook.availableOffers"));
titledGroupBg.getStyleClass().add("last");

HBox hBox = new HBox();
hBox.setAlignment(Pos.CENTER_LEFT);
hBox.setSpacing(35);
hBox.setPadding(new Insets(10, 0, 0, 0));
HBox offerToolsBox = new HBox();
offerToolsBox.setAlignment(Pos.BOTTOM_LEFT);
offerToolsBox.setSpacing(10);
offerToolsBox.setPadding(new Insets(10, 0, 0, 0));

Tuple3<VBox, Label, AutocompleteComboBox<TradeCurrency>> currencyBoxTuple = FormBuilder.addTopLabelAutocompleteComboBox(
Res.get("offerbook.filterByCurrency"));
Expand All @@ -193,25 +195,19 @@ public void initialize() {
matchingOffersToggle.setText(Res.get("offerbook.matchingOffers"));
HBox.setMargin(matchingOffersToggle, new Insets(7, 0, -9, -15));

hBox.getChildren().addAll(currencyBoxTuple.first, paymentBoxTuple.first, matchingOffersToggle);
AnchorPane.setLeftAnchor(hBox, 0d);
AnchorPane.setTopAnchor(hBox, 0d);
AnchorPane.setBottomAnchor(hBox, 0d);

createOfferButton = new AutoTooltipButton();
createOfferButton.setMinHeight(40);
createOfferButton.setGraphicTextGap(10);
AnchorPane.setRightAnchor(createOfferButton, 0d);
AnchorPane.setBottomAnchor(createOfferButton, 0d);

AnchorPane anchorPane = new AnchorPane();
anchorPane.getChildren().addAll(hBox, createOfferButton);
offerToolsBox.getChildren().addAll(currencyBoxTuple.first, paymentBoxTuple.first,
matchingOffersToggle, getSpacer(), createOfferButton);

GridPane.setHgrow(anchorPane, Priority.ALWAYS);
GridPane.setRowIndex(anchorPane, gridRow);
GridPane.setColumnSpan(anchorPane, 2);
GridPane.setMargin(anchorPane, new Insets(Layout.FIRST_ROW_DISTANCE, 0, 0, 0));
root.getChildren().add(anchorPane);
GridPane.setHgrow(offerToolsBox, Priority.ALWAYS);
GridPane.setRowIndex(offerToolsBox, gridRow);
GridPane.setColumnSpan(offerToolsBox, 2);
GridPane.setMargin(offerToolsBox, new Insets(Layout.FIRST_ROW_DISTANCE, 0, 0, 0));
root.getChildren().add(offerToolsBox);

tableView = new TableView<>();

Expand Down Expand Up @@ -453,7 +449,7 @@ protected void deactivate() {
}

static class CurrencyStringConverter extends StringConverter<TradeCurrency> {
private ComboBox<TradeCurrency> comboBox;
private final ComboBox<TradeCurrency> comboBox;

CurrencyStringConverter(ComboBox<TradeCurrency> comboBox) {
this.comboBox = comboBox;
Expand Down Expand Up @@ -497,7 +493,7 @@ private TradeCurrency specialShowAllItem() {
}

static class PaymentMethodStringConverter extends StringConverter<PaymentMethod> {
private ComboBox<PaymentMethod> comboBox;
private final ComboBox<PaymentMethod> comboBox;

PaymentMethodStringConverter(ComboBox<PaymentMethod> comboBox) {
this.comboBox = comboBox;
Expand Down Expand Up @@ -1134,8 +1130,6 @@ private AutoTooltipTableColumn<OfferBookListItem, OfferBookListItem> getSigningS
@Override
public TableCell<OfferBookListItem, OfferBookListItem> call(TableColumn<OfferBookListItem, OfferBookListItem> column) {
return new TableCell<>() {
private HyperlinkWithIcon field;

@Override
public void updateItem(final OfferBookListItem item, boolean empty) {
super.updateItem(item, empty);
Expand Down Expand Up @@ -1199,4 +1193,11 @@ public void updateItem(final OfferBookListItem newItem, boolean empty) {
});
return column;
}

@NotNull
private Region getSpacer() {
final Region spacer = new Region();
HBox.setHgrow(spacer, Priority.ALWAYS);
return spacer;
}
}

0 comments on commit a819e9e

Please sign in to comment.