1818
1919import javafx .beans .value .ObservableValue ;
2020import javafx .collections .ObservableList ;
21+ import javafx .collections .ObservableMap ;
2122import javafx .event .ActionEvent ;
2223import javafx .event .Event ;
2324import javafx .event .EventType ;
3132import rx .functions .Func1 ;
3233import rx .javafx .sources .*;
3334
35+ import java .util .Map ;
36+
3437
3538public enum JavaFxObservable {
3639 ; // no instances
@@ -163,7 +166,7 @@ public static <T> Observable<T> fromObservableListUpdates(final ObservableList<T
163166 /**
164167 * Emits all added, removed, and updated items from an ObservableList
165168 * @param source
166- * @return An Observable emitting changed items with an ADDED, REMOVED, or UPDATED flags
169+ * @return An Observable emitting changed items with an ADDED, REMOVED, or UPDATED flag
167170 */
168171 public static <T > Observable <ListChange <T >> fromObservableListChanges (final ObservableList <T > source ) {
169172 return ObservableListSource .fromObservableListChanges (source );
@@ -173,7 +176,7 @@ public static <T> Observable<ListChange<T>> fromObservableListChanges(final Obse
173176 * If dupe items with identical hashcode/equals evaluations are added to an ObservableList, only the first one will fire an ADDED item.
174177 * When the last dupe is removed, only then will it fire a REMOVED item.
175178 * @param source
176- * @return An Observable emitting changed items with an ADDED, REMOVED, or UPDATED flags
179+ * @return An Observable emitting changed items with an ADDED, REMOVED, or UPDATED flag
177180 */
178181 public static <T > Observable <ListChange <T >> fromObservableListDistinctChanges (final ObservableList <T > source ) {
179182 return ObservableListSource .fromObservableListDistinctChanges (source );
@@ -183,7 +186,7 @@ public static <T> Observable<ListChange<T>> fromObservableListDistinctChanges(fi
183186 * If dupe mapped R items with identical hashcode/equals evaluations are added to an ObservableList, only the first one will fire an ADDED T item.
184187 * When the last R dupe is removed, only then will it fire a REMOVED T item.
185188 * @param source
186- * @return An Observable emitting changed items with an ADDED, REMOVED, or UPDATED flags
189+ * @return An Observable emitting changed items with an ADDED, REMOVED, or UPDATED flag
187190 */
188191 public static <T ,R > Observable <ListChange <T >> fromObservableListDistinctChanges (final ObservableList <T > source , Func1 <T ,R > mapper ) {
189192 return ObservableListSource .fromObservableListDistinctChanges (source ,mapper );
@@ -193,9 +196,48 @@ public static <T,R> Observable<ListChange<T>> fromObservableListDistinctChanges(
193196 * If dupe mapped R items with identical hashcode/equals evaluations are added to an ObservableList, only the first one will fire an ADDED R item.
194197 * When the last dupe is removed, only then will it fire a REMOVED R item.
195198 * @param source
196- * @return An Observable emitting changed mapped items with an ADDED, REMOVED, or UPDATED flags
199+ * @return An Observable emitting changed mapped items with an ADDED, REMOVED, or UPDATED flag
197200 */
198201 public static <T ,R > Observable <ListChange <R >> fromObservableListDistinctMappings (final ObservableList <T > source , Func1 <T ,R > mapper ) {
199202 return ObservableListSource .fromObservableListDistinctMappings (source ,mapper );
200203 }
204+
205+ /**
206+ * Creates an observable that emits an ObservableMap every time it is modified
207+ *
208+ * @param source The target ObservableMap of the MapChange events
209+ * @return An Observable emitting the ObservableMap each time it changes
210+ */
211+ public static <K ,T > Observable <ObservableMap <K ,T >> fromObservableMap (final ObservableMap <K ,T > source ) {
212+ return ObservableMapSource .fromObservableMap (source );
213+ }
214+
215+ /**
216+ * Creates an observable that emits all additions to an ObservableMap
217+ *
218+ * @param source The target ObservableMap for the item add events
219+ * @return An Observable emitting Entry items added to the ObservableMap
220+ */
221+ public static <K ,T > Observable <Map .Entry <K ,T >> fromObservableMapAdds (final ObservableMap <K ,T > source ) {
222+ return ObservableMapSource .fromObservableMapAdds (source );
223+ }
224+
225+ /**
226+ * Creates an observable that emits all removal items from an ObservableMap
227+ *
228+ * @param source The target ObservableMap for the item removal events
229+ * @return An Observable emitting items removed Entry items from the ObservableList
230+ */
231+ public static <K ,T > Observable <Map .Entry <K ,T >> fromObservableMapRemovals (final ObservableMap <K ,T > source ) {
232+ return ObservableMapSource .fromObservableMapRemovals (source );
233+ }
234+
235+ /**
236+ * Emits all added, removed, and updated items from an ObservableMap
237+ * @param source
238+ * @return An Observable emitting changed entries with an ADDED, REMOVED, or UPDATED flag
239+ */
240+ public static <K ,T > Observable <MapChange <K ,T >> fromObservableMapChanges (final ObservableMap <K ,T > source ) {
241+ return ObservableMapSource .fromObservableMapChanges (source );
242+ }
201243}
0 commit comments