mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-19 07:15:54 -04:00
Cleanup
This commit is contained in:
parent
8d5cdf8d1f
commit
60102661ff
@ -38,15 +38,16 @@ class ApplicationPreferencesModel extends UIModel {
|
||||
|
||||
private final ApplicationPreferences applicationPreferences;
|
||||
|
||||
private final ChangeListener<Boolean> useAnimationsListener;
|
||||
private final ChangeListener<Boolean> useEffectsListener;
|
||||
private final ChangeListener<String> btcDenominationListener;
|
||||
|
||||
final ObservableList<String> btcDenominations;
|
||||
|
||||
final BooleanProperty useAnimations = new SimpleBooleanProperty();
|
||||
final BooleanProperty useEffects = new SimpleBooleanProperty();
|
||||
final StringProperty btcDenomination = new SimpleStringProperty();
|
||||
|
||||
private ChangeListener<Boolean> useAnimationsListener;
|
||||
private ChangeListener<Boolean> useEffectsListener;
|
||||
private ChangeListener<String> btcDenominationListener;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
@ -57,6 +58,9 @@ class ApplicationPreferencesModel extends UIModel {
|
||||
this.applicationPreferences = applicationPreferences;
|
||||
|
||||
btcDenominations = FXCollections.observableArrayList(applicationPreferences.getBtcDenominations());
|
||||
btcDenominationListener = (ov, oldValue, newValue) -> applicationPreferences.setBtcDenomination(newValue);
|
||||
useAnimationsListener = (ov, oldValue, newValue) -> applicationPreferences.setUseAnimations(newValue);
|
||||
useEffectsListener = (ov, oldValue, newValue) -> applicationPreferences.setUseEffects(newValue);
|
||||
}
|
||||
|
||||
|
||||
@ -64,17 +68,10 @@ class ApplicationPreferencesModel extends UIModel {
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@SuppressWarnings("EmptyMethod")
|
||||
@Override
|
||||
public void initialize() {
|
||||
|
||||
super.initialize();
|
||||
|
||||
useAnimationsListener = (ov, oldValue, newValue) -> applicationPreferences
|
||||
.setUseAnimations(newValue);
|
||||
useEffectsListener = (ov, oldValue, newValue) -> applicationPreferences
|
||||
.setUseEffects(newValue);
|
||||
btcDenominationListener = (ov, oldValue, newValue) -> applicationPreferences
|
||||
.setBtcDenomination(newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -88,7 +85,6 @@ class ApplicationPreferencesModel extends UIModel {
|
||||
useAnimations.addListener(useAnimationsListener);
|
||||
useEffects.addListener(useEffectsListener);
|
||||
btcDenomination.addListener(btcDenominationListener);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -106,6 +102,5 @@ class ApplicationPreferencesModel extends UIModel {
|
||||
super.terminate();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -46,12 +46,13 @@ public class ApplicationPreferencesPM extends PresentationModel<ApplicationPrefe
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@SuppressWarnings("EmptyMethod")
|
||||
@Override
|
||||
public void initialize() {
|
||||
|
||||
super.initialize();
|
||||
}
|
||||
|
||||
@SuppressWarnings("EmptyMethod")
|
||||
@Override
|
||||
public void activate() {
|
||||
super.activate();
|
||||
@ -69,6 +70,16 @@ public class ApplicationPreferencesPM extends PresentationModel<ApplicationPrefe
|
||||
super.terminate();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public ObservableList<String> getBtcDenominationItems() {
|
||||
return model.btcDenominations;
|
||||
}
|
||||
@ -86,16 +97,6 @@ public class ApplicationPreferencesPM extends PresentationModel<ApplicationPrefe
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -31,7 +31,7 @@
|
||||
<padding>
|
||||
<Insets bottom="-10.0" left="25.0" top="30.0" right="25"/>
|
||||
</padding>
|
||||
|
||||
|
||||
<TitledGroupBg text="General application preferences" GridPane.rowSpan="8"/>
|
||||
|
||||
<Label text="Bitcoin denomination" GridPane.rowIndex="0">
|
||||
@ -55,7 +55,6 @@
|
||||
<CheckBox fx:id="useEffectsCheckBox"
|
||||
GridPane.columnIndex="1" GridPane.rowIndex="2"/>
|
||||
|
||||
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="200.0"/>
|
||||
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
|
||||
|
@ -38,7 +38,6 @@ public class ApplicationPreferencesViewCB extends CachedViewCB<ApplicationPrefer
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ApplicationPreferencesViewCB.class);
|
||||
|
||||
|
||||
@FXML ComboBox<String> btcDenominationComboBox;
|
||||
@FXML CheckBox useAnimationsCheckBox, useEffectsCheckBox;
|
||||
|
||||
@ -68,6 +67,7 @@ public class ApplicationPreferencesViewCB extends CachedViewCB<ApplicationPrefer
|
||||
|
||||
btcDenominationComboBox.setItems(presentationModel.getBtcDenominationItems());
|
||||
btcDenominationComboBox.getSelectionModel().select(presentationModel.btcDenomination().get());
|
||||
|
||||
useAnimationsCheckBox.selectedProperty().bindBidirectional(presentationModel.useAnimations());
|
||||
useEffectsCheckBox.selectedProperty().bindBidirectional(presentationModel.useEffects());
|
||||
|
||||
@ -76,6 +76,9 @@ public class ApplicationPreferencesViewCB extends CachedViewCB<ApplicationPrefer
|
||||
@Override
|
||||
public void deactivate() {
|
||||
super.deactivate();
|
||||
|
||||
useAnimationsCheckBox.selectedProperty().unbind();
|
||||
useEffectsCheckBox.selectedProperty().unbind();
|
||||
}
|
||||
|
||||
@SuppressWarnings("EmptyMethod")
|
||||
@ -93,5 +96,4 @@ public class ApplicationPreferencesViewCB extends CachedViewCB<ApplicationPrefer
|
||||
void onSelectBtcDenomination() {
|
||||
presentationModel.btcDenomination().set(btcDenominationComboBox.getSelectionModel().getSelectedItem());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -76,22 +76,18 @@ public class ApplicationPreferences implements Serializable {
|
||||
if (data instanceof String) {
|
||||
btcDenominationString = (String) data;
|
||||
this.btcDenomination.set(btcDenominationString);
|
||||
log.debug(data.toString());
|
||||
}
|
||||
|
||||
data = persistence.read(this, "useEffects");
|
||||
if (data instanceof Boolean) {
|
||||
useEffectsBoolean = (Boolean) data;
|
||||
this.useEffects.set(useEffectsBoolean);
|
||||
|
||||
log.debug(data.toString());
|
||||
}
|
||||
|
||||
data = persistence.read(this, "useAnimations");
|
||||
if (data instanceof Boolean) {
|
||||
useAnimationsBoolean = (Boolean) data;
|
||||
this.useAnimations.set(useAnimationsBoolean);
|
||||
log.debug(data.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user