Improve popups

This commit is contained in:
Manfred Karrer 2015-11-16 17:52:01 +01:00
parent cb8761b74e
commit 6f523e02dd
14 changed files with 71 additions and 38 deletions

View file

@ -354,4 +354,8 @@ class CreateOfferDataModel extends ActivatableDataModel {
public boolean getShowPlaceOfferConfirmation() {
return preferences.getShowPlaceOfferConfirmation();
}
public Preferences getPreferences() {
return preferences;
}
}

View file

@ -20,6 +20,7 @@ package io.bitsquare.gui.main.offer.createoffer;
import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import io.bitsquare.app.BitsquareApp;
import io.bitsquare.common.UserThread;
import io.bitsquare.common.util.Tuple2;
import io.bitsquare.common.util.Tuple3;
import io.bitsquare.gui.Navigation;
@ -36,6 +37,7 @@ import io.bitsquare.gui.main.account.settings.AccountSettingsView;
import io.bitsquare.gui.main.offer.OfferView;
import io.bitsquare.gui.main.portfolio.PortfolioView;
import io.bitsquare.gui.main.portfolio.openoffer.OpenOffersView;
import io.bitsquare.gui.main.portfolio.pendingtrades.PendingTradesView;
import io.bitsquare.gui.popups.OfferDetailsPopup;
import io.bitsquare.gui.popups.Popup;
import io.bitsquare.gui.util.BSFormatter;
@ -59,6 +61,7 @@ import javafx.util.StringConverter;
import org.controlsfx.control.PopOver;
import javax.inject.Inject;
import java.util.concurrent.TimeUnit;
import static io.bitsquare.gui.util.FormBuilder.*;
import static javafx.beans.binding.Bindings.createStringBinding;
@ -428,11 +431,17 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
navigation.navigateTo(MainView.class, PortfolioView.class, OpenOffersView.class);
}
if (newValue)
new Popup().headLine(BSResources.get("createOffer.success.headline"))
.message(BSResources.get("createOffer.success.info"))
.onClose(() -> close())
.show();
if (newValue) {
UserThread.runAfter(() -> {
new Popup().headLine(BSResources.get("createOffer.success.headline"))
.message(BSResources.get("createOffer.success.info"))
.onClose(() -> {
navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class);
close();
})
.show();
}, 300, TimeUnit.MILLISECONDS);
}
};
}

View file

@ -318,4 +318,8 @@ class TakeOfferDataModel extends ActivatableDataModel {
public List<Arbitrator> getArbitrators() {
return user.getAcceptedArbitrators();
}
public Preferences getPreferences() {
return preferences;
}
}

View file

@ -20,6 +20,7 @@ package io.bitsquare.gui.main.offer.takeoffer;
import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import io.bitsquare.app.BitsquareApp;
import io.bitsquare.common.UserThread;
import io.bitsquare.common.util.Tuple2;
import io.bitsquare.common.util.Tuple3;
import io.bitsquare.gui.Navigation;
@ -63,6 +64,7 @@ import org.fxmisc.easybind.Subscription;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import static io.bitsquare.gui.util.FormBuilder.*;
import static javafx.beans.binding.Bindings.createStringBinding;
@ -220,13 +222,16 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class);
}
if (newValue && model.getTrade() != null && model.getTrade().errorMessageProperty().get() == null)
new Popup().information(BSResources.get("takeOffer.success.info"))
.onClose(() -> {
navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class);
close();
})
.show();
if (newValue && model.getTrade() != null && model.getTrade().errorMessageProperty().get() == null) {
UserThread.runAfter(() -> {
new Popup().information(BSResources.get("takeOffer.success.info"))
.onClose(() -> {
navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class);
close();
})
.show();
}, 300, TimeUnit.MILLISECONDS);
}
});
if (model.getPossiblePaymentAccounts().size() > 1) {
@ -318,8 +323,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
Offer offer = model.getOffer();
if (model.getShowTakeOfferConfirmation()) {
offerDetailsPopup.onTakeOffer(() -> model.onTakeOffer()).show(offer);
}
else {
} else {
if (model.hasAcceptedArbitrators()) {
model.onTakeOffer();
} else {

View file

@ -73,8 +73,8 @@ public class StartPaymentView extends TradeStepDetailsView {
if (preferences.showAgain(key) && !BitsquareApp.DEV_MODE) {
new Popup().information("You need to transfer now the agreed amount to your trading partner.\n" +
"Please take care that you use the exact data presented here, including the reference text\n" +
"Please do not click the \"Payment started\" button if you have before you have completed the transfer.\n" +
"Take care that you make the transfer soon to not miss the exceed trading period.")
"Please do not click the \"Payment started\" button before you have completed the transfer.\n" +
"Take care that you make the transfer soon to not exceed the trading period.")
.onClose(() -> preferences.dontShowAgain(key))
.show();
}

View file

@ -193,7 +193,7 @@ public class OfferDetailsPopup extends Popup {
});
CheckBox checkBox = addCheckBox(gridPane, ++rowIndex, "Don't show again", 5);
checkBox.setPadding(new Insets(10, 0, 15, 0));
checkBox.setPadding(new Insets(20, 0, 25, 0));
checkBox.setSelected(!preferences.getShowTakeOfferConfirmation());
checkBox.setOnAction(e -> preferences.setShowTakeOfferConfirmation(!checkBox.isSelected()));
} else {

View file

@ -52,7 +52,7 @@ public class WebViewPopup extends Popup {
webView.getEngine().documentProperty().addListener((observable, oldValue, newValue) -> {
String heightInPx = webView.getEngine()
.executeScript("window.getComputedStyle(document.body, null).getPropertyValue('height')").toString();
double height = Double.valueOf(heightInPx.replace("px", ""));
double height = Double.valueOf(heightInPx.replace("px", "")) * 1.2;
webView.setPrefHeight(height);
stage.setMinHeight(height + gridPane.getHeight());
centerPopup();

View file

@ -19,7 +19,7 @@ body {
font-family: sans-serif;
color: #333;
font-size: 14px;
line-height: 2;
line-height: 1.5;
}
a {

View file

@ -76,7 +76,7 @@ createOffer.advancedBox.county=Payments account country:
createOffer.advancedBox.info=Your trading partners must fulfill your offer restrictions. You can edit the accepted countries, languages and arbitrators in the settings. The payments account details are used from your current selected payments account (if you have multiple payments accounts).
createOffer.success.headline=Your offer has been published to the offerbook.
createOffer.success.info=In the portfolio screen you can manage your open offers.
createOffer.success.info=You can manage your open offers in the \"Portfolio\" screen under \"Open offers\".
createOffer.error.message=An error occurred when placing the offer.\n\n{0}
@ -136,8 +136,8 @@ takeOffer.advancedBox.info=These are the offer restrictions your trading partner
takeOffer.success.headline=Your have successfully published the deposit.
takeOffer.success.info=You need to wait now for the Bitcoin buyer to transfer the money to you. \nYou will get a \
notification when he has started the EUR payment. You can see the status of your trade in the <portfolio> screen \
under open trades.
notification when he has started the EUR payment. You can see the status of your trade in the \"Portfolio\" screen \
under \"Open trades\".
takeOffer.error.message=An error occurred when taking the offer.\n\n{0}
# Payment methods