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.layout.AnchorPane;
import java.util.function.Consumer;
public class TextFieldWithCopyIcon extends AnchorPane {
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);
AnchorPane.setRightAnchor(copyIcon, 0.0);
copyIcon.setOnMouseClicked(e -> {
if (getText() != null && getText().length() > 0)
if (getText() != null && getText().length() > 0) {
Utilities.copyToClipboard(getText());
if (handler != null)
handler.accept(getText());
}
});
TextField txIdLabel = new TextField();
txIdLabel.setEditable(false);
txIdLabel.textProperty().bindBidirectional(text);
AnchorPane.setRightAnchor(txIdLabel, 30.0);
AnchorPane.setLeftAnchor(txIdLabel, 0.0);
txIdLabel.focusTraversableProperty().set(focusTraversableProperty().get());
focusedProperty().addListener((ov, oldValue, newValue) -> txIdLabel.requestFocus());
textField = new TextField();
textField.setEditable(false);
textField.textProperty().bindBidirectional(text);
AnchorPane.setRightAnchor(textField, 30.0);
AnchorPane.setLeftAnchor(textField, 0.0);
textField.focusTraversableProperty().set(focusTraversableProperty().get());
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
@ -75,4 +85,7 @@ public class TextFieldWithCopyIcon extends AnchorPane {
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.common.util.Tuple2;
import io.bitsquare.common.util.Tuple3;
import io.bitsquare.common.util.Utilities;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.common.view.ActivatableViewAndModel;
import io.bitsquare.gui.common.view.FxmlView;
import io.bitsquare.gui.components.AddressTextField;
import io.bitsquare.gui.components.BalanceTextField;
import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.components.TitledGroupBg;
import io.bitsquare.gui.components.*;
import io.bitsquare.gui.main.MainView;
import io.bitsquare.gui.main.account.AccountView;
import io.bitsquare.gui.main.account.content.arbitratorselection.ArbitratorSelectionView;
@ -79,11 +77,11 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
private TitledGroupBg payFundsPane;
private Button showPaymentButton, takeOfferButton;
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,
amountBtcLabel, priceCurrencyLabel,
volumeCurrencyLabel, amountRangeBtcLabel, priceDescriptionLabel, volumeDescriptionLabel, takeOfferSpinnerInfoLabel;
private TextFieldWithCopyIcon totalToPayTextField;
private PopOver totalToPayInfoPopover;
private OfferView.CloseHandler closeHandler;
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.setRowIndex(totalToPayBox, gridRow);
gridPane.getChildren().add(totalToPayBox);
totalToPayTextField = new TextField();
totalToPayTextField.setEditable(false);
totalToPayTextField = new TextFieldWithCopyIcon();
totalToPayTextField.setFocusTraversable(false);
totalToPayTextField.setVisible(false);
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.setColumnIndex(totalToPayTextField, 1);
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 " +
"confirmation. " +
"Waiting that other trader starts the {0} payment.",
"Waiting that the bitcoin buyer starts the {0} payment.",
model.getCurrencyCode()));
break;
case REQUEST_CONFIRM_FIAT_PAYMENT_RECEIVED:

View File

@ -112,7 +112,7 @@ public class ConfirmPaymentReceivedView extends TradeStepDetailsView {
String key = PopupId.PAYMENT_RECEIVED;
if (preferences.showAgain(key) && !BitsquareApp.DEV_MODE) {
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" +
"There is no way to reverse a bitcoin payment.")
.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" +
"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" +
"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))
.show();
}
@ -144,7 +144,7 @@ public class StartPaymentView extends TradeStepDetailsView {
String key = PopupId.PAYMENT_SENT;
if (preferences.showAgain(key) && !BitsquareApp.DEV_MODE) {
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)
.actionButtonText("Yes I have started the payment")
.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.
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 \
takeOffer.success.info=The trade has started now.\n 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}