Skip to content

Commit

Permalink
Add payment methods column
Browse files Browse the repository at this point in the history
  • Loading branch information
axpoems committed Dec 2, 2024
1 parent 587aa08 commit ae7c840
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public static StackPane getCustomPaymentMethodIcon(String customPaymentMethod) {
public static HBox getPaymentAndSettlementMethodsBox(List<FiatPaymentMethod> paymentMethods,
List<BitcoinPaymentMethod> settlementMethods) {
HBox hBox = new HBox(8);
hBox.setAlignment(Pos.BOTTOM_LEFT);
for (FiatPaymentMethod paymentMethod : paymentMethods) {
hBox.getChildren().add(createMethodLabel(paymentMethod));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,12 @@ private HBox createAndGetAmountAndPriceBox() {
}

private HBox createAndGetPaymentAndSettlementMethodsBox() {
return item.isBisqEasyPublicChatMessageWithOffer()
? BisqEasyViewUtils.getPaymentAndSettlementMethodsBox(item.getBisqEasyOfferPaymentMethods(), item.getBisqEasyOfferSettlementMethods())
: new HBox();
if (item.isBisqEasyPublicChatMessageWithOffer()) {
HBox hBox = BisqEasyViewUtils.getPaymentAndSettlementMethodsBox(item.getBisqEasyOfferPaymentMethods(), item.getBisqEasyOfferSettlementMethods());
hBox.setAlignment(Pos.BOTTOM_LEFT);
return hBox;
}
return new HBox();
}

private VBox createAndGetQuotedMessageBox() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import bisq.desktop.components.controls.BisqTooltip;
import bisq.desktop.components.table.BisqTableColumn;
import bisq.desktop.components.table.BisqTableView;
import bisq.desktop.main.content.bisq_easy.BisqEasyViewUtils;
import bisq.desktop.main.content.bisq_easy.offerbook.offerbook_list.OfferbookListItem;
import bisq.desktop.main.content.components.MarketImageComposition;
import bisq.i18n.Res;
Expand Down Expand Up @@ -96,6 +97,13 @@ private void configTableView() {
.comparator(Comparator.comparing(OfferbookListItem::getPriceSpecAsPercent))
.setCellFactory(getPriceCellFactory())
.build());

tableView.getColumns().add(new BisqTableColumn.Builder<OfferbookListItem>()
.title(Res.get("user.profileCard.offers.table.columns.paymentMethods"))
.left()
.isSortable(false)
.setCellFactory(getPaymentMethodsCellFactory())
.build());
}

private Callback<TableColumn<OfferbookListItem, OfferbookListItem>,
Expand Down Expand Up @@ -151,4 +159,24 @@ protected void updateItem(OfferbookListItem item, boolean empty) {
}
};
}

private Callback<TableColumn<OfferbookListItem, OfferbookListItem>,
TableCell<OfferbookListItem, OfferbookListItem>> getPaymentMethodsCellFactory() {
return column -> new TableCell<>() {
@Override
protected void updateItem(OfferbookListItem item, boolean empty) {
super.updateItem(item, empty);

if (item != null && !empty) {
HBox paymentMethodsBox = BisqEasyViewUtils.getPaymentAndSettlementMethodsBox(
item.getFiatPaymentMethods(), item.getBitcoinPaymentMethods());
paymentMethodsBox.setAlignment(Pos.CENTER_LEFT);
paymentMethodsBox.setPadding(new Insets(0, 10, 0, 0));
setGraphic(paymentMethodsBox);
} else {
setGraphic(null);
}
}
};
}
}

0 comments on commit ae7c840

Please sign in to comment.