/** * Returns an observable value that tracks changes to the value of an observable map's entry * specified by its key. * * <p>The state where the key does not exist in the map is equivalent to the state where the key * exists and its value is <code>null</code>. The transition between these two states is not * considered a value change and no event is fired. * * @param map the observable map whose entry will be tracked. * @param key the key identifying the map entry to track. * @param valueType the type of the value. May be <code>null</code>, meaning the value is untyped. * @return an observable value that tracks the value associated with the specified key in the * given map * @since 1.1 */ public static IObservableValue observeMapEntry(IObservableMap map, Object key, Object valueType) { if (valueType == null) valueType = map.getValueType(); return new MapEntryObservableValue(map, key, valueType); }
/** * Listen to changes in observable <code>source</code> and fire a {@link PropertyChangeEvent} with * supplied property name(s) on supplied <code>target</code> whenever the observed instance * changes. * * @param source * @param target * @param propertyNames */ public static void replicate(IObservableMap source, Observable target, String... propertyNames) { source.addMapChangeListener(new ChangeReplicator(target, propertyNames)); }
/** * Returns an observable value that tracks changes to the value of an observable map's entry * specified by its key. * * <p>The state where the key does not exist in the map is equivalent to the state where the key * exists and its value is <code>null</code>. The transition between these two states is not * considered a value change and no event is fired. * * @param map the observable map whose entry will be tracked. * @param key the key identifying the map entry to track. * @return an observable value that tracks the value associated with the specified key in the * given map * @since 1.2 */ public static IObservableValue observeMapEntry(IObservableMap map, Object key) { return observeMapEntry(map, key, map.getValueType()); }