use of java.util.prefs.Preferences in project jgnash by ccavanaugh.
the class AccountRegisterReportController method initialize.
@FXML
private void initialize() {
final Preferences preferences = getPreferences();
showSplitsCheckBox.setSelected(preferences.getBoolean(SHOW_SPLITS, false));
showTimestampCheckBox.setSelected(preferences.getBoolean(SHOW_TIMESTAMP, false));
accountComboBox.valueProperty().addListener((observable, oldValue, newValue) -> {
refreshAccount(newValue);
handleRefresh();
});
final ChangeListener<Object> refreshListener = (observable, oldValue, newValue) -> handleRefresh();
showSplitsCheckBox.selectedProperty().addListener(refreshListener);
startDatePicker.valueProperty().addListener(refreshListener);
endDatePicker.valueProperty().addListener(refreshListener);
payeeFilterTextField.textProperty().addListener(refreshListener);
memoFilterTextField.textProperty().addListener(refreshListener);
showTimestampCheckBox.selectedProperty().addListener(refreshListener);
}
use of java.util.prefs.Preferences in project jgnash by ccavanaugh.
the class AccountRegisterReportController method handleRefresh.
private void handleRefresh() {
final Preferences preferences = getPreferences();
preferences.putBoolean(SHOW_SPLITS, showSplitsCheckBox.isSelected());
preferences.putBoolean(SHOW_TIMESTAMP, showTimestampCheckBox.isSelected());
if (refreshCallBackProperty().get() != null) {
refreshCallBackProperty().get().run();
}
}
use of java.util.prefs.Preferences in project jgnash by ccavanaugh.
the class IncomeExpenseBarChartDialogController method initialize.
@FXML
public void initialize() {
final Preferences preferences = Preferences.userNodeForPackage(IncomeExpenseBarChartDialogController.class).node("IncomeExpenseBarChart");
final Engine engine = EngineFactory.getEngine(EngineFactory.DEFAULT);
Objects.requireNonNull(engine);
periodComboBox.getItems().addAll(ReportPeriod.values());
periodComboBox.setValue(ReportPeriod.values()[preferences.getInt(REPORT_PERIOD, ReportPeriod.MONTHLY.ordinal())]);
defaultCurrency = engine.getDefaultCurrency();
numberFormat = CommodityFormat.getFullNumberFormat(defaultCurrency);
barChart.getStylesheets().addAll(CHART_CSS);
barChart.getYAxis().setLabel(defaultCurrency.getSymbol());
barChart.barGapProperty().set(BAR_GAP);
barChart.setCategoryGap(PERIOD_GAP);
// Respect animation preference
barChart.animatedProperty().set(Options.animationsEnabledProperty().get());
startDatePicker.setValue(DateUtils.getFirstDayOfTheMonth(endDatePicker.getValue().minusMonths(11)));
final ChangeListener<Object> listener = (observable, oldValue, newValue) -> {
if (newValue != null) {
Platform.runLater(this::updateChart);
}
};
startDatePicker.valueProperty().addListener(listener);
endDatePicker.valueProperty().addListener(listener);
periodComboBox.valueProperty().addListener((observable, oldValue, newValue) -> {
preferences.putInt(REPORT_PERIOD, newValue.ordinal());
Platform.runLater(this::updateChart);
});
// Push the initial load to the end of the platform thread for better startup and a nicer visual effect
Platform.runLater(this::updateChart);
}
use of java.util.prefs.Preferences in project jgnash by ccavanaugh.
the class RemoteConnectionDialogController method handleOkAction.
@FXML
private void handleOkAction() {
result = true;
final Preferences preferences = Preferences.userNodeForPackage(RemoteConnectionDialogController.class);
preferences.put(LAST_HOST, hostTextField.getText());
preferences.putInt(LAST_PORT, portTextField.getInteger());
((Stage) parent.get().getWindow()).close();
}
use of java.util.prefs.Preferences in project jgnash by ccavanaugh.
the class ReportFactory method setProportionalFont.
/**
* Sets the name of the proportional spaced font to use
*
* @param font font name to use
*/
public static void setProportionalFont(final String font) {
Preferences p = Preferences.userNodeForPackage(ReportFactory.class);
p.put(PROPORTIONAL, font);
}
Aggregations