mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-02 18:47:06 -04:00
Add popup on offer cancel
This commit is contained in:
parent
bcb22ddaa3
commit
1ab7ee5a94
7 changed files with 50 additions and 33 deletions
|
@ -65,8 +65,8 @@ class OffersDataModel implements Activatable, DataModel {
|
|||
tradeManager.getOpenOfferTrades().removeListener(tradesListChangeListener);
|
||||
}
|
||||
|
||||
void cancelOpenOffer(Offer offer, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||
tradeManager.cancelOpenOffer(offer, resultHandler, errorMessageHandler);
|
||||
void onCancelOpenOffer(Offer offer, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||
tradeManager.onCancelOpenOffer(offer, resultHandler, errorMessageHandler);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,11 @@ package io.bitsquare.gui.main.portfolio.offer;
|
|||
|
||||
import io.bitsquare.common.viewfx.view.ActivatableViewAndModel;
|
||||
import io.bitsquare.common.viewfx.view.FxmlView;
|
||||
import io.bitsquare.gui.Navigation;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.main.MainView;
|
||||
import io.bitsquare.gui.main.funds.FundsView;
|
||||
import io.bitsquare.gui.main.funds.withdrawal.WithdrawalView;
|
||||
import io.bitsquare.offer.Offer;
|
||||
import io.bitsquare.util.Utilities;
|
||||
|
||||
|
@ -38,10 +42,12 @@ public class OffersView extends ActivatableViewAndModel<GridPane, OffersViewMode
|
|||
@FXML TableView<OfferListItem> table;
|
||||
@FXML TableColumn<OfferListItem, OfferListItem> priceColumn, amountColumn, volumeColumn,
|
||||
directionColumn, dateColumn, offerIdColumn, removeItemColumn;
|
||||
private Navigation navigation;
|
||||
|
||||
@Inject
|
||||
public OffersView(OffersViewModel model) {
|
||||
public OffersView(OffersViewModel model, Navigation navigation) {
|
||||
super(model);
|
||||
this.navigation = navigation;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,8 +69,18 @@ public class OffersView extends ActivatableViewAndModel<GridPane, OffersViewMode
|
|||
table.setItems(model.getList());
|
||||
}
|
||||
|
||||
private void cancelOpenOffer(Offer offer) {
|
||||
model.cancelOpenOffer(offer);
|
||||
private void onCancelOpenOffer(Offer offer) {
|
||||
model.onCancelOpenOffer(offer,
|
||||
() -> {
|
||||
log.debug("Remove offer was successful");
|
||||
Popups.openInfoPopup("You can withdraw the funds you paid in from the funds screens.");
|
||||
navigation.navigateTo(MainView.class, FundsView.class, WithdrawalView.class);
|
||||
},
|
||||
(message) -> {
|
||||
log.error(message);
|
||||
Popups.openWarningPopup("Remove offer failed", message);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void openOfferDetails(OfferListItem item) {
|
||||
|
@ -233,7 +249,7 @@ public class OffersView extends ActivatableViewAndModel<GridPane, OffersViewMode
|
|||
super.updateItem(item, empty);
|
||||
|
||||
if (item != null) {
|
||||
button.setOnAction(event -> cancelOpenOffer(item.getOffer()));
|
||||
button.setOnAction(event -> onCancelOpenOffer(item.getOffer()));
|
||||
setGraphic(button);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
|
||||
package io.bitsquare.gui.main.portfolio.offer;
|
||||
|
||||
import io.bitsquare.common.handlers.ErrorMessageHandler;
|
||||
import io.bitsquare.common.handlers.ResultHandler;
|
||||
import io.bitsquare.common.viewfx.model.ActivatableWithDataModel;
|
||||
import io.bitsquare.common.viewfx.model.ViewModel;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.offer.Offer;
|
||||
|
||||
|
@ -44,16 +45,8 @@ class OffersViewModel extends ActivatableWithDataModel<OffersDataModel> implemen
|
|||
}
|
||||
|
||||
|
||||
void cancelOpenOffer(Offer offer) {
|
||||
dataModel.cancelOpenOffer(offer,
|
||||
() -> {
|
||||
// visual feedback?
|
||||
log.debug("Remove offer was successful");
|
||||
},
|
||||
(message) -> {
|
||||
log.error(message);
|
||||
Popups.openWarningPopup("Remove offer failed", message);
|
||||
});
|
||||
void onCancelOpenOffer(Offer offer, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||
dataModel.onCancelOpenOffer(offer, resultHandler, errorMessageHandler);
|
||||
}
|
||||
|
||||
public ObservableList<OfferListItem> getList() {
|
||||
|
|
|
@ -112,8 +112,8 @@ class OfferBookDataModel implements Activatable, DataModel {
|
|||
btcCode.unbind();
|
||||
}
|
||||
|
||||
void cancelOpenOffer(Offer offer, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||
tradeManager.cancelOpenOffer(offer, resultHandler, errorMessageHandler);
|
||||
void onCancelOpenOffer(Offer offer, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||
tradeManager.onCancelOpenOffer(offer, resultHandler, errorMessageHandler);
|
||||
}
|
||||
|
||||
void calculateVolume() {
|
||||
|
|
|
@ -28,6 +28,8 @@ import io.bitsquare.gui.main.account.AccountView;
|
|||
import io.bitsquare.gui.main.account.content.restrictions.RestrictionsView;
|
||||
import io.bitsquare.gui.main.account.settings.AccountSettingsView;
|
||||
import io.bitsquare.gui.main.account.setup.AccountSetupWizard;
|
||||
import io.bitsquare.gui.main.funds.FundsView;
|
||||
import io.bitsquare.gui.main.funds.withdrawal.WithdrawalView;
|
||||
import io.bitsquare.gui.main.trade.TradeView;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.gui.util.validation.OptionalBtcValidator;
|
||||
|
@ -235,6 +237,20 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
}
|
||||
}
|
||||
|
||||
private void onCancelOpenOffer(Offer offer) {
|
||||
model.onCancelOpenOffer(offer,
|
||||
() -> {
|
||||
log.debug("Remove offer was successful");
|
||||
Popups.openInfoPopup("You can withdraw the funds you paid in from the funds screens.");
|
||||
navigation.navigateTo(MainView.class, FundsView.class, WithdrawalView.class);
|
||||
},
|
||||
(message) -> {
|
||||
log.error(message);
|
||||
Popups.openWarningPopup("Remove offer failed", message);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void openRestrictionsWarning(String restrictionsInfo) {
|
||||
overlayManager.blurContent();
|
||||
List<Action> actions = new ArrayList<>();
|
||||
|
@ -469,7 +485,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
if (model.isMyOffer(offer)) {
|
||||
iconView.setId("image-remove");
|
||||
title = "Remove";
|
||||
button.setOnAction(event -> model.cancelOpenOffer(item.getOffer()));
|
||||
button.setOnAction(event -> onCancelOpenOffer(item.getOffer()));
|
||||
}
|
||||
else {
|
||||
if (offer.getDirection() == Offer.Direction.SELL)
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
|
||||
package io.bitsquare.gui.main.trade.offerbook;
|
||||
|
||||
import io.bitsquare.common.handlers.ErrorMessageHandler;
|
||||
import io.bitsquare.common.handlers.ResultHandler;
|
||||
import io.bitsquare.common.viewfx.model.ActivatableWithDataModel;
|
||||
import io.bitsquare.common.viewfx.model.ViewModel;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
import io.bitsquare.gui.util.validation.OptionalBtcValidator;
|
||||
|
@ -101,17 +102,8 @@ class OfferBookViewModel extends ActivatableWithDataModel<OfferBookDataModel> im
|
|||
(newValue)));
|
||||
}
|
||||
|
||||
void cancelOpenOffer(Offer offer) {
|
||||
dataModel.cancelOpenOffer(offer,
|
||||
() -> {
|
||||
// visual feedback?
|
||||
log.debug("Remove offer was successful");
|
||||
},
|
||||
(message) -> {
|
||||
log.error(message);
|
||||
Popups.openWarningPopup("Remove offer failed", message);
|
||||
}
|
||||
);
|
||||
void onCancelOpenOffer(Offer offer, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||
dataModel.onCancelOpenOffer(offer, resultHandler, errorMessageHandler);
|
||||
}
|
||||
|
||||
boolean isTradable(Offer offer) {
|
||||
|
|
|
@ -313,7 +313,7 @@ public class TradeManager {
|
|||
});
|
||||
}
|
||||
|
||||
public void cancelOpenOffer(Offer offer, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||
public void onCancelOpenOffer(Offer offer, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||
removeOpenOffer(offer, resultHandler, errorMessageHandler, true);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue