mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-20 12:18:26 -04:00
refactor offer tabs to fiat, bitcoin, other (with gold and silver)
This commit is contained in:
parent
a31b73d676
commit
5aba26ff82
36 changed files with 204 additions and 148 deletions
|
@ -574,9 +574,9 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
|||
|
||||
final boolean isBuy = dataModel.getDirection() == OfferDirection.BUY;
|
||||
|
||||
boolean isFiatCurrency = CurrencyUtil.isTraditionalCurrency(tradeCurrency.getCode());
|
||||
boolean isTraditionalCurrency = CurrencyUtil.isTraditionalCurrency(tradeCurrency.getCode());
|
||||
|
||||
if (isFiatCurrency) {
|
||||
if (isTraditionalCurrency) {
|
||||
amountDescription = Res.get("createOffer.amountPriceBox.amountDescription",
|
||||
isBuy ? Res.get("shared.buy") : Res.get("shared.sell"));
|
||||
} else {
|
||||
|
|
|
@ -33,7 +33,7 @@ import haveno.desktop.common.view.View;
|
|||
import haveno.desktop.common.view.ViewLoader;
|
||||
import haveno.desktop.main.MainView;
|
||||
import haveno.desktop.main.offer.createoffer.CreateOfferView;
|
||||
import haveno.desktop.main.offer.offerbook.BtcOfferBookView;
|
||||
import haveno.desktop.main.offer.offerbook.XmrOfferBookView;
|
||||
import haveno.desktop.main.offer.offerbook.OfferBookView;
|
||||
import haveno.desktop.main.offer.offerbook.OtherOfferBookView;
|
||||
import haveno.desktop.main.offer.offerbook.TopCryptoOfferBookView;
|
||||
|
@ -50,9 +50,9 @@ import java.util.Optional;
|
|||
|
||||
public abstract class OfferView extends ActivatableView<TabPane, Void> {
|
||||
|
||||
private OfferBookView<?, ?> btcOfferBookView, topCryptoOfferBookView, otherOfferBookView;
|
||||
private OfferBookView<?, ?> xmrOfferBookView, topCryptoOfferBookView, otherOfferBookView;
|
||||
|
||||
private Tab btcOfferBookTab, topCryptoOfferBookTab, otherOfferBookTab;
|
||||
private Tab xmrOfferBookTab, topCryptoOfferBookTab, otherOfferBookTab;
|
||||
|
||||
private final ViewLoader viewLoader;
|
||||
private final Navigation navigation;
|
||||
|
@ -95,11 +95,11 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
|
|||
tabChangeListener = (observableValue, oldValue, newValue) -> {
|
||||
UserThread.execute(() -> {
|
||||
if (newValue != null) {
|
||||
if (newValue.equals(btcOfferBookTab)) {
|
||||
if (btcOfferBookView != null) {
|
||||
btcOfferBookView.onTabSelected(true);
|
||||
if (newValue.equals(xmrOfferBookTab)) {
|
||||
if (xmrOfferBookView != null) {
|
||||
xmrOfferBookView.onTabSelected(true);
|
||||
} else {
|
||||
loadView(BtcOfferBookView.class, null, null);
|
||||
loadView(XmrOfferBookView.class, null, null);
|
||||
}
|
||||
} else if (newValue.equals(topCryptoOfferBookTab)) {
|
||||
if (topCryptoOfferBookView != null) {
|
||||
|
@ -116,8 +116,8 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
|
|||
}
|
||||
}
|
||||
if (oldValue != null) {
|
||||
if (oldValue.equals(btcOfferBookTab) && btcOfferBookView != null) {
|
||||
btcOfferBookView.onTabSelected(false);
|
||||
if (oldValue.equals(xmrOfferBookTab) && xmrOfferBookView != null) {
|
||||
xmrOfferBookView.onTabSelected(false);
|
||||
} else if (oldValue.equals(topCryptoOfferBookTab) && topCryptoOfferBookView != null) {
|
||||
topCryptoOfferBookView.onTabSelected(false);
|
||||
} else if (oldValue.equals(otherOfferBookTab) && otherOfferBookView != null) {
|
||||
|
@ -154,14 +154,14 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
|
|||
|
||||
root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener);
|
||||
navigation.addListener(navigationListener);
|
||||
if (btcOfferBookView == null) {
|
||||
navigation.navigateTo(MainView.class, this.getClass(), BtcOfferBookView.class);
|
||||
if (xmrOfferBookView == null) {
|
||||
navigation.navigateTo(MainView.class, this.getClass(), XmrOfferBookView.class);
|
||||
}
|
||||
|
||||
GUIUtil.updateTopCrypto(preferences);
|
||||
|
||||
if (topCryptoOfferBookTab != null) {
|
||||
topCryptoOfferBookTab.setText(GUIUtil.TOP_CRYPTO.getCode());
|
||||
topCryptoOfferBookTab.setText(GUIUtil.TOP_CRYPTO.getName().toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,15 +179,15 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
|
|||
|
||||
if (OfferBookView.class.isAssignableFrom(viewClass)) {
|
||||
|
||||
if (viewClass == BtcOfferBookView.class && btcOfferBookTab != null && btcOfferBookView != null) {
|
||||
if (viewClass == XmrOfferBookView.class && xmrOfferBookTab != null && xmrOfferBookView != null) {
|
||||
if (childViewClass == null) {
|
||||
btcOfferBookTab.setContent(btcOfferBookView.getRoot());
|
||||
xmrOfferBookTab.setContent(xmrOfferBookView.getRoot());
|
||||
} else if (childViewClass == TakeOfferView.class) {
|
||||
loadTakeViewClass(viewClass, childViewClass, btcOfferBookTab);
|
||||
loadTakeViewClass(viewClass, childViewClass, xmrOfferBookTab);
|
||||
} else {
|
||||
loadCreateViewClass(btcOfferBookView, viewClass, childViewClass, btcOfferBookTab, (PaymentMethod) data);
|
||||
loadCreateViewClass(xmrOfferBookView, viewClass, childViewClass, xmrOfferBookTab, (PaymentMethod) data);
|
||||
}
|
||||
tabPane.getSelectionModel().select(btcOfferBookTab);
|
||||
tabPane.getSelectionModel().select(xmrOfferBookTab);
|
||||
} else if (viewClass == TopCryptoOfferBookView.class && topCryptoOfferBookTab != null && topCryptoOfferBookView != null) {
|
||||
if (childViewClass == null) {
|
||||
topCryptoOfferBookTab.setContent(topCryptoOfferBookView.getRoot());
|
||||
|
@ -215,23 +215,23 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
|
|||
}
|
||||
tabPane.getSelectionModel().select(otherOfferBookTab);
|
||||
} else {
|
||||
if (btcOfferBookTab == null) {
|
||||
btcOfferBookTab = new Tab(Res.getBaseCurrencyName().toUpperCase());
|
||||
btcOfferBookTab.setClosable(false);
|
||||
topCryptoOfferBookTab = new Tab(GUIUtil.TOP_CRYPTO.getCode());
|
||||
if (xmrOfferBookTab == null) {
|
||||
xmrOfferBookTab = new Tab(Res.getBaseCurrencyName().toUpperCase());
|
||||
xmrOfferBookTab.setClosable(false);
|
||||
topCryptoOfferBookTab = new Tab(GUIUtil.TOP_CRYPTO.getName().toUpperCase());
|
||||
topCryptoOfferBookTab.setClosable(false);
|
||||
otherOfferBookTab = new Tab(Res.get("shared.other").toUpperCase());
|
||||
otherOfferBookTab.setClosable(false);
|
||||
|
||||
tabPane.getTabs().addAll(btcOfferBookTab, topCryptoOfferBookTab, otherOfferBookTab);
|
||||
tabPane.getTabs().addAll(xmrOfferBookTab, topCryptoOfferBookTab, otherOfferBookTab);
|
||||
}
|
||||
if (viewClass == BtcOfferBookView.class) {
|
||||
btcOfferBookView = (BtcOfferBookView) viewLoader.load(BtcOfferBookView.class);
|
||||
btcOfferBookView.setOfferActionHandler(offerActionHandler);
|
||||
btcOfferBookView.setDirection(direction);
|
||||
btcOfferBookView.onTabSelected(true);
|
||||
tabPane.getSelectionModel().select(btcOfferBookTab);
|
||||
btcOfferBookTab.setContent(btcOfferBookView.getRoot());
|
||||
if (viewClass == XmrOfferBookView.class) {
|
||||
xmrOfferBookView = (XmrOfferBookView) viewLoader.load(XmrOfferBookView.class);
|
||||
xmrOfferBookView.setOfferActionHandler(offerActionHandler);
|
||||
xmrOfferBookView.setDirection(direction);
|
||||
xmrOfferBookView.onTabSelected(true);
|
||||
tabPane.getSelectionModel().select(xmrOfferBookTab);
|
||||
xmrOfferBookTab.setContent(xmrOfferBookView.getRoot());
|
||||
} else if (viewClass == TopCryptoOfferBookView.class) {
|
||||
topCryptoOfferBookView = (TopCryptoOfferBookView) viewLoader.load(TopCryptoOfferBookView.class);
|
||||
topCryptoOfferBookView.setOfferActionHandler(offerActionHandler);
|
||||
|
@ -323,8 +323,8 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
|
|||
@NotNull
|
||||
private Class<? extends OfferBookView<?, ?>> getOfferBookViewClassFor(String currencyCode) {
|
||||
Class<? extends OfferBookView<?, ?>> offerBookViewClass;
|
||||
if (CurrencyUtil.isTraditionalCurrency(currencyCode)) {
|
||||
offerBookViewClass = BtcOfferBookView.class;
|
||||
if (CurrencyUtil.isFiatCurrency(currencyCode)) {
|
||||
offerBookViewClass = XmrOfferBookView.class;
|
||||
} else if (currencyCode.equals(GUIUtil.TOP_CRYPTO.getCode())) {
|
||||
offerBookViewClass = TopCryptoOfferBookView.class;
|
||||
} else {
|
||||
|
|
|
@ -30,7 +30,7 @@ import haveno.desktop.Navigation;
|
|||
import haveno.desktop.components.AutoTooltipButton;
|
||||
import haveno.desktop.components.AutoTooltipLabel;
|
||||
import haveno.desktop.components.HyperlinkWithIcon;
|
||||
import haveno.desktop.main.offer.offerbook.BtcOfferBookView;
|
||||
import haveno.desktop.main.offer.offerbook.XmrOfferBookView;
|
||||
import haveno.desktop.main.offer.offerbook.OfferBookView;
|
||||
import haveno.desktop.main.offer.offerbook.OtherOfferBookView;
|
||||
import haveno.desktop.main.offer.offerbook.TopCryptoOfferBookView;
|
||||
|
@ -127,7 +127,7 @@ public class OfferViewUtil {
|
|||
public static Class<? extends OfferBookView<?, ?>> getOfferBookViewClass(String currencyCode) {
|
||||
Class<? extends OfferBookView<?, ?>> offerBookViewClazz;
|
||||
if (CurrencyUtil.isTraditionalCurrency(currencyCode)) {
|
||||
offerBookViewClazz = BtcOfferBookView.class;
|
||||
offerBookViewClazz = XmrOfferBookView.class;
|
||||
} else if (currencyCode.equals(GUIUtil.TOP_CRYPTO.getCode())) {
|
||||
offerBookViewClazz = TopCryptoOfferBookView.class;
|
||||
} else {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class CreateOfferView extends MutableOfferView<CreateOfferViewModel> {
|
|||
TradeCurrency tradeCurrency,
|
||||
OfferView.OfferActionHandler offerActionHandler) {
|
||||
// Invert direction for non-Fiat trade currencies -> BUY BSQ is to SELL Bitcoin
|
||||
OfferDirection offerDirection = CurrencyUtil.isTraditionalCurrency(tradeCurrency.getCode()) ? direction :
|
||||
OfferDirection offerDirection = CurrencyUtil.isFiatCurrency(tradeCurrency.getCode()) ? direction :
|
||||
direction == OfferDirection.BUY ? OfferDirection.SELL : OfferDirection.BUY;
|
||||
super.initWithData(offerDirection, tradeCurrency, offerActionHandler);
|
||||
}
|
||||
|
@ -66,11 +66,10 @@ public class CreateOfferView extends MutableOfferView<CreateOfferViewModel> {
|
|||
paymentAccounts.stream().filter(paymentAccount -> {
|
||||
if (model.getTradeCurrency().equals(GUIUtil.TOP_CRYPTO)) {
|
||||
return Objects.equals(paymentAccount.getSingleTradeCurrency(), GUIUtil.TOP_CRYPTO);
|
||||
} else if (CurrencyUtil.isTraditionalCurrency(model.getTradeCurrency().getCode())) {
|
||||
return !paymentAccount.getPaymentMethod().isCrypto();
|
||||
} else if (CurrencyUtil.isFiatCurrency(model.getTradeCurrency().getCode())) {
|
||||
return paymentAccount.isFiat();
|
||||
} else {
|
||||
return paymentAccount.getPaymentMethod().isCrypto() &&
|
||||
!Objects.equals(paymentAccount.getSingleTradeCurrency(), GUIUtil.TOP_CRYPTO);
|
||||
return !paymentAccount.isFiat() && !Objects.equals(paymentAccount.getSingleTradeCurrency(), GUIUtil.TOP_CRYPTO);
|
||||
}
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import haveno.core.locale.CryptoCurrency;
|
|||
import haveno.core.locale.CurrencyUtil;
|
||||
import haveno.core.locale.GlobalSettings;
|
||||
import haveno.core.locale.TradeCurrency;
|
||||
import haveno.core.locale.TraditionalCurrency;
|
||||
import haveno.core.offer.Offer;
|
||||
import haveno.core.offer.OfferDirection;
|
||||
import haveno.core.offer.OfferFilterService;
|
||||
|
@ -82,7 +83,14 @@ public class OtherOfferBookViewModel extends OfferBookViewModel {
|
|||
@Override
|
||||
protected ObservableList<PaymentMethod> filterPaymentMethods(ObservableList<PaymentMethod> list,
|
||||
TradeCurrency selectedTradeCurrency) {
|
||||
return FXCollections.observableArrayList(list.stream().filter(PaymentMethod::isBlockchain).collect(Collectors.toList()));
|
||||
return FXCollections.observableArrayList(list.stream().filter(paymentMethod -> {
|
||||
if (paymentMethod.isBlockchain()) return true;
|
||||
if (paymentMethod.getSupportedAssetCodes() == null) return true;
|
||||
for (String assetCode : paymentMethod.getSupportedAssetCodes()) {
|
||||
if (!CurrencyUtil.isFiatCurrency(assetCode)) return true;
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -93,12 +101,18 @@ public class OtherOfferBookViewModel extends OfferBookViewModel {
|
|||
tradeCurrencies.addAll(preferences.getCryptoCurrenciesAsObservable().stream()
|
||||
.filter(withoutTopCrypto())
|
||||
.collect(Collectors.toList()));
|
||||
tradeCurrencies.addAll(CurrencyUtil.getMainTraditionalCurrencies().stream()
|
||||
.filter(withoutFiatCurrency())
|
||||
.collect(Collectors.toList()));
|
||||
tradeCurrencies.add(new CryptoCurrency(GUIUtil.EDIT_FLAG, ""));
|
||||
|
||||
allCurrencies.add(new CryptoCurrency(GUIUtil.SHOW_ALL_FLAG, ""));
|
||||
allCurrencies.addAll(CurrencyUtil.getAllSortedCryptoCurrencies().stream()
|
||||
.filter(withoutTopCrypto())
|
||||
.collect(Collectors.toList()));
|
||||
allCurrencies.addAll(CurrencyUtil.getMainTraditionalCurrencies().stream()
|
||||
.filter(withoutFiatCurrency())
|
||||
.collect(Collectors.toList()));
|
||||
allCurrencies.add(new CryptoCurrency(GUIUtil.EDIT_FLAG, ""));
|
||||
}
|
||||
|
||||
|
@ -107,9 +121,9 @@ public class OtherOfferBookViewModel extends OfferBookViewModel {
|
|||
TradeCurrency selectedTradeCurrency) {
|
||||
return offerBookListItem -> {
|
||||
Offer offer = offerBookListItem.getOffer();
|
||||
// BUY Crypto is actually SELL Bitcoin
|
||||
// BUY Crypto is actually SELL Monero
|
||||
boolean directionResult = offer.getDirection() == direction;
|
||||
boolean currencyResult = CurrencyUtil.isCryptoCurrency(offer.getCurrencyCode()) &&
|
||||
boolean currencyResult = !CurrencyUtil.isFiatCurrency(offer.getCurrencyCode()) &&
|
||||
((showAllTradeCurrenciesProperty.get() &&
|
||||
!offer.getCurrencyCode().equals(GUIUtil.TOP_CRYPTO.getCode())) ||
|
||||
offer.getCurrencyCode().equals(selectedTradeCurrency.getCode()));
|
||||
|
@ -156,4 +170,10 @@ public class OtherOfferBookViewModel extends OfferBookViewModel {
|
|||
return cryptoCurrency ->
|
||||
!cryptoCurrency.equals(GUIUtil.TOP_CRYPTO);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Predicate<TraditionalCurrency> withoutFiatCurrency() {
|
||||
return fiatCurrency ->
|
||||
!CurrencyUtil.isFiatCurrency(fiatCurrency.getCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<GridPane fx:id="root" fx:controller="haveno.desktop.main.offer.offerbook.BtcOfferBookView"
|
||||
<GridPane fx:id="root" fx:controller="haveno.desktop.main.offer.offerbook.XmrOfferBookView"
|
||||
hgap="5.0" vgap="5"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
|
|
@ -34,10 +34,10 @@ import javax.inject.Inject;
|
|||
import javax.inject.Named;
|
||||
|
||||
@FxmlView
|
||||
public class BtcOfferBookView extends OfferBookView<GridPane, BtcOfferBookViewModel> {
|
||||
public class XmrOfferBookView extends OfferBookView<GridPane, XmrOfferBookViewModel> {
|
||||
|
||||
@Inject
|
||||
BtcOfferBookView(BtcOfferBookViewModel model,
|
||||
XmrOfferBookView(XmrOfferBookViewModel model,
|
||||
Navigation navigation,
|
||||
OfferDetailsWindow offerDetailsWindow,
|
||||
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
||||
|
@ -51,8 +51,8 @@ public class BtcOfferBookView extends OfferBookView<GridPane, BtcOfferBookViewMo
|
|||
@Override
|
||||
protected String getMarketTitle() {
|
||||
return model.getDirection().equals(OfferDirection.BUY) ?
|
||||
Res.get("offerbook.availableOffersToBuy", Res.getBaseCurrencyCode(), Res.get("shared.traditional")) :
|
||||
Res.get("offerbook.availableOffersToSell", Res.getBaseCurrencyCode(), Res.get("shared.traditional"));
|
||||
Res.get("offerbook.availableOffersToBuy", Res.getBaseCurrencyCode(), Res.get("shared.fiat")) :
|
||||
Res.get("offerbook.availableOffersToSell", Res.getBaseCurrencyCode(), Res.get("shared.fiat"));
|
||||
|
||||
|
||||
}
|
|
@ -24,6 +24,7 @@ import haveno.core.locale.CryptoCurrency;
|
|||
import haveno.core.locale.CurrencyUtil;
|
||||
import haveno.core.locale.GlobalSettings;
|
||||
import haveno.core.locale.TradeCurrency;
|
||||
import haveno.core.locale.TraditionalCurrency;
|
||||
import haveno.core.offer.Offer;
|
||||
import haveno.core.offer.OfferDirection;
|
||||
import haveno.core.offer.OfferFilterService;
|
||||
|
@ -49,10 +50,10 @@ import java.util.List;
|
|||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class BtcOfferBookViewModel extends OfferBookViewModel {
|
||||
public class XmrOfferBookViewModel extends OfferBookViewModel {
|
||||
|
||||
@Inject
|
||||
public BtcOfferBookViewModel(User user,
|
||||
public XmrOfferBookViewModel(User user,
|
||||
OpenOfferManager openOfferManager,
|
||||
OfferBook offerBook,
|
||||
Preferences preferences,
|
||||
|
@ -97,11 +98,15 @@ public class BtcOfferBookViewModel extends OfferBookViewModel {
|
|||
ObservableList<TradeCurrency> allCurrencies) {
|
||||
// Used for ignoring filter (show all)
|
||||
tradeCurrencies.add(new CryptoCurrency(GUIUtil.SHOW_ALL_FLAG, ""));
|
||||
tradeCurrencies.addAll(preferences.getTraditionalCurrenciesAsObservable());
|
||||
tradeCurrencies.addAll(preferences.getTraditionalCurrenciesAsObservable().stream()
|
||||
.filter(withFiatCurrency())
|
||||
.collect(Collectors.toList()));
|
||||
tradeCurrencies.add(new CryptoCurrency(GUIUtil.EDIT_FLAG, ""));
|
||||
|
||||
allCurrencies.add(new CryptoCurrency(GUIUtil.SHOW_ALL_FLAG, ""));
|
||||
allCurrencies.addAll(CurrencyUtil.getAllSortedTraditionalCurrencies());
|
||||
allCurrencies.addAll(CurrencyUtil.getAllSortedTraditionalCurrencies().stream()
|
||||
.filter(withFiatCurrency())
|
||||
.collect(Collectors.toList()));
|
||||
allCurrencies.add(new CryptoCurrency(GUIUtil.EDIT_FLAG, ""));
|
||||
}
|
||||
|
||||
|
@ -111,7 +116,7 @@ public class BtcOfferBookViewModel extends OfferBookViewModel {
|
|||
return offerBookListItem -> {
|
||||
Offer offer = offerBookListItem.getOffer();
|
||||
boolean directionResult = offer.getDirection() != direction;
|
||||
boolean currencyResult = (showAllTradeCurrenciesProperty.get() && offer.isTraditionalOffer()) ||
|
||||
boolean currencyResult = (showAllTradeCurrenciesProperty.get() && offer.isFiatOffer()) ||
|
||||
offer.getCurrencyCode().equals(selectedTradeCurrency.getCode());
|
||||
boolean paymentMethodResult = showAllPaymentMethods ||
|
||||
offer.getPaymentMethod().equals(selectedPaymentMethod);
|
||||
|
@ -145,9 +150,14 @@ public class BtcOfferBookViewModel extends OfferBookViewModel {
|
|||
|
||||
@Override
|
||||
String getCurrencyCodeFromPreferences(OfferDirection direction) {
|
||||
// validate if previous stored currencies are Fiat ones
|
||||
// validate if previous stored currencies are Traditional ones
|
||||
String currencyCode = direction == OfferDirection.BUY ? preferences.getBuyScreenCurrencyCode() : preferences.getSellScreenCurrencyCode();
|
||||
|
||||
return CurrencyUtil.isTraditionalCurrency(currencyCode) ? currencyCode : null;
|
||||
}
|
||||
|
||||
private Predicate<TraditionalCurrency> withFiatCurrency() {
|
||||
return fiatCurrency ->
|
||||
CurrencyUtil.isFiatCurrency(fiatCurrency.getCode());
|
||||
}
|
||||
}
|
|
@ -332,7 +332,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
|||
FXCollections.emptyObservableMap()));
|
||||
|
||||
Tuple3<Label, ListView<TraditionalCurrency>, VBox> traditionalTuple = addTopLabelListView(root, displayCurrenciesGridRowIndex,
|
||||
Res.get("setting.preferences.displayFiat"));
|
||||
Res.get("setting.preferences.displayTraditional"));
|
||||
|
||||
int listRowSpan = 6;
|
||||
GridPane.setColumnIndex(traditionalTuple.third, 2);
|
||||
|
@ -343,7 +343,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
|||
traditionalCurrenciesListView = traditionalTuple.second;
|
||||
traditionalCurrenciesListView.setMinHeight(9 * Layout.LIST_ROW_HEIGHT + 2);
|
||||
traditionalCurrenciesListView.setPrefHeight(10 * Layout.LIST_ROW_HEIGHT + 2);
|
||||
Label placeholder = new AutoTooltipLabel(Res.get("setting.preferences.noFiat"));
|
||||
Label placeholder = new AutoTooltipLabel(Res.get("setting.preferences.noTraditional"));
|
||||
placeholder.setWrapText(true);
|
||||
traditionalCurrenciesListView.setPlaceholder(placeholder);
|
||||
traditionalCurrenciesListView.setCellFactory(new Callback<>() {
|
||||
|
@ -445,7 +445,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
|||
traditionalCurrenciesComboBox = addComboBox(root, displayCurrenciesGridRowIndex + listRowSpan);
|
||||
GridPane.setColumnIndex(traditionalCurrenciesComboBox, 2);
|
||||
GridPane.setValignment(traditionalCurrenciesComboBox, VPos.TOP);
|
||||
traditionalCurrenciesComboBox.setPromptText(Res.get("setting.preferences.addFiat"));
|
||||
traditionalCurrenciesComboBox.setPromptText(Res.get("setting.preferences.addTraditional"));
|
||||
traditionalCurrenciesComboBox.setButtonCell(new ListCell<>() {
|
||||
@Override
|
||||
protected void updateItem(final TraditionalCurrency item, boolean empty) {
|
||||
|
@ -453,7 +453,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
|||
this.setVisible(item != null || !empty);
|
||||
|
||||
if (empty || item == null) {
|
||||
setText(Res.get("setting.preferences.addFiat"));
|
||||
setText(Res.get("setting.preferences.addTraditional"));
|
||||
} else {
|
||||
setText(item.getNameAndCode());
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public class GUIUtil {
|
|||
|
||||
private static Preferences preferences;
|
||||
|
||||
public static TradeCurrency TOP_CRYPTO = CurrencyUtil.getTradeCurrency("ETH").get();
|
||||
public static TradeCurrency TOP_CRYPTO = CurrencyUtil.getTradeCurrency("BTC").get();
|
||||
|
||||
public static void setPreferences(Preferences preferences) {
|
||||
GUIUtil.preferences = preferences;
|
||||
|
@ -509,7 +509,7 @@ public class GUIUtil {
|
|||
HBox box = new HBox();
|
||||
box.setSpacing(20);
|
||||
Label paymentType = new AutoTooltipLabel(
|
||||
method.isCrypto() ? Res.get("shared.crypto") : Res.get("shared.traditional"));
|
||||
method.isTraditional() ? Res.get("shared.traditional") : Res.get("shared.crypto"));
|
||||
|
||||
paymentType.getStyleClass().add("currency-label-small");
|
||||
Label paymentMethod = new AutoTooltipLabel(Res.get(id));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue