Rename usage of settings to applicationPreferences

This commit is contained in:
Manfred Karrer 2014-11-11 18:49:32 +01:00
parent 33085b5c2c
commit eb0bd4a99a
7 changed files with 30 additions and 29 deletions

View file

@ -35,7 +35,7 @@ import javafx.scene.control.*;
// TODO Arbitration is very basic yet
public class ArbitratorProfileViewCB extends CachedViewCB {
private final ApplicationPreferences settings;
private final ApplicationPreferences applicationPreferences;
private final Persistence persistence;
private final BSFormatter formatter;
@ -53,12 +53,14 @@ public class ArbitratorProfileViewCB extends CachedViewCB {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public ArbitratorProfileViewCB(ApplicationPreferences settings, Persistence persistence, BSFormatter formatter) {
this.settings = settings;
public ArbitratorProfileViewCB(ApplicationPreferences applicationPreferences, Persistence persistence,
BSFormatter formatter) {
this.applicationPreferences = applicationPreferences;
this.persistence = persistence;
// Settings persistedSettings = (Settings) storage.read(settings.getClass().getName());
// settings.applyPersistedSettings(persistedSettings);
// ApplicationPreferences persistedApplicationPreferences = (ApplicationPreferences) storage
// .read(settings.getClass().getName());
// settings.applyPersistedSettings(persistedApplicationPreferences);
this.formatter = formatter;
}

View file

@ -327,7 +327,6 @@ public class ArbitratorRegistrationViewCB extends CachedViewCB {
@FXML
public void onPaymentDone() {
//To change body of created methods use File | Settings | File Templates.
}

View file

@ -42,7 +42,7 @@ public class PreferencesViewCB extends CachedViewCB {
private static final Logger log = LoggerFactory.getLogger(PreferencesViewCB.class);
private final Navigation navigation;
private ApplicationPreferences settings;
private ApplicationPreferences applicationPreferences;
private Navigation.Listener navigationListener;
private ChangeListener<Tab> tabChangeListener;
@ -55,11 +55,11 @@ public class PreferencesViewCB extends CachedViewCB {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
PreferencesViewCB(Navigation navigation, ApplicationPreferences settings) {
PreferencesViewCB(Navigation navigation, ApplicationPreferences applicationPreferences) {
super();
this.navigation = navigation;
this.settings = settings;
this.applicationPreferences = applicationPreferences;
}

View file

@ -56,7 +56,7 @@ class OfferBookModel extends UIModel {
private final User user;
private final OfferBook offerBook;
private final ApplicationPreferences settings;
private final ApplicationPreferences applicationPreferences;
private final BSFormatter formatter;
private final TradeManager tradeManager;
@ -85,12 +85,12 @@ class OfferBookModel extends UIModel {
OfferBookModel(User user,
TradeManager tradeManager,
OfferBook offerBook,
ApplicationPreferences settings,
ApplicationPreferences applicationPreferences,
BSFormatter formatter) {
this.tradeManager = tradeManager;
this.user = user;
this.offerBook = offerBook;
this.settings = settings;
this.applicationPreferences = applicationPreferences;
this.formatter = formatter;
filteredItems = new FilteredList<>(offerBook.getOfferBookListItems());
@ -119,7 +119,7 @@ class OfferBookModel extends UIModel {
offerBook.addClient();
user.currentBankAccountProperty().addListener(bankAccountChangeListener);
btcCode.bind(settings.btcDenominationProperty());
btcCode.bind(applicationPreferences.btcDenominationProperty());
setBankAccount(user.getCurrentBankAccount());
applyFilter();
@ -199,7 +199,7 @@ class OfferBookModel extends UIModel {
// we might get rid of languages (handles viy arbitrators)
/*
// disjoint returns true if the two specified collections have no elements in common.
boolean languageResult = !Collections.disjoint(settings.getAcceptedLanguageLocales(),
boolean languageResult = !Collections.disjoint(applicationPreferences.getAcceptedLanguageLocales(),
offer.getAcceptedLanguageLocales());
if (!languageResult)
restrictionsInfo.set("This offer requires that the payments account resides in one of those languages:\n" +
@ -207,7 +207,7 @@ class OfferBookModel extends UIModel {
"\n\nThe country of your payments account (" + user.getCurrentBankAccount().getCountry().getName() +
") is not included in that list.");
boolean arbitratorResult = !Collections.disjoint(settings.getAcceptedArbitrators(),
boolean arbitratorResult = !Collections.disjoint(applicationPreferences.getAcceptedArbitrators(),
offer.getArbitrators());*/
return countryResult;

View file

@ -56,7 +56,7 @@ class TakeOfferModel extends UIModel {
private final TradeManager tradeManager;
private final WalletFacade walletFacade;
private final ApplicationPreferences settings;
private final ApplicationPreferences applicationPreferences;
private final Persistence persistence;
private Offer offer;
@ -83,11 +83,11 @@ class TakeOfferModel extends UIModel {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
TakeOfferModel(TradeManager tradeManager, WalletFacade walletFacade, ApplicationPreferences settings,
TakeOfferModel(TradeManager tradeManager, WalletFacade walletFacade, ApplicationPreferences applicationPreferences,
Persistence persistence) {
this.tradeManager = tradeManager;
this.walletFacade = walletFacade;
this.settings = settings;
this.applicationPreferences = applicationPreferences;
this.persistence = persistence;
}
@ -108,7 +108,7 @@ class TakeOfferModel extends UIModel {
public void activate() {
super.activate();
btcCode.bind(settings.btcDenominationProperty());
btcCode.bind(applicationPreferences.btcDenominationProperty());
}
@SuppressWarnings("EmptyMethod")

View file

@ -40,16 +40,16 @@ public class Transitions {
public final static int DEFAULT_DURATION = 400;
private ApplicationPreferences settings;
private ApplicationPreferences applicationPreferences;
private Timeline removeBlurTimeLine;
@Inject
public Transitions(ApplicationPreferences settings) {
this.settings = settings;
public Transitions(ApplicationPreferences applicationPreferences) {
this.applicationPreferences = applicationPreferences;
}
private int evaluateDuration(int duration) {
return settings.getUseAnimations() ? duration : 1;
return applicationPreferences.getUseAnimations() ? duration : 1;
}
// Fade
@ -58,7 +58,7 @@ public class Transitions {
}
public void fadeIn(Node node, int duration) {
if (settings.getUseEffects()) {
if (applicationPreferences.getUseEffects()) {
FadeTransition fade = new FadeTransition(Duration.millis(evaluateDuration(duration)), node);
fade.setFromValue(node.getOpacity());
fade.setToValue(1.0);
@ -71,7 +71,7 @@ public class Transitions {
}
public FadeTransition fadeOut(Node node, int duration) {
if (!settings.getUseEffects())
if (!applicationPreferences.getUseEffects())
duration = 1;
FadeTransition fade = new FadeTransition(Duration.millis(evaluateDuration(duration)), node);
@ -86,7 +86,7 @@ public class Transitions {
}
public void fadeOutAndRemove(Node node, int duration) {
if (!settings.getUseEffects())
if (!applicationPreferences.getUseEffects())
duration = 1;
FadeTransition fade = fadeOut(node, evaluateDuration(duration));
@ -103,7 +103,7 @@ public class Transitions {
}
public void blur(Node node, int duration, boolean useDarken, boolean removeNode) {
if (settings.getUseEffects()) {
if (applicationPreferences.getUseEffects()) {
if (removeBlurTimeLine != null)
removeBlurTimeLine.stop();
@ -136,7 +136,7 @@ public class Transitions {
}
public void removeBlur(Node node, int duration, boolean useDarken) {
if (settings.getUseEffects()) {
if (applicationPreferences.getUseEffects()) {
if (node != null) {
GaussianBlur blur = (GaussianBlur) node.getEffect();
if (blur != null) {

View file

@ -93,7 +93,7 @@ public class Utilities {
objectOutputStream.close();
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
e.printStackTrace();
}
return result;
}