mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Add missing filtering on lists - reusable code for Trade filtering
This commit is contained in:
parent
4cd744fb14
commit
1b571e9575
4 changed files with 27 additions and 46 deletions
|
@ -259,21 +259,7 @@ public class LockedView extends ActivatableView<VBox, Void> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Trade trade = item.getTrade();
|
return FilteringUtils.match(item.getTrade(), filterString);
|
||||||
if (trade != null) {
|
|
||||||
if (trade.getTakerFeeTxId() != null && trade.getTakerFeeTxId().contains(filterString)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (trade.getDepositTxId() != null && trade.getDepositTxId().contains(filterString)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (trade.getPayoutTxId() != null && trade.getPayoutTxId().contains(filterString)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return FilteringUtils.match(trade.getContract(), filterString);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -420,26 +420,13 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
|
||||||
if (FilteringUtils.match(tradable.getOffer(), filterString)) {
|
if (FilteringUtils.match(tradable.getOffer(), filterString)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tradable instanceof BsqSwapTrade && FilteringUtils.match((BsqSwapTrade) tradable, filterString)) {
|
if (tradable instanceof BsqSwapTrade && FilteringUtils.match((BsqSwapTrade) tradable, filterString)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (tradable instanceof Trade && FilteringUtils.match((Trade) tradable, filterString)) {
|
||||||
if (tradable instanceof Trade) {
|
return true;
|
||||||
Trade trade = (Trade) tradable;
|
|
||||||
if (trade.getTakerFeeTxId() != null && trade.getTakerFeeTxId().contains(filterString)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (trade.getDepositTxId() != null && trade.getDepositTxId().contains(filterString)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (trade.getPayoutTxId() != null && trade.getPayoutTxId().contains(filterString)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return FilteringUtils.match(trade.getContract(), filterString);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -266,19 +266,7 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
|
||||||
if (FilteringUtils.match(item.getTrade().getOffer(), filterString)) {
|
if (FilteringUtils.match(item.getTrade().getOffer(), filterString)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return FilteringUtils.match(item.getTrade(), filterString);
|
||||||
Trade trade = item.getTrade();
|
|
||||||
|
|
||||||
if (trade.getTakerFeeTxId() != null && trade.getTakerFeeTxId().contains(filterString)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (trade.getDepositTxId() != null && trade.getDepositTxId().contains(filterString)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (trade.getPayoutTxId() != null && trade.getPayoutTxId().contains(filterString)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return FilteringUtils.match(trade.getContract(), filterString);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,11 @@ package bisq.desktop.util.filtering;
|
||||||
|
|
||||||
import bisq.core.offer.Offer;
|
import bisq.core.offer.Offer;
|
||||||
import bisq.core.trade.model.bisq_v1.Contract;
|
import bisq.core.trade.model.bisq_v1.Contract;
|
||||||
|
import bisq.core.trade.model.bisq_v1.Trade;
|
||||||
import bisq.core.trade.model.bsq_swap.BsqSwapTrade;
|
import bisq.core.trade.model.bsq_swap.BsqSwapTrade;
|
||||||
|
|
||||||
public class FilteringUtils {
|
public class FilteringUtils {
|
||||||
public static boolean match(Contract contract, String filterString) {
|
private static boolean match(Contract contract, String filterString) {
|
||||||
boolean isBuyerOnion = false;
|
boolean isBuyerOnion = false;
|
||||||
boolean isSellerOnion = false;
|
boolean isSellerOnion = false;
|
||||||
boolean matchesBuyersPaymentAccountData = false;
|
boolean matchesBuyersPaymentAccountData = false;
|
||||||
|
@ -44,4 +45,23 @@ public class FilteringUtils {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean match(Trade trade, String filterString) {
|
||||||
|
if (trade == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (trade.getTakerFeeTxId() != null && trade.getTakerFeeTxId().contains(filterString)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (trade.getDepositTxId() != null && trade.getDepositTxId().contains(filterString)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (trade.getPayoutTxId() != null && trade.getPayoutTxId().contains(filterString)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (match(trade.getContract(), filterString)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue