The Preference interface provides access to a preference and its attributes.
Preference
This interface defines the model as known from the MVC pattern. Its purpose is to provide read access to the data stored in the model.
156157158159160161162163164165166167168169170171172
{ iter.next(); } // iterate through all preference sets Preference preference = null; while ((preference == null) && (iter.hasNext())) { preference = ((PreferenceSet)iter.next()).get(key); } if (preference == null || !preference.isValueSet()) { // if preference not exists return def; } else
317318319320321322323324325326327
for (int i=0;i<values.length;i++) newValues.add(values[i]); } // transfer changings Preference preference = preferences.get(key); if (preference != null) { // change preference PreferenceCtrl preferenceCtrl = (PreferenceCtrl)ControllerObjectAccess.get(preference); preferenceCtrl.setValues(newValues);
35363738394041424344
static public HashMap createPreferenceMap(Collection preferences) { HashMap returnValue = new HashMap(); Iterator iterator = preferences.iterator(); while (iterator.hasNext()) { Preference preference = (Preference)iterator.next(); returnValue.put(preference.getName(), preference.getValues()); } return returnValue; }
484950515253545556575859
public Preference get(String name) { Iterator iterator = this.iterator(); while (iterator.hasNext()) { Preference preference = (Preference)iterator.next(); if (preference.getName().equals(name)) { return preference; } } return null; }
949596979899100101102103104105
public Preference remove(String name) { Iterator iterator = this.iterator(); while (iterator.hasNext()) { Preference preference = (Preference)iterator.next(); if (preference.getName().equals(name)) { super.remove(preference); return preference; } } return null;
264265266267268269270271272273274275276
Iterator it = preferenceSet.iterator(); JSNVPElements v = new JSNVPElements(); while (it.hasNext()) { Preference pref = (Preference) it.next(); String name = pref.getName(); Iterator ii = pref.getValues(); while (ii.hasNext()) { Object o = ii.next(); v.add(name, o.toString()); }
619620621622623624625626627628629
while (it.hasNext()) { String key = (String)it.next(); String value = (String)prefList.getMyMap().get(key); Preference p = preferenceSet.get(key); if ((p == null) || (overwrite)) { Vector v = new Vector(); v.add(value); preferenceSet.add(key, v);
318319320321322323324325326327328329330331332
assertNotNull(pd); assertNotNull(pd.getPreferenceSet()); Preference pref1 = pd.getPreferenceSet().get("pref1"); assertNotNull(pref1); Iterator itr = pref1.getValues(); int count = 0; while (itr.hasNext()) { count++; System.out.println("Value " + count + "=" + itr.next());
120121122123124125126127128129130
*/ public Preference get( String key ) { try { Preference pref = null; if (prefsRootNode.nodeExists(key)) { pref = new PrefsPreference(prefsRootNode.node(key), key); } else if(defaults != null)
270271272273274275276277278279280281282
Iterator it = preferenceSet.iterator(); JSNVPElements v = new JSNVPElements(); while (it.hasNext()) { Preference pref = (Preference) it.next(); String name = pref.getName(); Iterator ii = pref.getValues(); while (ii.hasNext()) { processedAny = true; Object o = ii.next(); v.add(name, o.toString());