mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Merge pull request #4863 from jmacxx/account_usability
Account management usability improvements
This commit is contained in:
commit
09677151a6
@ -43,6 +43,7 @@ import javafx.collections.ObservableList;
|
||||
import javafx.collections.SetChangeListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -88,7 +89,7 @@ class AltCoinAccountsDataModel extends ActivatableDataModel {
|
||||
paymentAccounts.setAll(user.getPaymentAccounts().stream()
|
||||
.filter(paymentAccount -> paymentAccount.getPaymentMethod().isAsset())
|
||||
.collect(Collectors.toList()));
|
||||
paymentAccounts.sort((o1, o2) -> o1.getCreationDate().compareTo(o2.getCreationDate()));
|
||||
paymentAccounts.sort(Comparator.comparing(PaymentAccount::getAccountName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ class FiatAccountsDataModel extends ActivatableDataModel {
|
||||
.filter(paymentAccount -> !paymentAccount.getPaymentMethod().isAsset())
|
||||
.collect(Collectors.toList());
|
||||
paymentAccounts.setAll(list);
|
||||
paymentAccounts.sort(Comparator.comparing(PaymentAccount::getCreationDate));
|
||||
paymentAccounts.sort(Comparator.comparing(PaymentAccount::getAccountName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,7 @@ import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static java.util.Comparator.comparing;
|
||||
|
||||
public abstract class MutableOfferDataModel extends OfferDataModel implements BsqBalanceListener {
|
||||
private final CreateOfferService createOfferService;
|
||||
@ -330,7 +331,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs
|
||||
setTradeCurrencyFromPaymentAccount(paymentAccount);
|
||||
setSuggestedSecurityDeposit(getPaymentAccount());
|
||||
|
||||
if (amount.get() != null)
|
||||
if (amount.get() != null && this.allowAmountUpdate)
|
||||
this.amount.set(Coin.valueOf(Math.min(amount.get().value, getMaxTradeLimit())));
|
||||
}
|
||||
}
|
||||
@ -612,6 +613,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs
|
||||
private void fillPaymentAccounts() {
|
||||
if (user.getPaymentAccounts() != null)
|
||||
paymentAccounts.setAll(new HashSet<>(user.getPaymentAccounts()));
|
||||
paymentAccounts.sort(comparing(PaymentAccount::getAccountName));
|
||||
}
|
||||
|
||||
protected void setAmount(Coin amount) {
|
||||
|
@ -459,7 +459,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
||||
}
|
||||
|
||||
private void updateOfferElementsStyle() {
|
||||
GridPane.setColumnSpan(firstRowHBox, 1);
|
||||
GridPane.setColumnSpan(firstRowHBox, 2);
|
||||
|
||||
final String activeInputStyle = "input-with-border";
|
||||
final String readOnlyInputStyle = "input-with-border-readonly";
|
||||
@ -991,7 +991,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
||||
|
||||
paymentGroupBox = new HBox();
|
||||
paymentGroupBox.setAlignment(Pos.CENTER_LEFT);
|
||||
paymentGroupBox.setSpacing(62);
|
||||
paymentGroupBox.setSpacing(12);
|
||||
paymentGroupBox.setPadding(new Insets(10, 0, 18, 0));
|
||||
|
||||
final Tuple3<VBox, Label, ComboBox<PaymentAccount>> tradingAccountBoxTuple = addTopLabelComboBox(
|
||||
@ -1007,12 +1007,15 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
||||
GridPane.setMargin(paymentGroupBox, new Insets(Layout.FIRST_ROW_DISTANCE, 0, 0, 0));
|
||||
gridPane.getChildren().add(paymentGroupBox);
|
||||
|
||||
tradingAccountBoxTuple.first.setMinWidth(800);
|
||||
paymentAccountsComboBox = tradingAccountBoxTuple.third;
|
||||
paymentAccountsComboBox.setMinWidth(300);
|
||||
paymentAccountsComboBox.setMinWidth(tradingAccountBoxTuple.first.getMinWidth());
|
||||
paymentAccountsComboBox.setPrefWidth(tradingAccountBoxTuple.first.getMinWidth());
|
||||
editOfferElements.add(tradingAccountBoxTuple.first);
|
||||
|
||||
// we display either currencyComboBox (multi currency account) or currencyTextField (single)
|
||||
currencyComboBox = currencyBoxTuple.third;
|
||||
currencyComboBox.setMaxWidth(tradingAccountBoxTuple.first.getMinWidth() / 2);
|
||||
editOfferElements.add(currencySelection);
|
||||
currencyComboBox.setConverter(new StringConverter<>() {
|
||||
@Override
|
||||
|
@ -84,9 +84,11 @@ public class CreateOfferDataModelTest {
|
||||
final HashSet<PaymentAccount> paymentAccounts = new HashSet<>();
|
||||
final ClearXchangeAccount zelleAccount = new ClearXchangeAccount();
|
||||
zelleAccount.setId("234");
|
||||
zelleAccount.setAccountName("zelleAccount");
|
||||
paymentAccounts.add(zelleAccount);
|
||||
final RevolutAccount revolutAccount = new RevolutAccount();
|
||||
revolutAccount.setId("123");
|
||||
revolutAccount.setAccountName("revolutAccount");
|
||||
revolutAccount.setSingleTradeCurrency(new FiatCurrency("EUR"));
|
||||
revolutAccount.addCurrency(new FiatCurrency("USD"));
|
||||
paymentAccounts.add(revolutAccount);
|
||||
@ -104,9 +106,11 @@ public class CreateOfferDataModelTest {
|
||||
final HashSet<PaymentAccount> paymentAccounts = new HashSet<>();
|
||||
final ClearXchangeAccount zelleAccount = new ClearXchangeAccount();
|
||||
zelleAccount.setId("234");
|
||||
zelleAccount.setAccountName("zelleAccount");
|
||||
paymentAccounts.add(zelleAccount);
|
||||
final RevolutAccount revolutAccount = new RevolutAccount();
|
||||
revolutAccount.setId("123");
|
||||
revolutAccount.setAccountName("revolutAccount");
|
||||
revolutAccount.setSingleTradeCurrency(new FiatCurrency("EUR"));
|
||||
paymentAccounts.add(revolutAccount);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user