Not auto-close create offer view

This commit is contained in:
Christoph Atteneder 2021-10-06 11:34:30 +02:00
parent ee30cd9739
commit 9e2be92787
No known key found for this signature in database
GPG key ID: CD5DC1C529CDFD3B
3 changed files with 4 additions and 29 deletions

View file

@ -168,7 +168,6 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
private ChangeListener<String> tradeCurrencyCodeListener, errorMessageListener,
marketPriceMarginListener, volumeListener, buyerSecurityDepositInBTCListener;
private ChangeListener<Number> marketPriceAvailableListener;
private Navigation.Listener closeViewListener;
private EventHandler<ActionEvent> currencyComboBoxSelectionHandler, paymentAccountsComboBoxSelectionHandler;
private OfferView.CloseHandler closeHandler;
@ -913,12 +912,6 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
buyerSecurityDepositInputTextField.setDisable(false);
}
});
closeViewListener = (path, data) -> {
if (OfferViewUtil.isCloseView((String) data)) {
close();
}
};
}
private void setIsCurrencyForMakerFeeBtc(boolean isCurrencyForMakerFeeBtc) {
@ -975,8 +968,6 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
// UI actions
paymentAccountsComboBox.setOnAction(paymentAccountsComboBoxSelectionHandler);
currencyComboBox.setOnAction(currencyComboBoxSelectionHandler);
navigation.addListener(closeViewListener);
}
private void removeListeners() {
@ -1012,8 +1003,6 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
// UI actions
paymentAccountsComboBox.setOnAction(null);
currencyComboBox.setOnAction(null);
navigation.removeListener(closeViewListener);
}
@ -1112,7 +1101,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
gridPane.getChildren().add(advancedOptionsBox);
Tuple2<AutoTooltipButton, VBox> buyBsqButtonBox = OfferViewUtil.createBuyBsqButtonBox(
navigation, preferences, model.dataModel::getDirection);
navigation, preferences);
buyBsqButton = buyBsqButtonBox.first;
buyBsqButton.setVisible(false);

View file

@ -25,7 +25,6 @@ import bisq.desktop.main.offer.offerbook.OfferBookView;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.core.locale.Res;
import bisq.core.offer.OfferPayload;
import bisq.core.user.Preferences;
import bisq.common.UserThread;
@ -47,8 +46,6 @@ import java.util.concurrent.TimeUnit;
// Shared utils for Views
public class OfferViewUtil {
public static final String CLOSE_VIEW = "closeView";
public static Label createPopOverLabel(String text) {
final Label label = new Label(text);
label.setPrefWidth(300);
@ -85,13 +82,8 @@ public class OfferViewUtil {
infoGridPane.getChildren().addAll(label, textField);
}
public interface DirectionClosure {
OfferPayload.Direction getDirection();
}
public static Tuple2<AutoTooltipButton, VBox> createBuyBsqButtonBox(Navigation navigation,
Preferences preferences,
DirectionClosure directionClosure) {
Preferences preferences) {
String buyBsqText = Res.get("shared.buyCurrency", "BSQ");
var buyBsqButton = new AutoTooltipButton(buyBsqText);
buyBsqButton.getStyleClass().add("action-button");
@ -102,9 +94,7 @@ public class OfferViewUtil {
.buttonAlignment(HPos.CENTER)
.onAction(() -> {
preferences.setSellScreenCurrencyCode("BSQ");
navigation.navigateToWithData(
// FIXME: replace "closeOfferView" with a more unique object?
directionClosure.getDirection() == OfferPayload.Direction.SELL ? CLOSE_VIEW : null,
navigation.navigateTo(
MainView.class, SellOfferView.class, OfferBookView.class);
}).show());
@ -115,8 +105,4 @@ public class OfferViewUtil {
return new Tuple2<>(buyBsqButton, buyBsqButtonVBox);
}
public static boolean isCloseView(String data) {
return CLOSE_VIEW.equals(data);
}
}

View file

@ -871,7 +871,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
gridPane.getChildren().add(advancedOptionsBox);
Tuple2<AutoTooltipButton, VBox> buyBsqButtonBox = OfferViewUtil.createBuyBsqButtonBox(
navigation, model.dataModel.preferences, model.dataModel::getDirection);
navigation, model.dataModel.preferences);
advancedOptionsBox.getChildren().addAll(getTradeFeeFieldsBox(), buyBsqButtonBox.second);
}