Add account age to dispute table

This commit is contained in:
Manfred Karrer 2019-04-19 23:50:29 -05:00
parent 3246bf4720
commit 7af2d889ce
No known key found for this signature in database
GPG Key ID: 401250966A6B2C46
2 changed files with 43 additions and 18 deletions

View File

@ -26,6 +26,7 @@ import bisq.desktop.main.overlays.windows.TradeDetailsWindow;
import bisq.core.alert.PrivateNotificationManager;
import bisq.core.app.AppOptionKeys;
import bisq.core.arbitration.DisputeManager;
import bisq.core.payment.AccountAgeWitnessService;
import bisq.core.trade.TradeManager;
import bisq.core.util.BSFormatter;
@ -41,14 +42,28 @@ import javax.inject.Inject;
public class ArbitratorDisputeView extends TraderDisputeView {
@Inject
public ArbitratorDisputeView(DisputeManager disputeManager, KeyRing keyRing, TradeManager tradeManager,
BSFormatter formatter, DisputeSummaryWindow disputeSummaryWindow,
public ArbitratorDisputeView(DisputeManager disputeManager,
KeyRing keyRing,
TradeManager tradeManager,
BSFormatter formatter,
DisputeSummaryWindow disputeSummaryWindow,
PrivateNotificationManager privateNotificationManager,
ContractWindow contractWindow, TradeDetailsWindow tradeDetailsWindow,
P2PService p2PService, @Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
super(disputeManager, keyRing, tradeManager, formatter,
disputeSummaryWindow, privateNotificationManager, contractWindow,
tradeDetailsWindow, p2PService, useDevPrivilegeKeys);
ContractWindow contractWindow,
TradeDetailsWindow tradeDetailsWindow,
P2PService p2PService,
AccountAgeWitnessService accountAgeWitnessService,
@Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
super(disputeManager,
keyRing,
tradeManager,
formatter,
disputeSummaryWindow,
privateNotificationManager,
contractWindow,
tradeDetailsWindow,
p2PService,
accountAgeWitnessService,
useDevPrivilegeKeys);
}
@Override
@ -65,8 +80,8 @@ public class ArbitratorDisputeView extends TraderDisputeView {
filteredList.setPredicate(dispute -> {
boolean matchesTradeId = dispute.getTradeId().contains(filterString);
boolean matchesDate = formatter.formatDate(dispute.getOpeningDate()).contains(filterString);
boolean isBuyerOnion = getBuyerOnionAddressColumnLabel(dispute).contains(filterString);
boolean isSellerOnion = getSellerOnionAddressColumnLabel(dispute).contains(filterString);
boolean isBuyerOnion = dispute.getContract().getBuyerNodeAddress().getFullAddress().contains(filterString);
boolean isSellerOnion = dispute.getContract().getSellerNodeAddress().getFullAddress().contains(filterString);
boolean matchesBuyersPaymentAccountData = dispute.getContract().getBuyerPaymentAccountPayload().getPaymentDetails().contains(filterString);
boolean matchesSellersPaymentAccountData = dispute.getContract().getSellerPaymentAccountPayload().getPaymentDetails().contains(filterString);

View File

@ -42,6 +42,7 @@ import bisq.core.arbitration.Dispute;
import bisq.core.arbitration.DisputeManager;
import bisq.core.arbitration.messages.DisputeCommunicationMessage;
import bisq.core.locale.Res;
import bisq.core.payment.AccountAgeWitnessService;
import bisq.core.trade.Contract;
import bisq.core.trade.Trade;
import bisq.core.trade.TradeManager;
@ -147,6 +148,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
private final P2PService p2PService;
private final List<Attachment> tempAttachments = new ArrayList<>();
private final AccountAgeWitnessService accountAgeWitnessService;
private final boolean useDevPrivilegeKeys;
private TableView<Dispute> tableView;
@ -192,6 +194,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
ContractWindow contractWindow,
TradeDetailsWindow tradeDetailsWindow,
P2PService p2PService,
AccountAgeWitnessService accountAgeWitnessService,
@Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
this.disputeManager = disputeManager;
this.keyRing = keyRing;
@ -202,6 +205,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
this.contractWindow = contractWindow;
this.tradeDetailsWindow = tradeDetailsWindow;
this.p2PService = p2PService;
this.accountAgeWitnessService = accountAgeWitnessService;
this.useDevPrivilegeKeys = useDevPrivilegeKeys;
}
@ -1161,7 +1165,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
private TableColumn<Dispute, Dispute> getBuyerOnionAddressColumn() {
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<>(Res.get("support.buyerAddress")) {
{
setMinWidth(170);
setMinWidth(190);
}
};
column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
@ -1187,7 +1191,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
private TableColumn<Dispute, Dispute> getSellerOnionAddressColumn() {
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<>(Res.get("support.sellerAddress")) {
{
setMinWidth(170);
setMinWidth(190);
}
};
column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
@ -1215,9 +1219,12 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
Contract contract = item.getContract();
if (contract != null) {
NodeAddress buyerNodeAddress = contract.getBuyerNodeAddress();
if (buyerNodeAddress != null)
return buyerNodeAddress.getHostNameWithoutPostFix() + " (" + disputeManager.getNrOfDisputes(true, contract) + ")";
else
if (buyerNodeAddress != null) {
String nrOfDisputes = disputeManager.getNrOfDisputes(true, contract);
long accountAge = accountAgeWitnessService.getAccountAge(contract.getBuyerPaymentAccountPayload(), contract.getBuyerPubKeyRing());
String age = formatter.formatAccountAge(accountAge);
return buyerNodeAddress.getHostNameWithoutPostFix() + " (" + nrOfDisputes + " / " + age + ")";
} else
return Res.get("shared.na");
} else {
return Res.get("shared.na");
@ -1228,9 +1235,12 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
Contract contract = item.getContract();
if (contract != null) {
NodeAddress sellerNodeAddress = contract.getSellerNodeAddress();
if (sellerNodeAddress != null)
return sellerNodeAddress.getHostNameWithoutPostFix() + " (" + disputeManager.getNrOfDisputes(false, contract) + ")";
else
if (sellerNodeAddress != null) {
String nrOfDisputes = disputeManager.getNrOfDisputes(false, contract);
long accountAge = accountAgeWitnessService.getAccountAge(contract.getSellerPaymentAccountPayload(), contract.getSellerPubKeyRing());
String age = formatter.formatAccountAge(accountAge);
return sellerNodeAddress.getHostNameWithoutPostFix() + " (" + nrOfDisputes + " / " + age + ")";
} else
return Res.get("shared.na");
} else {
return Res.get("shared.na");
@ -1240,7 +1250,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
private TableColumn<Dispute, Dispute> getMarketColumn() {
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<>(Res.get("shared.market")) {
{
setMinWidth(130);
setMinWidth(80);
}
};
column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));