You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
###ObservableList, ObservableMap, and ObservableSet
141
+
142
+
There are several factories to emit many useful `ObservableList`, `ObservableMap`, and `ObservableSet` events as Observables. These all can be found as static factory methods in the `JavaFxObservable` static class.
|fromObservableList()|ObservableList<T>|Observable<ObservableList<T>>|Emits the entire `ObservableList` every time it changes|
148
+
|fromObservableListAdds()|ObservableList<T>|Observable<T>|Emits additions to an `ObservableList`|
149
+
|fromfromObservableListRemovals()|ObservableList<T>|Observable<T>|Emits removals from an `ObservableList`|
150
+
|fromObservableListUpdates|ObservableList<T>|Observable<ListChange<T>>|Emits every item that was the result of a change to an `ObservableList`, with an `ADDED`, `REMOVED`, or `UPDATED` flag|
151
+
|fromObservableListDistinctChanges()|ObservableList<T>| Observable<ListChange<R>>|Emits only *distinct* addtions and removals to an `ObservableList`|
152
+
|fromObservableListDistinctChanges()|ObservableList<T>, Func1<T,R>| Observable<ListChange<R>>|Emits only *distinct* additions and removals to an `ObservableList` and emits the mapping|
153
+
|fromObservableListDistinctChanges()|ObservableList<T>, Func1<T,R>| Observable<ListChange<R>>|Emits only *distinct* additions and removals to an `ObservableList` based on a mapping|
154
+
|fromObservableMap()|ObservableMap<K,T>|Observable<ObservableMap<K,T>>|Emits the entire `ObservableMap` every time it changes|
155
+
|fromObservableMapAdds()|ObservableMap<K,T>|Observable<Map.Entry<K,T>>|Emits every `Map.Entry<K,T>` added to an `ObservableMap`|
156
+
|fromObservableMapRemovals()|ObservableMap<K,T>|Observable<Map.Entry<K,T>>|Emits every `Map.Entry<K,T>` removed from an `ObservableMap`|
157
+
|fromObservableMapChanges()|ObservableMap<K,T>|Observable<MapChange<K,T>>|Emits every key/value pair with an `ADDED` or `REMOVED` flag.|
158
+
|fromObservableSet()|ObservableSet<T>|Observable<ObservableSet<T>>|Emits the entire `ObservableSet` every time it changes|
159
+
|fromObservableSetAdds()|ObservableSet<T>|Observable<T>|Emits every addition to an `ObservableSet`|
160
+
|fromObservableSetRemovals()|ObservableSet<T>|Observable<T>|Emits every removal to an `ObservableSet`|
161
+
|fromObservableSetChanges()|ObservableSet<T>|Observable<SetChange<T>|Emits every item `ADDED` or `REMOVED` item from an `ObservableSet` with the corresponding flag|
141
162
142
-
There are eight factories in `JavaFxObservable` for turning an `ObservableList` into an `Observable` of some form based on a `ListChange` event.
The first factory`fromObservableList()` will simply emit the entire `ObservableList` every time there is `ListChange` event fired. The rest of the factories fire only items impacted by the `ListChange` events. The last three emit only *distinct* additions and removals, which can be helpful to emit only the first item with a given `hashcode()`/`equals()` and ignore dupe additions. When the last item (meaning no more dupes) is removed, only then will it fire the removal.
163
-
164
-
See the JavaDocsfor a more detailed description of each one.
165
163
166
164
###Binding
167
165
You can convert an RxJava `Observable` into a JavaFX `Binding` by calling the `JavaFxSubscriber.toBinding()` factory. Calling the `dispose()` method on the `Binding` will handle the unsubscription from the `Observable`. You can then take this `Binding` to bind other control properties to it.
0 commit comments