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;
}
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);
}
}
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();
}
}
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);
}
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);
}
Aggregations