mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-22 11:39:29 +00:00
fix updating display of current price
This commit is contained in:
parent
c7277187c5
commit
07769fd8d9
3 changed files with 30 additions and 31 deletions
|
@ -429,14 +429,12 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
return new ListCell<>() {
|
||||
@Override
|
||||
protected void updateItem(PriceFeedComboBoxItem item, boolean empty) {
|
||||
UserThread.execute(() -> {
|
||||
super.updateItem(item, empty);
|
||||
if (!empty && item != null) {
|
||||
textProperty().bind(item.displayStringProperty);
|
||||
} else {
|
||||
textProperty().unbind();
|
||||
}
|
||||
});
|
||||
super.updateItem(item, empty);
|
||||
if (!empty && item != null) {
|
||||
textProperty().bind(item.displayStringProperty);
|
||||
} else {
|
||||
textProperty().unbind();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -131,31 +131,33 @@ public class MarketPricePresentation {
|
|||
});
|
||||
|
||||
marketPriceBinding.subscribe((observable, oldValue, newValue) -> {
|
||||
if (newValue != null && !newValue.equals(oldValue)) {
|
||||
setMarketPriceInItems();
|
||||
UserThread.execute(() -> {
|
||||
if (newValue != null && !newValue.equals(oldValue)) {
|
||||
setMarketPriceInItems();
|
||||
|
||||
String code = priceFeedService.currencyCodeProperty().get();
|
||||
Optional<PriceFeedComboBoxItem> itemOptional = findPriceFeedComboBoxItem(code);
|
||||
if (itemOptional.isPresent()) {
|
||||
itemOptional.get().setDisplayString(newValue);
|
||||
selectedPriceFeedComboBoxItemProperty.set(itemOptional.get());
|
||||
} else {
|
||||
if (CurrencyUtil.isCryptoCurrency(code)) {
|
||||
CurrencyUtil.getCryptoCurrency(code).ifPresent(cryptoCurrency -> {
|
||||
preferences.addCryptoCurrency(cryptoCurrency);
|
||||
fillPriceFeedComboBoxItems();
|
||||
});
|
||||
String code = priceFeedService.currencyCodeProperty().get();
|
||||
Optional<PriceFeedComboBoxItem> itemOptional = findPriceFeedComboBoxItem(code);
|
||||
if (itemOptional.isPresent()) {
|
||||
itemOptional.get().setDisplayString(newValue);
|
||||
selectedPriceFeedComboBoxItemProperty.set(itemOptional.get());
|
||||
} else {
|
||||
CurrencyUtil.getTraditionalCurrency(code).ifPresent(traditionalCurrency -> {
|
||||
preferences.addTraditionalCurrency(traditionalCurrency);
|
||||
fillPriceFeedComboBoxItems();
|
||||
});
|
||||
if (CurrencyUtil.isCryptoCurrency(code)) {
|
||||
CurrencyUtil.getCryptoCurrency(code).ifPresent(cryptoCurrency -> {
|
||||
preferences.addCryptoCurrency(cryptoCurrency);
|
||||
fillPriceFeedComboBoxItems();
|
||||
});
|
||||
} else {
|
||||
CurrencyUtil.getTraditionalCurrency(code).ifPresent(traditionalCurrency -> {
|
||||
preferences.addTraditionalCurrency(traditionalCurrency);
|
||||
fillPriceFeedComboBoxItems();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedPriceFeedComboBoxItemProperty.get() != null)
|
||||
selectedPriceFeedComboBoxItemProperty.get().setDisplayString(newValue);
|
||||
}
|
||||
if (selectedPriceFeedComboBoxItemProperty.get() != null)
|
||||
selectedPriceFeedComboBoxItemProperty.get().setDisplayString(newValue);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
marketPriceCurrencyCode.bind(priceFeedService.currencyCodeProperty());
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package haveno.desktop.main.shared;
|
||||
|
||||
import haveno.common.UserThread;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import lombok.Getter;
|
||||
|
@ -38,6 +37,6 @@ public class PriceFeedComboBoxItem {
|
|||
}
|
||||
|
||||
public void setDisplayString(String displayString) {
|
||||
UserThread.execute(() -> this.displayStringProperty.set(displayString));
|
||||
this.displayStringProperty.set(displayString);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue