List of usage examples for java.util.prefs Preferences userRoot
public static Preferences userRoot()
From source file:org.pdfsam.context.DefaultUserContext.java
private DefaultUserContext() { this.prefs = Preferences.userRoot().node("/pdfsam/user/conf"); this.workspaces = new PreferencesUserWorkspacesContext(); }
From source file:org.keyboardplaying.xtt.configuration.PreferencesHelper.java
/** Creates a new instance. */ public PreferencesHelper() { Preferences prefRoot = Preferences.userRoot(); try {/*from ww w .j a v a2 s . com*/ initialized = prefRoot.nodeExists(NODE); } catch (BackingStoreException e) { LOG.error("The preferences store could not be loaded. Preferences will not be saved.", e); initialized = false; } preferences = prefRoot.node(NODE); }
From source file:org.pdfsam.ui.DefaultStageService.java
public void save(StageStatus status) { Preferences node = Preferences.userRoot().node(STAGE_PATH); try {//w w w . j a v a 2s . c o m node.put(STAGE_STATUS_KEY, JSON.std.asString(status)); LOG.trace("Stage status saved {}", status); } catch (IOException e) { LOG.error("Unable to increment modules usage statistics", e); } }
From source file:org.pdfsam.ui.DefaultStageServiceTest.java
@Test public void save() throws JSONObjectException, IOException { StageStatus status = new StageStatus(10, 20, 100, 200); victim.save(status);//from ww w. jav a2s . co m StageStatus storedStatus = JSON.std.beanFrom(StageStatus.class, Preferences.userRoot() .node(DefaultStageService.STAGE_PATH).get(DefaultStageService.STAGE_STATUS_KEY, "")); assertEquals(status, storedStatus); }
From source file:de.maklerpoint.office.Tags.Tags.java
/** * //from w w w. j a v a 2s. c o m * @param tag * @param oldname */ public static void updateTag(TagObj tag, String oldname) { Preferences prefs = Preferences.userRoot().node(Tags.class.getName()); String taglist = prefs.get("tagListe", "Standard,ffentlich,Wichtig,Dienstlich,Persnlich"); String[] result = taglist.split(","); if (result == null) { return; } boolean contains = ArrayUtils.contains(result, tag.getName()); if (contains) { prefs.put("tag" + tag.getName(), tag.getTagColor() + "," + tag.getFontColor()); InitializeTags.loadTags(); } else { Tags.removeTag(oldname); addTag(tag); } }
From source file:jobhunter.controllers.PreferencesController.java
private PreferencesController() { this.current = ApplicationState.isDevelopment() ? Preferences.userRoot().node("jobhunter-dev") : Preferences.userRoot().node("jobhunter"); }
From source file:org.pdfsam.module.PreferencesUsageDataStoreTest.java
@Test public void incrementUsageFor() throws JSONObjectException, IOException { victim.incrementUsageFor("moduleId"); ModuleUsage usage = JSON.std.beanFrom(ModuleUsage.class, Preferences.userRoot().node(PreferencesUsageDataStore.USAGE_PATH).node("moduleId") .get(PreferencesUsageDataStore.MODULE_USAGE_KEY, "")); assertEquals(1, usage.getTotalUsed()); assertTrue(usage.getLastSeen() != 0); }
From source file:org.pdfsam.module.PreferencesUsageDataStore.java
@PreDestroy public void flush() { Preferences prefs = Preferences.userRoot().node(USAGE_PATH); try {// www . j av a2 s . com LOG.trace("Flushing modules usage"); prefs.flush(); } catch (BackingStoreException e) { LOG.error("Unable to flush modules usage statistics", e); } }
From source file:org.pdfsam.ui.StatefullPreferencesStageService.java
@PreDestroy void flush() {//from w w w . j av a 2s . co m Preferences prefs = Preferences.userRoot().node(STAGE_PATH); try { LOG.trace("Flushing stage information"); prefs.flush(); } catch (BackingStoreException e) { LOG.error("Unable to stage status information", e); } }
From source file:org.pdfsam.ui.StatefullPreferencesStageServiceTest.java
@Test public void save() throws JSONObjectException, IOException { StageStatus status = new StageStatus(10, 20, 100, 200); victim.save(status);//from ww w . ja v a 2s .co m StageStatus storedStatus = JSON.std.beanFrom(StageStatus.class, Preferences.userRoot().node(StatefullPreferencesStageService.STAGE_PATH) .get(StatefullPreferencesStageService.STAGE_STATUS_KEY, "")); assertEquals(status, storedStatus); }