Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v1.5.5] Prevent overlapping in offer book tools bar #5133

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}