mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-09 15:12:26 -04:00
migrate to DisputeValidation
Co-authored-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
parent
6f16a5ee92
commit
190003b5ba
6 changed files with 369 additions and 190 deletions
|
@ -30,9 +30,9 @@ import bisq.core.locale.Res;
|
|||
import bisq.core.support.dispute.Dispute;
|
||||
import bisq.core.support.dispute.DisputeList;
|
||||
import bisq.core.support.dispute.DisputeManager;
|
||||
import bisq.core.support.dispute.DisputeValidation;
|
||||
import bisq.core.support.dispute.agent.MultipleHolderNameDetection;
|
||||
import bisq.core.support.dispute.arbitration.arbitrator.ArbitratorManager;
|
||||
import bisq.core.trade.TradeDataValidation;
|
||||
import bisq.core.trade.TradeManager;
|
||||
import bisq.core.user.DontShowAgainLookup;
|
||||
import bisq.core.user.Preferences;
|
||||
|
@ -60,13 +60,12 @@ import java.util.List;
|
|||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static bisq.core.trade.TradeDataValidation.ValidationException;
|
||||
import static bisq.desktop.util.FormBuilder.getIconForLabel;
|
||||
|
||||
public abstract class DisputeAgentView extends DisputeView implements MultipleHolderNameDetection.Listener {
|
||||
|
||||
private final MultipleHolderNameDetection multipleHolderNameDetection;
|
||||
private ListChangeListener<ValidationException> validationExceptionListener;
|
||||
private ListChangeListener<DisputeValidation.ValidationException> validationExceptionListener;
|
||||
|
||||
public DisputeAgentView(DisputeManager<? extends DisputeList<Dispute>> disputeManager,
|
||||
KeyRing keyRing,
|
||||
|
@ -126,7 +125,7 @@ public abstract class DisputeAgentView extends DisputeView implements MultipleHo
|
|||
};
|
||||
}
|
||||
|
||||
protected void showWarningForValidationExceptions(List<? extends ValidationException> exceptions) {
|
||||
protected void showWarningForValidationExceptions(List<? extends DisputeValidation.ValidationException> exceptions) {
|
||||
exceptions.stream()
|
||||
.filter(ex -> ex.getDispute() != null)
|
||||
.filter(ex -> !ex.getDispute().isClosed()) // we show warnings only for open cases
|
||||
|
@ -134,7 +133,7 @@ public abstract class DisputeAgentView extends DisputeView implements MultipleHo
|
|||
.forEach(ex -> new Popup().width(900).warning(getValidationExceptionMessage(ex)).dontShowAgainId(getKey(ex)).show());
|
||||
}
|
||||
|
||||
private String getKey(ValidationException exception) {
|
||||
private String getKey(DisputeValidation.ValidationException exception) {
|
||||
Dispute dispute = exception.getDispute();
|
||||
if (dispute != null) {
|
||||
return "ValExcPopup-" + dispute.getTradeId() + "-" + dispute.getTraderId();
|
||||
|
@ -142,9 +141,9 @@ public abstract class DisputeAgentView extends DisputeView implements MultipleHo
|
|||
return "ValExcPopup-" + exception.toString();
|
||||
}
|
||||
|
||||
private String getValidationExceptionMessage(ValidationException exception) {
|
||||
private String getValidationExceptionMessage(DisputeValidation.ValidationException exception) {
|
||||
Dispute dispute = exception.getDispute();
|
||||
if (dispute != null && exception instanceof TradeDataValidation.AddressException) {
|
||||
if (dispute != null && exception instanceof DisputeValidation.AddressException) {
|
||||
return getAddressExceptionMessage(dispute);
|
||||
} else if (exception.getMessage() != null && !exception.getMessage().isEmpty()) {
|
||||
return exception.getMessage();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue