Java Code Examples for java.util.prefs.PreferenceChangeEvent#getNode()
The following examples show how to use
java.util.prefs.PreferenceChangeEvent#getNode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrefMonitorStringOpts.java From Logisim with GNU General Public License v3.0 | 6 votes |
@Override public void preferenceChange(PreferenceChangeEvent event) { Preferences prefs = event.getNode(); String prop = event.getKey(); String name = getIdentifier(); if (prop.equals(name)) { String oldValue = value; String newValue = prefs.get(name, dflt); if (!isSame(oldValue, newValue)) { String[] o = opts; String chosen = null; for (int i = 0; i < o.length; i++) { if (isSame(o[i], newValue)) { chosen = o[i]; break; } } if (chosen == null) chosen = dflt; value = chosen; AppPreferences.firePropertyChange(name, oldValue, chosen); } } }
Example 2
Source File: RecentProjects.java From Logisim with GNU General Public License v3.0 | 6 votes |
@Override public void preferenceChange(PreferenceChangeEvent event) { Preferences prefs = event.getNode(); String prop = event.getKey(); if (prop.startsWith(BASE_PROPERTY)) { String rest = prop.substring(BASE_PROPERTY.length()); int index = -1; try { index = Integer.parseInt(rest); if (index < 0 || index >= NUM_RECENT) index = -1; } catch (NumberFormatException e) { } if (index >= 0) { File oldValue = recentFiles[index]; long oldTime = recentTimes[index]; getAndDecode(prefs, index); File newValue = recentFiles[index]; long newTime = recentTimes[index]; if (!isSame(oldValue, newValue) || oldTime != newTime) { AppPreferences.firePropertyChange(AppPreferences.RECENT_PROJECTS, new FileTime(oldValue, oldTime), new FileTime(newValue, newTime)); } } } }
Example 3
Source File: FoldOptionsController.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent evt) { if (suppressPrefChanges == Boolean.TRUE) { return; } boolean ch = detectIsChanged(); MemoryPreferences defMime; synchronized (preferences) { defMime = preferences.get(""); // NOI18N } if (defMime != null && defMime.getPreferences() == evt.getNode()) { if (FoldUtilitiesImpl.PREF_CODE_FOLDING_ENABLED.equals(evt.getKey())) { // propagate to all preferences, suppress events suppressPrefChanges = true; Collection<MemoryPreferences> col; synchronized (preferences) { col = new ArrayList<>(preferences.values()); } try { for (MemoryPreferences p : col) { if (p != defMime) { if (((OverridePreferences)p.getPreferences()).isOverriden(FoldUtilitiesImpl.PREF_CODE_FOLDING_ENABLED)) { p.getPreferences().remove(FoldUtilitiesImpl.PREF_CODE_FOLDING_ENABLED); } } } } finally { suppressPrefChanges = false; } } } if (ch != changed) { propSupport.firePropertyChange(PROP_CHANGED, !ch, ch); changed = true; } }
Example 4
Source File: PrefMonitorBoolean.java From Logisim with GNU General Public License v3.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent event) { Preferences prefs = event.getNode(); String prop = event.getKey(); String name = getIdentifier(); if (prop.equals(name)) { boolean oldValue = value; boolean newValue = prefs.getBoolean(name, dflt); if (newValue != oldValue) { value = newValue; AppPreferences.firePropertyChange(name, oldValue, newValue); } } }
Example 5
Source File: PrefMonitorDouble.java From Logisim with GNU General Public License v3.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent event) { Preferences prefs = event.getNode(); String prop = event.getKey(); String name = getIdentifier(); if (prop.equals(name)) { double oldValue = value; double newValue = prefs.getDouble(name, dflt); if (newValue != oldValue) { value = newValue; AppPreferences.firePropertyChange(name, Double.valueOf(oldValue), Double.valueOf(newValue)); } } }
Example 6
Source File: PrefMonitorInt.java From Logisim with GNU General Public License v3.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent event) { Preferences prefs = event.getNode(); String prop = event.getKey(); String name = getIdentifier(); if (prop.equals(name)) { int oldValue = value; int newValue = prefs.getInt(name, dflt); if (newValue != oldValue) { value = newValue; AppPreferences.firePropertyChange(name, Integer.valueOf(oldValue), Integer.valueOf(newValue)); } } }
Example 7
Source File: PrefMonitorString.java From Logisim with GNU General Public License v3.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent event) { Preferences prefs = event.getNode(); String prop = event.getKey(); String name = getIdentifier(); if (prop.equals(name)) { String oldValue = value; String newValue = prefs.get(name, dflt); if (!isSame(oldValue, newValue)) { value = newValue; AppPreferences.firePropertyChange(name, oldValue, newValue); } } }