private void changeInternalProperty(String key, Object oldValue, Object newValue) { if (!ObjectUtils.equalObjects(oldValue, newValue)) { if (newValue != null) { _properties.setProperty(key, newValue.toString()); } else { _properties.remove(key); } firePropertyChange(key, oldValue, newValue); } } }
/** * Sets a font of type <code>Font</code>. The method actually puts three keys in this property set in order to store * the font's properties: <ld> <li><code><key>.name</code> for the font's name</li> * <li><code><key>.style</code> for the font's style (an integer font)</li> <li><code><key>.name</code> * for the font's size in points (an integer font)</li> </ld> * * @param key the key * @param newValue the font * * @throws IllegalArgumentException */ public void setPropertyFont(String key, Font newValue) { Guardian.assertNotNullOrEmpty("key", key); Font oldValue = getPropertyFont(key, null); if (!ObjectUtils.equalObjects(oldValue, newValue)) { if (newValue != null) { _properties.setProperty(key + ".name", newValue.getName()); _properties.setProperty(key + ".style", String.valueOf(newValue.getStyle())); _properties.setProperty(key + ".size", String.valueOf(newValue.getSize())); } else { _properties.remove(key + ".name"); _properties.remove(key + ".style"); _properties.remove(key + ".size"); } firePropertyChange(key, oldValue, newValue); } }
/** * Sets a value of type <code>Color</code>. * * @param key the key * @param newValue the value * * @throws IllegalArgumentException */ public void setPropertyColor(String key, Color newValue) { Guardian.assertNotNullOrEmpty("key", key); Color oldValue = getPropertyColor(key, null); if (!ObjectUtils.equalObjects(oldValue, newValue)) { if (newValue != null) { _properties.setProperty(key, StringUtils.formatColor(newValue)); } else { _properties.remove(key); } firePropertyChange(key, oldValue, newValue); } }