示例#1
0
  /**
   * Creates or gets the pref node, creates an entry and then hooks it up as a listener . The
   * current value of the color because the default.
   *
   * @param colorWrapper the color object wrapper
   * @param section the section or category of the pref
   * @param pref the pref's name
   * @param attrName the actual attribute
   */
  public void registerInternal(
      final ColorWrapper colorWrapper,
      final String section,
      final String pref,
      final String attrName) {
    AppPreferences appPrefs = getPref();

    checkName(section, pref, attrName);

    String fullName = makeKey(section, pref, attrName);
    if (hash.get(fullName) == null) {
      String defValue = colorWrapper.toString();
      String prefVal = checkForPref(fullName, defValue);
      colorWrapper.setRGB(prefVal);

      ColorCacheEntry colorEntry = new ColorCacheEntry(colorWrapper, fullName, prefVal, defValue);

      appPrefs.addChangeListener(fullName, colorEntry);
      hash.put(fullName, colorEntry);
    }
  }
示例#2
0
 @Override
 public void preferenceChange(AppPrefsChangeEvent evt) {
   super.preferenceChange(evt);
   colorWrapper.setRGB(getValue());
 }