mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Rename getClosedTradables and getFailedTrades to getObservableList
This commit is contained in:
parent
c789650d0b
commit
32238f2050
@ -87,12 +87,12 @@ public class ClosedTradableManager implements PersistedDataHost {
|
||||
return offer.isMyOffer(keyRing);
|
||||
}
|
||||
|
||||
public ObservableList<Tradable> getClosedTradables() {
|
||||
public ObservableList<Tradable> getObservableList() {
|
||||
return closedTradables.getObservableList();
|
||||
}
|
||||
|
||||
public List<Trade> getClosedTrades() {
|
||||
return ImmutableList.copyOf(getClosedTradables().stream()
|
||||
return ImmutableList.copyOf(getObservableList().stream()
|
||||
.filter(e -> e instanceof Trade)
|
||||
.map(e -> (Trade) e)
|
||||
.collect(Collectors.toList()));
|
||||
|
@ -101,7 +101,7 @@ public class FailedTradesManager implements PersistedDataHost {
|
||||
return offer.isMyOffer(keyRing);
|
||||
}
|
||||
|
||||
public ObservableList<Trade> getFailedTrades() {
|
||||
public ObservableList<Trade> getObservableList() {
|
||||
return failedTrades.getObservableList();
|
||||
}
|
||||
|
||||
|
@ -374,8 +374,8 @@ public class XmrTxProofService implements AssetTxProofService {
|
||||
// We need to prevent that a user tries to scam by reusing a txKey and txHash of a previous XMR trade with
|
||||
// the same user (same address) and same amount. We check only for the txKey as a same txHash but different
|
||||
// txKey is not possible to get a valid result at proof.
|
||||
Stream<Trade> failedAndOpenTrades = Stream.concat(activeTrades.stream(), failedTradesManager.getFailedTrades().stream());
|
||||
Stream<Trade> closedTrades = closedTradableManager.getClosedTradables().stream()
|
||||
Stream<Trade> failedAndOpenTrades = Stream.concat(activeTrades.stream(), failedTradesManager.getObservableList().stream());
|
||||
Stream<Trade> closedTrades = closedTradableManager.getObservableList().stream()
|
||||
.filter(tradable -> tradable instanceof Trade)
|
||||
.map(tradable -> (Trade) tradable);
|
||||
Stream<Trade> allTrades = Stream.concat(failedAndOpenTrades, closedTrades);
|
||||
|
@ -52,8 +52,8 @@ public class TradableRepository {
|
||||
return ImmutableSet.<Tradable>builder()
|
||||
.addAll(openOfferManager.getObservableList())
|
||||
.addAll(tradeManager.getObservableList())
|
||||
.addAll(closedTradableManager.getClosedTradables())
|
||||
.addAll(failedTradesManager.getFailedTrades())
|
||||
.addAll(closedTradableManager.getObservableList())
|
||||
.addAll(failedTradesManager.getObservableList())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ class OfferBookViewModel extends ActivatableViewModel {
|
||||
}
|
||||
|
||||
int getNumTrades(Offer offer) {
|
||||
return closedTradableManager.getClosedTradables().stream()
|
||||
return closedTradableManager.getObservableList().stream()
|
||||
.filter(e -> {
|
||||
final NodeAddress tradingPeerNodeAddress = e instanceof Trade ? ((Trade) e).getTradingPeerNodeAddress() : null;
|
||||
return tradingPeerNodeAddress != null &&
|
||||
|
@ -127,11 +127,11 @@ public class PortfolioView extends ActivatableView<TabPane, Void> {
|
||||
|
||||
@Override
|
||||
protected void activate() {
|
||||
failedTradesManager.getFailedTrades().addListener((ListChangeListener<Trade>) c -> {
|
||||
if (failedTradesManager.getFailedTrades().size() > 0 && root.getTabs().size() == 3)
|
||||
failedTradesManager.getObservableList().addListener((ListChangeListener<Trade>) c -> {
|
||||
if (failedTradesManager.getObservableList().size() > 0 && root.getTabs().size() == 3)
|
||||
root.getTabs().add(failedTradesTab);
|
||||
});
|
||||
if (failedTradesManager.getFailedTrades().size() > 0 && root.getTabs().size() == 3)
|
||||
if (failedTradesManager.getObservableList().size() > 0 && root.getTabs().size() == 3)
|
||||
root.getTabs().add(failedTradesTab);
|
||||
|
||||
root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener);
|
||||
|
@ -48,12 +48,12 @@ class ClosedTradesDataModel extends ActivatableDataModel {
|
||||
@Override
|
||||
protected void activate() {
|
||||
applyList();
|
||||
closedTradableManager.getClosedTradables().addListener(tradesListChangeListener);
|
||||
closedTradableManager.getObservableList().addListener(tradesListChangeListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deactivate() {
|
||||
closedTradableManager.getClosedTradables().removeListener(tradesListChangeListener);
|
||||
closedTradableManager.getObservableList().removeListener(tradesListChangeListener);
|
||||
}
|
||||
|
||||
public ObservableList<ClosedTradableListItem> getList() {
|
||||
@ -67,7 +67,7 @@ class ClosedTradesDataModel extends ActivatableDataModel {
|
||||
private void applyList() {
|
||||
list.clear();
|
||||
|
||||
list.addAll(closedTradableManager.getClosedTradables().stream().map(ClosedTradableListItem::new).collect(Collectors.toList()));
|
||||
list.addAll(closedTradableManager.getObservableList().stream().map(ClosedTradableListItem::new).collect(Collectors.toList()));
|
||||
|
||||
// we sort by date, earliest first
|
||||
list.sort((o1, o2) -> o2.getTradable().getDate().compareTo(o1.getTradable().getDate()));
|
||||
|
@ -184,7 +184,7 @@ class ClosedTradesViewModel extends ActivatableWithDataModel<ClosedTradesDataMod
|
||||
|
||||
int getNumPastTrades(Tradable tradable) {
|
||||
//noinspection ConstantConditions
|
||||
return dataModel.closedTradableManager.getClosedTradables().stream()
|
||||
return dataModel.closedTradableManager.getObservableList().stream()
|
||||
.filter(e -> e instanceof Trade &&
|
||||
tradable instanceof Trade &&
|
||||
((Trade) e).getTradingPeerNodeAddress() != null &&
|
||||
|
@ -52,12 +52,12 @@ class FailedTradesDataModel extends ActivatableDataModel {
|
||||
@Override
|
||||
protected void activate() {
|
||||
applyList();
|
||||
failedTradesManager.getFailedTrades().addListener(tradesListChangeListener);
|
||||
failedTradesManager.getObservableList().addListener(tradesListChangeListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deactivate() {
|
||||
failedTradesManager.getFailedTrades().removeListener(tradesListChangeListener);
|
||||
failedTradesManager.getObservableList().removeListener(tradesListChangeListener);
|
||||
}
|
||||
|
||||
public ObservableList<FailedTradesListItem> getList() {
|
||||
@ -71,7 +71,7 @@ class FailedTradesDataModel extends ActivatableDataModel {
|
||||
private void applyList() {
|
||||
list.clear();
|
||||
|
||||
list.addAll(failedTradesManager.getFailedTrades().stream().map(FailedTradesListItem::new).collect(Collectors.toList()));
|
||||
list.addAll(failedTradesManager.getObservableList().stream().map(FailedTradesListItem::new).collect(Collectors.toList()));
|
||||
|
||||
// we sort by date, earliest first
|
||||
list.sort((o1, o2) -> o2.getTrade().getDate().compareTo(o1.getTrade().getDate()));
|
||||
|
@ -348,7 +348,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
|
||||
}
|
||||
|
||||
public int getNumPastTrades(Trade trade) {
|
||||
return closedTradableManager.getClosedTradables().stream()
|
||||
return closedTradableManager.getObservableList().stream()
|
||||
.filter(e -> {
|
||||
if (e instanceof Trade) {
|
||||
Trade t = (Trade) e;
|
||||
|
Loading…
Reference in New Issue
Block a user