Avoid raw use of Overlay<T>

This commit is contained in:
Steven Barclay 2020-03-06 17:03:55 +08:00
parent 879c3f2eb2
commit 6ef6bf24d9
No known key found for this signature in database
GPG key ID: 9FED6BF1176D500B
3 changed files with 20 additions and 23 deletions

View file

@ -133,7 +133,7 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
private Timer checkNumberOfP2pNetworkPeersTimer;
@SuppressWarnings("FieldCanBeLocal")
private MonadicBinding<Boolean> tradesAndUIReady;
private Queue<Overlay> popupQueue = new PriorityQueue<>(Comparator.comparing(Overlay::getDisplayOrderPriority));
private Queue<Overlay<?>> popupQueue = new PriorityQueue<>(Comparator.comparing(Overlay::getDisplayOrderPriority));
///////////////////////////////////////////////////////////////////////////////////////////
@ -362,7 +362,7 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
.show());
bisqSetup.setDisplayLocalhostHandler(key -> {
if (!DevEnv.isDevMode()) {
Overlay popup = new Popup().backgroundInfo(Res.get("popup.bitcoinLocalhostNode.msg") +
Popup popup = new Popup().backgroundInfo(Res.get("popup.bitcoinLocalhostNode.msg") +
Res.get("popup.bitcoinLocalhostNode.additionalRequirements"))
.dontShowAgainId(key);
popup.setDisplayOrderPriority(5);
@ -396,14 +396,14 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
tradeManager.getTradesWithoutDepositTx().addListener((ListChangeListener<Trade>) c -> {
c.next();
if (c.wasAdded()) {
c.getAddedSubList().forEach(trade -> {
c.getAddedSubList().forEach(trade ->
new Popup().warning(Res.get("popup.warning.trade.depositTxNull", trade.getShortId()))
.actionButtonText(Res.get("popup.warning.trade.depositTxNull.shutDown"))
.onAction(() -> BisqApp.getShutDownHandler().run())
.secondaryActionButtonText(Res.get("popup.warning.trade.depositTxNull.moveToFailedTrades"))
.onSecondaryAction(() -> tradeManager.addTradeToFailedTrades(trade))
.show();
});
.show()
);
}
});
@ -682,7 +682,7 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
private void maybeShowPopupsFromQueue() {
if (!popupQueue.isEmpty()) {
Overlay overlay = popupQueue.poll();
Overlay<?> overlay = popupQueue.poll();
overlay.getIsHiddenProperty().addListener((observable, oldValue, newValue) -> {
if (newValue) {
UserThread.runAfter(this::maybeShowPopupsFromQueue, 2);

View file

@ -19,7 +19,6 @@ package bisq.desktop.main.dao.monitor.daostate;
import bisq.desktop.common.view.FxmlView;
import bisq.desktop.main.dao.monitor.StateMonitorView;
import bisq.desktop.main.overlays.Overlay;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.util.FormBuilder;
@ -53,7 +52,7 @@ public class DaoStateMonitorView extends StateMonitorView<DaoStateHash, DaoState
implements DaoStateMonitoringService.Listener {
private final DaoStateMonitoringService daoStateMonitoringService;
private ListChangeListener<UtxoMismatch> utxoMismatchListChangeListener;
private Overlay warningPopup;
private Popup warningPopup;
///////////////////////////////////////////////////////////////////////////////////////////
@ -208,17 +207,16 @@ public class DaoStateMonitorView extends StateMonitorView<DaoStateHash, DaoState
private void updateUtxoMismatches() {
if (!daoStateMonitoringService.getUtxoMismatches().isEmpty()) {
StringBuilder sb = new StringBuilder();
daoStateMonitoringService.getUtxoMismatches().forEach(e -> {
sb.append("\n").append(Res.get("dao.monitor.daoState.utxoConflicts.blockHeight", e.getHeight())).append("\n")
daoStateMonitoringService.getUtxoMismatches().forEach(e -> sb.append("\n")
.append(Res.get("dao.monitor.daoState.utxoConflicts.blockHeight", e.getHeight())).append("\n")
.append(Res.get("dao.monitor.daoState.utxoConflicts.sumUtxo", e.getSumUtxo() / 100)).append("\n")
.append(Res.get("dao.monitor.daoState.utxoConflicts.sumBsq", e.getSumBsq() / 100));
});
.append(Res.get("dao.monitor.daoState.utxoConflicts.sumBsq", e.getSumBsq() / 100))
);
if (warningPopup == null) {
warningPopup = new Popup().headLine(Res.get("dao.monitor.daoState.utxoConflicts"))
.warning(Utilities.toTruncatedString(sb.toString(), 500, false)).onClose(() -> {
warningPopup = null;
});
.warning(Utilities.toTruncatedString(sb.toString(), 500, false))
.onClose(() -> warningPopup = null);
warningPopup.show();
}
}

View file

@ -20,7 +20,6 @@ package bisq.desktop.main.portfolio.pendingtrades.steps;
import bisq.desktop.components.InfoTextField;
import bisq.desktop.components.TitledGroupBg;
import bisq.desktop.components.TxIdTextField;
import bisq.desktop.main.overlays.Overlay;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.main.portfolio.pendingtrades.PendingTradesViewModel;
import bisq.desktop.main.portfolio.pendingtrades.TradeStepInfo;
@ -93,7 +92,7 @@ public abstract class TradeStepView extends AnchorPane {
private ClockWatcher.Listener clockListener;
private final ChangeListener<String> errorMessageListener;
protected Label infoLabel;
private Overlay acceptMediationResultPopup;
private Popup acceptMediationResultPopup;
private BootstrapListener bootstrapListener;