UI improvements, P2P network WIP

This commit is contained in:
Manfred Karrer 2016-02-14 12:58:30 +01:00
parent 615f5570c3
commit 850b6d209c
54 changed files with 684 additions and 532 deletions

View file

@ -634,49 +634,6 @@ textfield */
-fx-base: #dd0000;
}
#trade-notification-warning {
-fx-font-size: 14;
-fx-base: -bs-red-soft;
}
#trade-notification-information {
-fx-font-size: 14;
-fx-outer-border: linear-gradient(to bottom, #ffb34b, #ff9200);
}
#trade-notification-dispute {
-fx-font-size: 14;
-fx-base: -bs-error-red;
}
#trade-notification-support {
-fx-font-size: 14;
-fx-base: -bs-orange;
}
#support-info-label {
-fx-font-size: 14;
-fx-text-fill: -bs-red-soft;
}
#titled-group-bg-warn {
-fx-body-color: linear-gradient(to bottom, -bs-content-bg-grey, #F0F0F0);
-fx-outer-border: linear-gradient(to bottom, #ffb34b, #ff9200);
-fx-background-color: -fx-shadow-highlight-color,
-fx-outer-border,
-fx-inner-border,
-fx-body-color;
-fx-background-insets: 0 0 -1 0, 0, 1, 2;
-fx-background-radius: 3px, 3px, 2px, 1px;
}
#titled-group-bg-label-warn {
-fx-font-weight: bold;
-fx-font-size: 14;
-fx-text-fill: #ff9200;
-fx-background-color: -bs-content-bg-grey;
}
/* TitledGroupBg */
#titled-group-bg-label {
-fx-font-weight: bold;

View file

@ -93,6 +93,10 @@ public class TextFieldWithCopyIcon extends AnchorPane {
this.text.set(text);
}
public void setTooltip(Tooltip toolTip) {
textField.setTooltip(toolTip);
}
public void setCopyWithoutCurrencyPostFix(boolean copyWithoutCurrencyPostFix) {
this.copyWithoutCurrencyPostFix = copyWithoutCurrencyPostFix;
}

View file

@ -75,12 +75,15 @@ public class TxIdTextField extends AnchorPane {
copyIcon = new Label();
copyIcon.setLayoutY(3);
copyIcon.getStyleClass().add("copy-icon");
Tooltip.install(copyIcon, new Tooltip("Copy transaction ID to clipboard"));
copyIcon.setTooltip(new Tooltip("Copy transaction ID to clipboard"));
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
AnchorPane.setRightAnchor(copyIcon, 30.0);
Tooltip tooltip = new Tooltip("Open a blockchain explorer with that transactions ID");
blockExplorerIcon = new Label();
blockExplorerIcon.getStyleClass().add("external-link-icon");
blockExplorerIcon.setTooltip(tooltip);
AwesomeDude.setIcon(blockExplorerIcon, AwesomeIcon.EXTERNAL_LINK);
blockExplorerIcon.setMinWidth(20);
AnchorPane.setRightAnchor(blockExplorerIcon, 52.0);
@ -89,7 +92,7 @@ public class TxIdTextField extends AnchorPane {
textField = new TextField();
textField.setId("address-text-field");
textField.setEditable(false);
Tooltip.install(textField, new Tooltip("Open a blockchain explorer with that transactions ID"));
textField.setTooltip(tooltip);
AnchorPane.setRightAnchor(textField, 80.0);
AnchorPane.setLeftAnchor(textField, 0.0);
textField.focusTraversableProperty().set(focusTraversableProperty().get());

View file

@ -63,7 +63,7 @@ public class AliPayForm extends PaymentMethodForm {
updateFromInputs();
});
addLabelTextField(gridPane, ++gridRow, "Currency:", aliPayAccount.getSingleTradeCurrency().getCodeAndName());
addLabelTextField(gridPane, ++gridRow, "Currency:", aliPayAccount.getSingleTradeCurrency().getNameAndCode());
addAllowedPeriod();
addAccountNameTextFieldWithAutoFillCheckBox();
}
@ -85,7 +85,7 @@ public class AliPayForm extends PaymentMethodForm {
addLabelTextField(gridPane, ++gridRow, "Payment method:", BSResources.get(aliPayAccount.getPaymentMethod().getId()));
TextField field = addLabelTextField(gridPane, ++gridRow, "Account nr.:", aliPayAccount.getAccountNr()).second;
field.setMouseTransparent(false);
addLabelTextField(gridPane, ++gridRow, "Currency:", aliPayAccount.getSingleTradeCurrency().getCodeAndName());
addLabelTextField(gridPane, ++gridRow, "Currency:", aliPayAccount.getSingleTradeCurrency().getNameAndCode());
addAllowedPeriod();
}

View file

@ -49,7 +49,7 @@ public class BlockChainForm extends PaymentMethodForm {
private ComboBox<TradeCurrency> currencyComboBox;
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Address:", ((BlockChainAccountContractData) paymentAccountContractData).getAddress());
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Cryptocurrency address:", ((BlockChainAccountContractData) paymentAccountContractData).getAddress());
if (paymentAccountContractData instanceof BlockChainAccountContractData &&
((BlockChainAccountContractData) paymentAccountContractData).getPaymentId() != null)
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Payment ID:", ((BlockChainAccountContractData) paymentAccountContractData).getPaymentId());
@ -70,7 +70,7 @@ public class BlockChainForm extends PaymentMethodForm {
addTradeCurrencyComboBox();
currencyComboBox.setPrefWidth(250);
addressInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Receiving altcoin address:").second;
addressInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Cryptocurrency address:").second;
addressInputTextField.setValidator(altCoinAddressValidator);
addressInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
@ -98,9 +98,9 @@ public class BlockChainForm extends PaymentMethodForm {
gridRowFrom = gridRow;
addLabelTextField(gridPane, gridRow, "Account name:", blockChainAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addLabelTextField(gridPane, ++gridRow, "Payment method:", BSResources.get(blockChainAccount.getPaymentMethod().getId()));
TextField field = addLabelTextField(gridPane, ++gridRow, "Receiving altcoin address:", blockChainAccount.getAddress()).second;
TextField field = addLabelTextField(gridPane, ++gridRow, "Cryptocurrency address:", blockChainAccount.getAddress()).second;
field.setMouseTransparent(false);
addLabelTextField(gridPane, ++gridRow, "Crypto currency:", blockChainAccount.getSingleTradeCurrency().getCodeAndName());
addLabelTextField(gridPane, ++gridRow, "Crypto currency:", blockChainAccount.getSingleTradeCurrency().getNameAndCode());
addAllowedPeriod();
}
@ -114,13 +114,13 @@ public class BlockChainForm extends PaymentMethodForm {
@Override
protected void addTradeCurrencyComboBox() {
currencyComboBox = addLabelComboBox(gridPane, ++gridRow, "Crypto currency:").second;
currencyComboBox.setPromptText("Select crypto currency");
currencyComboBox.setPromptText("Select cryptocurrency");
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getSortedCryptoCurrencies()));
currencyComboBox.setVisibleRowCount(Math.min(currencyComboBox.getItems().size(), 20));
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
@Override
public String toString(TradeCurrency tradeCurrency) {
return tradeCurrency.getCodeAndName();
return tradeCurrency.getNameAndCode();
}
@Override

View file

@ -65,7 +65,7 @@ public abstract class PaymentMethodForm {
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
@Override
public String toString(TradeCurrency tradeCurrency) {
return tradeCurrency.getCodeAndName();
return tradeCurrency.getNameAndCode();
}
@Override
@ -111,7 +111,7 @@ public abstract class PaymentMethodForm {
displayText = hours / 24 + " days";
addLabelTextField(gridPane, gridRow, "Trade period/end date:", displayText + " / " + dateFromBlocks);
addLabelTextField(gridPane, gridRow, "Max. allowed trade period / date:", displayText + " / " + dateFromBlocks);
}
protected void addAllowedPeriod() {
@ -126,7 +126,7 @@ public abstract class PaymentMethodForm {
displayText += " (Max. permitted period until the trade has to be completed)";
addLabelTextField(gridPane, ++gridRow, "Allowed trade period:", displayText);
addLabelTextField(gridPane, ++gridRow, "Max. allowed trade period:", displayText);
}
abstract protected void autoFillNameTextField();

View file

@ -64,7 +64,7 @@ public class PerfectMoneyForm extends PaymentMethodForm {
updateFromInputs();
});
addLabelTextField(gridPane, ++gridRow, "Currency:", perfectMoneyAccount.getSingleTradeCurrency().getCodeAndName());
addLabelTextField(gridPane, ++gridRow, "Currency:", perfectMoneyAccount.getSingleTradeCurrency().getNameAndCode());
addAllowedPeriod();
addAccountNameTextFieldWithAutoFillCheckBox();
}
@ -87,7 +87,7 @@ public class PerfectMoneyForm extends PaymentMethodForm {
addLabelTextField(gridPane, ++gridRow, "Payment method:", BSResources.get(perfectMoneyAccount.getPaymentMethod().getId()));
TextField field = addLabelTextField(gridPane, ++gridRow, "Account nr.:", perfectMoneyAccount.getAccountNr()).second;
field.setMouseTransparent(false);
addLabelTextField(gridPane, ++gridRow, "Currency:", perfectMoneyAccount.getSingleTradeCurrency().getCodeAndName());
addLabelTextField(gridPane, ++gridRow, "Currency:", perfectMoneyAccount.getSingleTradeCurrency().getNameAndCode());
addAllowedPeriod();
}

View file

@ -59,7 +59,7 @@ public class SepaForm extends PaymentMethodForm {
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name:", ((SepaAccountContractData) paymentAccountContractData).getHolderName());
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Country of bank:", CountryUtil.getNameByCode(paymentAccountContractData.getCountryCode()));
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Country of bank:", CountryUtil.getNameAndCode(paymentAccountContractData.getCountryCode()));
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "IBAN:", ((SepaAccountContractData) paymentAccountContractData).getIban());
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "BIC/SWIFT:", ((SepaAccountContractData) paymentAccountContractData).getBic());
return gridRow;
@ -107,7 +107,7 @@ public class SepaForm extends PaymentMethodForm {
countryComboBox.setConverter(new StringConverter<Country>() {
@Override
public String toString(Country country) {
return country.code + " (" + country.name + ")";
return country.name + " (" + country.code + ")";
}
@Override
@ -120,7 +120,7 @@ public class SepaForm extends PaymentMethodForm {
sepaAccount.setCountry(selectedItem);
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(selectedItem.code);
sepaAccount.setSingleTradeCurrency(currency);
currencyTextField.setText("Currency: " + currency.getCodeAndName());
currencyTextField.setText("Currency: " + currency.getNameAndCode());
updateCountriesSelection(true, euroCountryCheckBoxes);
updateCountriesSelection(true, nonEuroCountryCheckBoxes);
updateFromInputs();
@ -138,7 +138,7 @@ public class SepaForm extends PaymentMethodForm {
sepaAccount.setCountry(country);
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(country.code);
sepaAccount.setSingleTradeCurrency(currency);
currencyTextField.setText("Currency: " + currency.getCodeAndName());
currencyTextField.setText("Currency: " + currency.getNameAndCode());
}
updateFromInputs();
@ -256,7 +256,7 @@ public class SepaForm extends PaymentMethodForm {
TextField bicField = addLabelTextField(gridPane, ++gridRow, "BIC/SWIFT:", sepaAccount.getBic()).second;
bicField.setMouseTransparent(false);
addLabelTextField(gridPane, ++gridRow, "Location of Bank:", sepaAccount.getCountry().name);
addLabelTextField(gridPane, ++gridRow, "Currency:", sepaAccount.getSingleTradeCurrency().getCodeAndName());
addLabelTextField(gridPane, ++gridRow, "Currency:", sepaAccount.getSingleTradeCurrency().getNameAndCode());
String countries;
Tooltip tooltip = null;
if (CountryUtil.containsAllSepaEuroCountries(sepaAccount.getAcceptedCountryCodes())) {

View file

@ -72,7 +72,7 @@ public class SwishForm extends PaymentMethodForm {
updateFromInputs();
});
addLabelTextField(gridPane, ++gridRow, "Currency:", swishAccount.getSingleTradeCurrency().getCodeAndName());
addLabelTextField(gridPane, ++gridRow, "Currency:", swishAccount.getSingleTradeCurrency().getNameAndCode());
addAllowedPeriod();
addAccountNameTextFieldWithAutoFillCheckBox();
}
@ -95,7 +95,7 @@ public class SwishForm extends PaymentMethodForm {
addLabelTextField(gridPane, ++gridRow, "Account holder name:", swishAccount.getHolderName());
TextField field = addLabelTextField(gridPane, ++gridRow, "Mobile nr.:", swishAccount.getMobileNr()).second;
field.setMouseTransparent(false);
addLabelTextField(gridPane, ++gridRow, "Currency:", swishAccount.getSingleTradeCurrency().getCodeAndName());
addLabelTextField(gridPane, ++gridRow, "Currency:", swishAccount.getSingleTradeCurrency().getNameAndCode());
addAllowedPeriod();
}

View file

@ -35,9 +35,9 @@ import io.bitsquare.trade.protocol.trade.SellerAsTakerProtocol;
import io.bitsquare.trade.protocol.trade.tasks.buyer.*;
import io.bitsquare.trade.protocol.trade.tasks.offerer.*;
import io.bitsquare.trade.protocol.trade.tasks.seller.*;
import io.bitsquare.trade.protocol.trade.tasks.shared.BroadcastAfterLockTime;
import io.bitsquare.trade.protocol.trade.tasks.shared.CommitPayoutTx;
import io.bitsquare.trade.protocol.trade.tasks.shared.InitWaitPeriodForOpenDispute;
import io.bitsquare.trade.protocol.trade.tasks.shared.SetupPayoutTxLockTimeReachedListener;
import io.bitsquare.trade.protocol.trade.tasks.taker.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
@ -99,7 +99,7 @@ public class DebugView extends InitializableView {
SignAndFinalizePayoutTx.class,
CommitPayoutTx.class,
SendPayoutTxFinalizedMessage.class,
SetupPayoutTxLockTimeReachedListener.class,
BroadcastAfterLockTime.class,
Boolean.class, /* used as seperator*/
@ -125,7 +125,7 @@ public class DebugView extends InitializableView {
ProcessPayoutTxFinalizedMessage.class,
CommitPayoutTx.class,
SetupPayoutTxLockTimeReachedListener.class,
BroadcastAfterLockTime.class,
Boolean.class /* used as seperator*/
)
);
@ -152,7 +152,7 @@ public class DebugView extends InitializableView {
SignAndFinalizePayoutTx.class,
CommitPayoutTx.class,
SendPayoutTxFinalizedMessage.class,
SetupPayoutTxLockTimeReachedListener.class,
BroadcastAfterLockTime.class,
Boolean.class, /* used as seperator*/
@ -177,7 +177,7 @@ public class DebugView extends InitializableView {
ProcessPayoutTxFinalizedMessage.class,
CommitPayoutTx.class,
SetupPayoutTxLockTimeReachedListener.class,
BroadcastAfterLockTime.class,
Boolean.class /* used as seperator*/
)
);

View file

@ -86,7 +86,7 @@ public class MarketsChartsView extends ActivatableViewAndModel<VBox, MarketsChar
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
@Override
public String toString(TradeCurrency tradeCurrency) {
return tradeCurrency.getCodeAndName();
return tradeCurrency.getNameAndCode();
}
@Override

View file

@ -289,7 +289,7 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
model.onPaymentAccountSelected(paymentAccount);
} else {
currencyTextField.setText(paymentAccount.getSingleTradeCurrency().getCodeAndName());
currencyTextField.setText(paymentAccount.getSingleTradeCurrency().getNameAndCode());
model.onPaymentAccountSelected(paymentAccount);
model.onCurrencySelected(paymentAccount.getSingleTradeCurrency());
}
@ -588,7 +588,7 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
@Override
public String toString(TradeCurrency tradeCurrency) {
return tradeCurrency.getCodeAndName();
return tradeCurrency.getNameAndCode();
}
@Override
@ -673,7 +673,7 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
balanceTextField = balanceTuple.second;
balanceTextField.setVisible(false);
Tuple3<Button, ProgressIndicator, Label> placeOfferTuple = addButtonWithStatus(gridPane, ++gridRow,
Tuple3<Button, ProgressIndicator, Label> placeOfferTuple = addButtonWithStatusAfterGroup(gridPane, ++gridRow,
BSResources.get("createOffer.fundsBox.placeOffer"));
placeOfferButton = placeOfferTuple.first;
placeOfferButton.setVisible(false);

View file

@ -89,7 +89,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
@Override
public String toString(TradeCurrency tradeCurrency) {
return tradeCurrency.getCodeAndName();
return tradeCurrency.getNameAndCode();
}
@Override
@ -160,6 +160,8 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
currencyComboBox.setOnAction(e -> model.onSetTradeCurrency(currencyComboBox.getSelectionModel().getSelectedItem()));
paymentMethodComboBox.setOnAction(e -> model.onSetPaymentMethod(paymentMethodComboBox.getSelectionModel().getSelectedItem()));
createOfferButton.setOnAction(e -> onCreateOffer());
priceColumn.textProperty().bind(createStringBinding(
() -> "Price in " + model.tradeCurrencyCode.get() + "/BTC", model.tradeCurrencyCode));
volumeColumn.textProperty().bind(createStringBinding(
() -> "Amount in " + model.tradeCurrencyCode.get() + " (Min.)", model.tradeCurrencyCode));
model.getOfferList().comparatorProperty().bind(tableView.comparatorProperty());

View file

@ -317,7 +317,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
paymentMethodLabel.setManaged(!showComboBox);
if (!showComboBox)
paymentMethodTextField.setText(BSResources.get(model.getPaymentMethod().getId()));
currencyTextField.setText(model.getTradeCurrency().getCodeAndName());
currencyTextField.setText(model.getTradeCurrency().getNameAndCode());
buyLabel.setText(model.getDirectionLabel());
amountDescriptionLabel.setText(model.getAmountDescription());
amountRangeTextField.setText(model.getAmountRange());
@ -553,7 +553,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
balanceTextField = balanceTuple.second;
balanceTextField.setVisible(false);
Tuple3<Button, ProgressIndicator, Label> takeOfferTuple = addButtonWithStatus(gridPane, ++gridRow, BSResources.get("takeOffer.fundsBox.takeOffer"));
Tuple3<Button, ProgressIndicator, Label> takeOfferTuple = addButtonWithStatusAfterGroup(gridPane, ++gridRow, BSResources.get("takeOffer.fundsBox.takeOffer"));
takeOfferButton = takeOfferTuple.first;
takeOfferButton.setVisible(false);
takeOfferButton.setOnAction(e -> onTakeOffer());

View file

@ -87,7 +87,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
tradeCurrencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
@Override
public String toString(TradeCurrency tradeCurrency) {
return tradeCurrency.getCodeAndName();
return tradeCurrency.getNameAndCode();
}
@Override

View file

@ -148,7 +148,8 @@ public class OfferDetailsPopup extends Popup {
addLabelTextField(gridPane, ++rowIndex, "Payment method:", BSResources.get(offer.getPaymentMethod().getId()));
rows = 3;
if (offer.getPaymentMethodCountryCode() != null)
String paymentMethodCountryCode = offer.getPaymentMethodCountryCode();
if (paymentMethodCountryCode != null)
rows++;
if (offer.getOfferFeePaymentTxID() != null)
rows++;
@ -161,8 +162,9 @@ public class OfferDetailsPopup extends Popup {
addLabelTextField(gridPane, rowIndex, "Offer ID:", offer.getId(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addLabelTextField(gridPane, ++rowIndex, "Creation date:", formatter.formatDateTime(offer.getDate()));
if (offer.getPaymentMethodCountryCode() != null)
addLabelTextField(gridPane, ++rowIndex, "Offerers country of bank:", offer.getPaymentMethodCountryCode());
if (paymentMethodCountryCode != null)
addLabelTextField(gridPane, ++rowIndex, "Offerers country of bank:",
CountryUtil.getNameAndCode(paymentMethodCountryCode));
if (offer.getAcceptedCountryCodes() != null) {
String countries;
Tooltip tooltip = null;

View file

@ -129,6 +129,7 @@ public class FormBuilder {
return label;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Label + TextField
///////////////////////////////////////////////////////////////////////////////////////////
@ -672,9 +673,9 @@ public class FormBuilder {
// Button + ProgressIndicator + Label
///////////////////////////////////////////////////////////////////////////////////////////
public static Tuple3<Button, ProgressIndicator, Label> addButtonWithStatus(GridPane gridPane,
int rowIndex,
String buttonTitle) {
public static Tuple3<Button, ProgressIndicator, Label> addButtonWithStatusAfterGroup(GridPane gridPane,
int rowIndex,
String buttonTitle) {
return addButtonWithStatus(gridPane, rowIndex, buttonTitle, 15);
}