Search in sources :

Example 56 with Preferences

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);
}
Also used : ColumnStyle(jgnash.ui.report.jasper.ColumnStyle) Arrays(java.util.Arrays) Transaction(jgnash.engine.Transaction) LocalDateTime(java.time.LocalDateTime) ResourceUtils(jgnash.util.ResourceUtils) FXCollections(javafx.collections.FXCollections) TransactionEntry(jgnash.engine.TransactionEntry) AccountComboBox(jgnash.uifx.control.AccountComboBox) BigDecimal(java.math.BigDecimal) ColumnHeaderStyle(jgnash.ui.report.jasper.ColumnHeaderStyle) Nullable(jgnash.util.Nullable) ResourceBundle(java.util.ResourceBundle) Locale(java.util.Locale) InvestmentTransaction(jgnash.engine.InvestmentTransaction) AccountType(jgnash.engine.AccountType) CurrencyNode(jgnash.engine.CurrencyNode) ReconciledState(jgnash.engine.ReconciledState) DateUtils(jgnash.time.DateUtils) JasperPrint(net.sf.jasperreports.engine.JasperPrint) TextField(javafx.scene.control.TextField) Predicate(java.util.function.Predicate) FilteredList(javafx.collections.transformation.FilteredList) CheckBox(javafx.scene.control.CheckBox) RegisterFactory(jgnash.uifx.views.register.RegisterFactory) Collectors(java.util.stream.Collectors) Preferences(java.util.prefs.Preferences) AccountGroup(jgnash.engine.AccountGroup) TransactionType(jgnash.engine.TransactionType) FXML(javafx.fxml.FXML) List(java.util.List) Row(jgnash.ui.report.Row) LocalDate(java.time.LocalDate) Account(jgnash.engine.Account) ObservableList(javafx.collections.ObservableList) AbstractReportTableModel(jgnash.ui.report.jasper.AbstractReportTableModel) ChangeListener(javafx.beans.value.ChangeListener) DatePickerEx(jgnash.uifx.control.DatePickerEx) DynamicJasperReport(jgnash.uifx.report.jasper.DynamicJasperReport) Preferences(java.util.prefs.Preferences) FXML(javafx.fxml.FXML)

Example 57 with Preferences

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();
    }
}
Also used : Preferences(java.util.prefs.Preferences)

Example 58 with Preferences

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);
}
Also used : Scene(javafx.scene.Scene) Engine(jgnash.engine.Engine) EngineFactory(jgnash.engine.EngineFactory) ResourceUtils(jgnash.util.ResourceUtils) StackPane(javafx.scene.layout.StackPane) XYChart(javafx.scene.chart.XYChart) NumberFormat(java.text.NumberFormat) BigDecimal(java.math.BigDecimal) ResourceBundle(java.util.ResourceBundle) ComboBox(javafx.scene.control.ComboBox) AccountType(jgnash.engine.AccountType) Tooltip(javafx.scene.control.Tooltip) CurrencyNode(jgnash.engine.CurrencyNode) DateUtils(jgnash.time.DateUtils) ObjectProperty(javafx.beans.property.ObjectProperty) InjectFXML(jgnash.uifx.util.InjectFXML) FXMLUtils(jgnash.uifx.util.FXMLUtils) BarChart(javafx.scene.chart.BarChart) Preferences(java.util.prefs.Preferences) Objects(java.util.Objects) Platform(javafx.application.Platform) FXML(javafx.fxml.FXML) List(java.util.List) CommodityFormat(jgnash.text.CommodityFormat) Stage(javafx.stage.Stage) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) LocalDate(java.time.LocalDate) CustomCursor(jgnash.resource.cursor.CustomCursor) Account(jgnash.engine.Account) ReportPeriodUtils(jgnash.report.ReportPeriodUtils) ChangeListener(javafx.beans.value.ChangeListener) ReportPeriod(jgnash.report.ReportPeriod) DatePickerEx(jgnash.uifx.control.DatePickerEx) Options(jgnash.uifx.Options) Preferences(java.util.prefs.Preferences) Engine(jgnash.engine.Engine) InjectFXML(jgnash.uifx.util.InjectFXML) FXML(javafx.fxml.FXML)

Example 59 with Preferences

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();
}
Also used : Stage(javafx.stage.Stage) Preferences(java.util.prefs.Preferences) InjectFXML(jgnash.uifx.util.InjectFXML) FXML(javafx.fxml.FXML)

Example 60 with Preferences

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);
}
Also used : Preferences(java.util.prefs.Preferences)

Aggregations

Preferences (java.util.prefs.Preferences)291 BackingStoreException (java.util.prefs.BackingStoreException)49 File (java.io.File)45 ResourceBundle (java.util.ResourceBundle)24 FileChooser (javafx.stage.FileChooser)21 ArrayList (java.util.ArrayList)17 FXML (javafx.fxml.FXML)16 IOException (java.io.IOException)14 JFileChooser (javax.swing.JFileChooser)12 List (java.util.List)8 SwingWorker (javax.swing.SwingWorker)8 FileNameExtensionFilter (javax.swing.filechooser.FileNameExtensionFilter)7 Engine (jgnash.engine.Engine)7 AutoCompletePreferences (org.jabref.logic.autocompleter.AutoCompletePreferences)6 FieldContentParserPreferences (org.jabref.logic.bibtex.FieldContentParserPreferences)6 LatexFieldFormatterPreferences (org.jabref.logic.bibtex.LatexFieldFormatterPreferences)6 BibtexKeyPatternPreferences (org.jabref.logic.bibtexkeypattern.BibtexKeyPatternPreferences)6 CleanupPreferences (org.jabref.logic.cleanup.CleanupPreferences)6 ImportFormatPreferences (org.jabref.logic.importer.ImportFormatPreferences)6 JournalAbbreviationPreferences (org.jabref.logic.journals.JournalAbbreviationPreferences)6