Search in sources :

Example 46 with Preferences

use of java.util.prefs.Preferences in project jgnash by ccavanaugh.

the class ThemeManager method getNimbusFontSize.

public static int getNimbusFontSize() {
    Preferences p = Preferences.userNodeForPackage(ThemeManager.class);
    int preferredSize = p.getInt(NIMBUS_FONT_SIZE, 0);
    // and save it
    if (preferredSize == 0) {
        LookAndFeel old = UIManager.getLookAndFeel();
        try {
            UIManager.setLookAndFeel(new NimbusLookAndFeel());
            preferredSize = NimbusUtils.getBaseFontSize();
            p.putInt(NIMBUS_FONT_SIZE, preferredSize);
            UIManager.setLookAndFeel(old);
        } catch (Exception e) {
            Logger.getLogger(ThemeManager.class.getName()).log(Level.SEVERE, e.toString(), e);
        }
    }
    return preferredSize;
}
Also used : NimbusLookAndFeel(javax.swing.plaf.nimbus.NimbusLookAndFeel) Preferences(java.util.prefs.Preferences) LookAndFeel(javax.swing.LookAndFeel) NimbusLookAndFeel(javax.swing.plaf.nimbus.NimbusLookAndFeel) SubstanceLookAndFeel(org.pushingpixels.substance.api.SubstanceLookAndFeel) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel) UnsupportedLookAndFeelException(javax.swing.UnsupportedLookAndFeelException)

Example 47 with Preferences

use of java.util.prefs.Preferences in project jgnash by ccavanaugh.

the class ThemeManager method setSubstanceAnimationsEnabled.

public static void setSubstanceAnimationsEnabled(final boolean enabled) {
    Preferences p = Preferences.userNodeForPackage(ThemeManager.class);
    p.putBoolean(SUBSTANCE_ANIMATIONS, enabled);
    if (enabled) {
        AnimationConfigurationManager.getInstance().setTimelineDuration(animationDuration);
    } else {
        AnimationConfigurationManager.getInstance().setTimelineDuration(0);
    }
}
Also used : Preferences(java.util.prefs.Preferences)

Example 48 with Preferences

use of java.util.prefs.Preferences in project jgnash by ccavanaugh.

the class ExportTransactionsAction method exportTransactions.

public static void exportTransactions(final Account account, final LocalDate startDate, final LocalDate endDate) {
    final ResourceBundle rb = ResourceUtils.getBundle();
    final Preferences pref = Preferences.userNodeForPackage(ExportTransactionsAction.class);
    JFileChooser chooser = new JFileChooser(pref.get(CURRENT_DIR, null));
    FileNameExtensionFilter csvFilter = new FileNameExtensionFilter(rb.getString("Label.CsvFiles") + " (*.csv)", "csv");
    FileNameExtensionFilter ofxFilter = new FileNameExtensionFilter(rb.getString("Label.OfxFiles") + " (*.ofx)", OFX);
    FileNameExtensionFilter ssFilter = new FileNameExtensionFilter(rb.getString("Label.SpreadsheetFiles") + " (*.xls, *.xlsx)", "xls", "xlsx");
    chooser.addChoosableFileFilter(csvFilter);
    chooser.addChoosableFileFilter(ofxFilter);
    chooser.addChoosableFileFilter(ssFilter);
    chooser.setAcceptAllFileFilterUsed(false);
    chooser.setMultiSelectionEnabled(false);
    chooser.setFileFilter(csvFilter);
    if (chooser.showSaveDialog(UIApplication.getFrame()) == JFileChooser.APPROVE_OPTION) {
        pref.put(CURRENT_DIR, chooser.getCurrentDirectory().getAbsolutePath());
        final File file = chooser.getSelectedFile();
        final class Export extends SwingWorker<Void, Void> {

            @Override
            protected Void doInBackground() throws Exception {
                UIApplication.getFrame().displayWaitMessage(rb.getString("Message.PleaseWait"));
                if (OFX.equals(FileUtils.getFileExtension(file.getName()))) {
                    OfxExport export = new OfxExport(account, startDate, endDate, file);
                    export.exportAccount();
                } else if (FileUtils.getFileExtension(file.getName()).contains(XLS)) {
                    AccountExport.exportAccount(account, RegisterFactory.getColumnNames(account), startDate, endDate, file);
                } else {
                    CsvExport.exportAccount(account, startDate, endDate, file);
                }
                return null;
            }

            @Override
            protected void done() {
                UIApplication.getFrame().stopWaitMessage();
            }
        }
        new Export().execute();
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) SwingWorker(javax.swing.SwingWorker) CsvExport(jgnash.convert.exports.csv.CsvExport) AccountExport(jgnash.convert.exports.ssf.AccountExport) OfxExport(jgnash.convert.exports.ofx.OfxExport) ResourceBundle(java.util.ResourceBundle) OfxExport(jgnash.convert.exports.ofx.OfxExport) Preferences(java.util.prefs.Preferences) FileNameExtensionFilter(javax.swing.filechooser.FileNameExtensionFilter) File(java.io.File)

Example 49 with Preferences

use of java.util.prefs.Preferences in project jgnash by ccavanaugh.

the class ThemeManager method setNimbusFontSize.

public static void setNimbusFontSize(final int size) {
    Preferences p = Preferences.userNodeForPackage(ThemeManager.class);
    p.putInt(NIMBUS_FONT_SIZE, size);
}
Also used : Preferences(java.util.prefs.Preferences)

Example 50 with Preferences

use of java.util.prefs.Preferences in project jgnash by ccavanaugh.

the class MainFrame method setRegisterFollowsTree.

public static void setRegisterFollowsTree(final boolean follow) {
    Preferences pref = Preferences.userNodeForPackage(MainFrame.class);
    registerFollowsTree = follow;
    pref.putBoolean(REGISTER_FOLLOWS_LIST, follow);
}
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