From dd8d300496cc1791132f643f30e4211b6998247a Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Tue, 12 Apr 2016 01:30:03 +0200 Subject: [PATCH] Make "Show all" default --- .../gui/main/offer/offerbook/OfferBookView.java | 2 ++ .../gui/main/offer/offerbook/OfferBookViewModel.java | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookView.java b/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookView.java index b659046084..b052c96a3d 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookView.java @@ -170,6 +170,8 @@ public class OfferBookView extends ActivatableViewAndModel o1.getOffer().getPaymentMethod().compareTo(o2.getOffer().getPaymentMethod())); avatarColumn.setComparator((o1, o2) -> o1.getOffer().getOwnerNodeAddress().hostName.compareTo(o2.getOffer().getOwnerNodeAddress().hostName)); + priceColumn.sortableProperty().bind(model.showAllTradeCurrenciesProperty.not()); + createOfferButton = addButton(root, ++gridRow, ""); createOfferButton.setMinHeight(40); createOfferButton.setPadding(new Insets(0, 20, 0, 20)); diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookViewModel.java b/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookViewModel.java index 1878fa5773..00640c0c6f 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookViewModel.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/offerbook/OfferBookViewModel.java @@ -89,11 +89,12 @@ class OfferBookViewModel extends ActivatableViewModel { // If id is empty string we ignore filter (display all methods) PaymentMethod selectedPaymentMethod = new PaymentMethod(SHOW_ALL_FLAG, 0, 0, null); + private CryptoCurrency showAllCurrenciesItem = new CryptoCurrency(SHOW_ALL_FLAG, SHOW_ALL_FLAG); private final ObservableList offerBookListItems; private final ListChangeListener listChangeListener; private boolean isTabSelected; - final BooleanProperty showAllTradeCurrenciesProperty = new SimpleBooleanProperty(); + final BooleanProperty showAllTradeCurrenciesProperty = new SimpleBooleanProperty(true); boolean showAllPaymentMethods = true; @@ -152,7 +153,7 @@ class OfferBookViewModel extends ActivatableViewModel { private void fillAllTradeCurrencies() { allTradeCurrencies.clear(); // Used for ignoring filter (show all) - allTradeCurrencies.add(new CryptoCurrency(SHOW_ALL_FLAG, SHOW_ALL_FLAG)); + allTradeCurrencies.add(showAllCurrenciesItem); allTradeCurrencies.addAll(preferences.getTradeCurrenciesAsObservable()); allTradeCurrencies.add(new CryptoCurrency(EDIT_FLAG, EDIT_FLAG)); } @@ -186,10 +187,11 @@ class OfferBookViewModel extends ActivatableViewModel { public void onSetTradeCurrency(TradeCurrency tradeCurrency) { String code = tradeCurrency.getCode(); - showAllTradeCurrenciesProperty.set(isShowAllEntry(code)); + boolean showAllEntry = isShowAllEntry(code); + showAllTradeCurrenciesProperty.set(showAllEntry); if (isEditEntry(code)) navigation.navigateTo(MainView.class, SettingsView.class, PreferencesView.class); - else if (!showAllTradeCurrenciesProperty.get()) { + else if (!showAllEntry) { this.selectedTradeCurrency = tradeCurrency; tradeCurrencyCode.set(code); }