Ui improvements

This commit is contained in:
Manfred Karrer 2016-01-30 04:32:29 +01:00
parent 98a3855742
commit 167e07b094
6 changed files with 37 additions and 23 deletions

View file

@ -27,9 +27,13 @@ import javafx.scene.control.TextField;
import javafx.scene.control.Tooltip; import javafx.scene.control.Tooltip;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import java.util.function.Consumer;
public class TextFieldWithCopyIcon extends AnchorPane { public class TextFieldWithCopyIcon extends AnchorPane {
private final StringProperty text = new SimpleStringProperty(); private final StringProperty text = new SimpleStringProperty();
private final TextField textField;
private Consumer<String> handler;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -44,20 +48,26 @@ public class TextFieldWithCopyIcon extends AnchorPane {
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY); AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
AnchorPane.setRightAnchor(copyIcon, 0.0); AnchorPane.setRightAnchor(copyIcon, 0.0);
copyIcon.setOnMouseClicked(e -> { copyIcon.setOnMouseClicked(e -> {
if (getText() != null && getText().length() > 0) if (getText() != null && getText().length() > 0) {
Utilities.copyToClipboard(getText()); Utilities.copyToClipboard(getText());
if (handler != null)
handler.accept(getText());
}
}); });
TextField txIdLabel = new TextField(); textField = new TextField();
txIdLabel.setEditable(false); textField.setEditable(false);
txIdLabel.textProperty().bindBidirectional(text); textField.textProperty().bindBidirectional(text);
AnchorPane.setRightAnchor(txIdLabel, 30.0); AnchorPane.setRightAnchor(textField, 30.0);
AnchorPane.setLeftAnchor(txIdLabel, 0.0); AnchorPane.setLeftAnchor(textField, 0.0);
txIdLabel.focusTraversableProperty().set(focusTraversableProperty().get()); textField.focusTraversableProperty().set(focusTraversableProperty().get());
focusedProperty().addListener((ov, oldValue, newValue) -> txIdLabel.requestFocus()); focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus());
getChildren().addAll(txIdLabel, copyIcon); getChildren().addAll(textField, copyIcon);
} }
public void setPromptText(String value) {
textField.setPromptText(value);
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Getter/Setter // Getter/Setter
@ -75,4 +85,7 @@ public class TextFieldWithCopyIcon extends AnchorPane {
this.text.set(text); this.text.set(text);
} }
public void setHandler(Consumer<String> handler) {
this.handler = handler;
}
} }

View file

@ -22,13 +22,11 @@ import de.jensd.fx.fontawesome.AwesomeIcon;
import io.bitsquare.app.BitsquareApp; import io.bitsquare.app.BitsquareApp;
import io.bitsquare.common.util.Tuple2; import io.bitsquare.common.util.Tuple2;
import io.bitsquare.common.util.Tuple3; import io.bitsquare.common.util.Tuple3;
import io.bitsquare.common.util.Utilities;
import io.bitsquare.gui.Navigation; import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.common.view.ActivatableViewAndModel; import io.bitsquare.gui.common.view.ActivatableViewAndModel;
import io.bitsquare.gui.common.view.FxmlView; import io.bitsquare.gui.common.view.FxmlView;
import io.bitsquare.gui.components.AddressTextField; import io.bitsquare.gui.components.*;
import io.bitsquare.gui.components.BalanceTextField;
import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.components.TitledGroupBg;
import io.bitsquare.gui.main.MainView; import io.bitsquare.gui.main.MainView;
import io.bitsquare.gui.main.account.AccountView; import io.bitsquare.gui.main.account.AccountView;
import io.bitsquare.gui.main.account.content.arbitratorselection.ArbitratorSelectionView; import io.bitsquare.gui.main.account.content.arbitratorselection.ArbitratorSelectionView;
@ -79,11 +77,11 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
private TitledGroupBg payFundsPane; private TitledGroupBg payFundsPane;
private Button showPaymentButton, takeOfferButton; private Button showPaymentButton, takeOfferButton;
private InputTextField amountTextField; private InputTextField amountTextField;
private TextField paymentMethodTextField, currencyTextField, totalToPayTextField, priceTextField, volumeTextField, amountRangeTextField; private TextField paymentMethodTextField, currencyTextField, priceTextField, volumeTextField, amountRangeTextField;
private Label buyLabel, amountDescriptionLabel, addressLabel, balanceLabel, totalToPayLabel, totalToPayInfoIconLabel, private Label buyLabel, amountDescriptionLabel, addressLabel, balanceLabel, totalToPayLabel, totalToPayInfoIconLabel,
amountBtcLabel, priceCurrencyLabel, amountBtcLabel, priceCurrencyLabel,
volumeCurrencyLabel, amountRangeBtcLabel, priceDescriptionLabel, volumeDescriptionLabel, takeOfferSpinnerInfoLabel; volumeCurrencyLabel, amountRangeBtcLabel, priceDescriptionLabel, volumeDescriptionLabel, takeOfferSpinnerInfoLabel;
private TextFieldWithCopyIcon totalToPayTextField;
private PopOver totalToPayInfoPopover; private PopOver totalToPayInfoPopover;
private OfferView.CloseHandler closeHandler; private OfferView.CloseHandler closeHandler;
private ChangeListener<Boolean> amountFocusedListener; private ChangeListener<Boolean> amountFocusedListener;
@ -483,11 +481,15 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
GridPane.setMargin(totalToPayBox, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, 0, 0, 0)); GridPane.setMargin(totalToPayBox, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, 0, 0, 0));
GridPane.setRowIndex(totalToPayBox, gridRow); GridPane.setRowIndex(totalToPayBox, gridRow);
gridPane.getChildren().add(totalToPayBox); gridPane.getChildren().add(totalToPayBox);
totalToPayTextField = new TextField(); totalToPayTextField = new TextFieldWithCopyIcon();
totalToPayTextField.setEditable(false);
totalToPayTextField.setFocusTraversable(false); totalToPayTextField.setFocusTraversable(false);
totalToPayTextField.setVisible(false); totalToPayTextField.setVisible(false);
totalToPayTextField.setPromptText(BSResources.get("createOffer.fundsBox.totalsNeeded.prompt")); totalToPayTextField.setPromptText(BSResources.get("createOffer.fundsBox.totalsNeeded.prompt"));
totalToPayTextField.setHandler(value -> {
String[] strings = value.split(" ");
if (strings.length > 1)
Utilities.copyToClipboard(strings[0]); // exclude the BTC postfix
});
GridPane.setRowIndex(totalToPayTextField, gridRow); GridPane.setRowIndex(totalToPayTextField, gridRow);
GridPane.setColumnIndex(totalToPayTextField, 1); GridPane.setColumnIndex(totalToPayTextField, 1);
GridPane.setMargin(totalToPayTextField, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, 0, 0, 0)); GridPane.setMargin(totalToPayTextField, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, 0, 0, 0));

View file

@ -101,7 +101,7 @@ public class SellerSubView extends TradeSubView {
((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText(BSResources.get("Deposit transaction has at least one blockchain " + ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText(BSResources.get("Deposit transaction has at least one blockchain " +
"confirmation. " + "confirmation. " +
"Waiting that other trader starts the {0} payment.", "Waiting that the bitcoin buyer starts the {0} payment.",
model.getCurrencyCode())); model.getCurrencyCode()));
break; break;
case REQUEST_CONFIRM_FIAT_PAYMENT_RECEIVED: case REQUEST_CONFIRM_FIAT_PAYMENT_RECEIVED:

View file

@ -112,7 +112,7 @@ public class ConfirmPaymentReceivedView extends TradeStepDetailsView {
String key = PopupId.PAYMENT_RECEIVED; String key = PopupId.PAYMENT_RECEIVED;
if (preferences.showAgain(key) && !BitsquareApp.DEV_MODE) { if (preferences.showAgain(key) && !BitsquareApp.DEV_MODE) {
new Popup().headLine("Confirmation") new Popup().headLine("Confirmation")
.message("Do you have received the payment from your trading partner?\n\n" + .message("Did you receive the payment from your trading partner?\n\n" +
"Please note that as soon you have confirmed the locked bitcoin will be released.\n" + "Please note that as soon you have confirmed the locked bitcoin will be released.\n" +
"There is no way to reverse a bitcoin payment.") "There is no way to reverse a bitcoin payment.")
.dontShowAgainId(key, preferences) .dontShowAgainId(key, preferences)

View file

@ -74,7 +74,7 @@ public class StartPaymentView extends TradeStepDetailsView {
new Popup().information("You need to transfer now the agreed amount to your trading partner.\n" + 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 take care that you use the exact data presented here, including the reference text\n" +
"Please do not click the \"Payment started\" button before you have completed the transfer.\n" + "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.") "Make sure that you make the transfer soon to not exceed the trading period.")
.onClose(() -> preferences.dontShowAgain(key)) .onClose(() -> preferences.dontShowAgain(key))
.show(); .show();
} }
@ -144,7 +144,7 @@ public class StartPaymentView extends TradeStepDetailsView {
String key = PopupId.PAYMENT_SENT; String key = PopupId.PAYMENT_SENT;
if (preferences.showAgain(key) && !BitsquareApp.DEV_MODE) { if (preferences.showAgain(key) && !BitsquareApp.DEV_MODE) {
new Popup().headLine("Confirmation") new Popup().headLine("Confirmation")
.message("Do you have transferred the payment to your trading partner?") .message("Did you transfer the payment to your trading partner?")
.dontShowAgainId(key, preferences) .dontShowAgainId(key, preferences)
.actionButtonText("Yes I have started the payment") .actionButtonText("Yes I have started the payment")
.closeButtonText("No") .closeButtonText("No")

View file

@ -135,8 +135,7 @@ takeOffer.advancedBox.info=These are the offer restrictions your trading partner
settings are matching those constraints and you are able to trade with him. settings are matching those constraints and you are able to trade with him.
takeOffer.success.headline=Your have successfully published the deposit. 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 \ takeOffer.success.info=The trade has started now.\n You can see the status of your trade in the \"Portfolio\" screen \
notification when he has started the EUR payment. You can see the status of your trade in the \"Portfolio\" screen \
under \"Open trades\". under \"Open trades\".
takeOffer.error.message=An error occurred when taking the offer.\n\n{0} takeOffer.error.message=An error occurred when taking the offer.\n\n{0}