Author: tchemit Date: 2009-02-08 19:35:54 +0000 (Sun, 08 Feb 2009) New Revision: 1331 Modified: lutinutil/trunk/changelog.txt lutinutil/trunk/src/main/java/org/codelutin/util/ApplicationConfig.java Log: add PropertyChangedSupport in ApplicationConfig Modified: lutinutil/trunk/changelog.txt =================================================================== --- lutinutil/trunk/changelog.txt 2009-02-05 21:04:54 UTC (rev 1330) +++ lutinutil/trunk/changelog.txt 2009-02-08 19:35:54 UTC (rev 1331) @@ -1,4 +1,5 @@ ver 1.0.3 ??? 200901?? + * 20090208 [chemit] add PropertyChangedSupport in ApplicationConfig * 20090203 [chemit] fix StringUtil failed tests since to locale. * 20090126 [chemit] i18n Resource class * 20090121 [chemit] fix bug on Resource when a jar manifest classpath contains some XXX:// jar path Modified: lutinutil/trunk/src/main/java/org/codelutin/util/ApplicationConfig.java =================================================================== --- lutinutil/trunk/src/main/java/org/codelutin/util/ApplicationConfig.java 2009-02-05 21:04:54 UTC (rev 1330) +++ lutinutil/trunk/src/main/java/org/codelutin/util/ApplicationConfig.java 2009-02-08 19:35:54 UTC (rev 1331) @@ -46,6 +46,8 @@ import java.util.ListIterator; import java.util.Map; import java.util.Properties; +import java.beans.PropertyChangeSupport; +import java.beans.PropertyChangeListener; /** * <h1>To do</h1> @@ -301,6 +303,9 @@ protected Map<Integer, List<Action>> actions = new HashMap<Integer, List<Action>>(); + /** suport of config modification */ + protected PropertyChangeSupport pcs = new PropertyChangeSupport(this);; + static public class Action { @Retention(RetentionPolicy.RUNTIME) @@ -329,7 +334,7 @@ /** * Item used for cacheOption * - * @param T + * @param <T> */ static protected class CacheItem<T> { /** typed option value */ @@ -536,7 +541,7 @@ * Permet de recuperer l'ensemble des options commencant par une certaine * chaine * - * @param key debut de cle a recuperer + * @param prefix debut de cle a recuperer * @return */ public Properties getOptionStartsWith(String prefix) { @@ -933,4 +938,20 @@ System.out.println("options " + options); System.out.println("-------------------------------------------------"); } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + pcs.addPropertyChangeListener(listener); + } + + public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { + pcs.addPropertyChangeListener(propertyName, listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + pcs.removePropertyChangeListener(listener); + } + + public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { + pcs.removePropertyChangeListener(propertyName, listener); + } }