Skip to content

Commit b31be11

Browse files
committed
add JavaDocs
1 parent f56f444 commit b31be11

2 files changed

Lines changed: 50 additions & 4 deletions

File tree

src/main/java/rx/javafx/sources/ListChange.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package rx.javafx.sources;
22

3+
/**
4+
* Holds an ADDED, REMOVED, or UPDATED flag with the associated value
5+
* @param <T>
6+
*/
37
public final class ListChange<T> {
48
private final T value;
59
private final Flag flag;

src/main/java/rx/observables/JavaFxObservable.java

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,29 +120,71 @@ public static Observable<ActionEvent> fromActionEvents(final MenuItem menuItem)
120120
return ActionEventSource.fromActionEvents(menuItem);
121121
}
122122

123+
/**
124+
* Creates an observable that emits an ObservableList every time it is modified
125+
*
126+
* @param source The target ObservableList of the ListChange events
127+
* @return An Observable emitting the ObservableList each time it changes
128+
*/
123129
public static <T> Observable<ObservableList<T>> fromObservableList(final ObservableList<T> source) {
124130
return ObservableListSource.fromObservableList(source);
125131
}
126-
132+
/**
133+
* Creates an observable that emits all additions to an ObservableList
134+
*
135+
* @param source The target ObservableList for the item add events
136+
* @return An Observable emitting items added to the ObservableList
137+
*/
127138
public static <T> Observable<T> fromObservableListAdds(final ObservableList<T> source) {
128139
return ObservableListSource.fromObservableListAdds(source);
129140
}
130-
141+
/**
142+
* Creates an observable that emits all removal items from an ObservableList
143+
*
144+
* @param source The target ObservableList for the item removal events
145+
* @return An Observable emitting items removed from the ObservableList
146+
*/
131147
public static <T> Observable<T> fromObservableListRemovals(final ObservableList<T> source) {
132148
return ObservableListSource.fromObservableListRemovals(source);
133149
}
134-
150+
/**
151+
* Creates an observable that emits all updated items from an ObservableList.
152+
* If you declare an ObservableList that listens to one or more properties of each element,
153+
* you can emit the changed items every time these properties are modified
154+
* <pre>ObservableList<Person> sourceList = FXCollections.observableArrayList(user -> new javafx.beans.Observable[]{user.age} );</pre>
155+
* @param source The target ObservableList for the item update events
156+
*
157+
* @return An Observable emitting items updated in the ObservableList
158+
*/
135159
public static <T> Observable<T> fromObservableListUpdates(final ObservableList<T> source) {
136160
return ObservableListSource.fromObservableListUpdates(source);
137161
}
138162

163+
/**
164+
* Emits all added, removed, and updated items from an ObservableList
165+
* @param source
166+
* @return An Observable emitting changed items with an ADDED, REMOVED, or UPDATED flags
167+
*/
139168
public static <T> Observable<ListChange<T>> fromObservableListChanges(final ObservableList<T> source) {
140169
return ObservableListSource.fromObservableListChanges(source);
141170
}
142-
171+
/**
172+
* Emits distinctly added and removed items from an ObservableList.
173+
* If dupe items with identical hashcode/equals evaluations are added to an ObservableList, only the first one will fire an ADDED item.
174+
* When the last dupe is removed, only then will it fire a REMOVED item.
175+
* @param source
176+
* @return An Observable emitting changed items with an ADDED, REMOVED, or UPDATED flags
177+
*/
143178
public static <T> Observable<ListChange<T>> fromObservableListDistinctChanges(final ObservableList<T> source) {
144179
return ObservableListSource.fromObservableListDistinctChanges(source);
145180
}
181+
/**
182+
* Emits distinctly added and removed mappings of each item from an ObservableList.
183+
* If dupe mapped items with identical hashcode/equals evaluations are added to an ObservableList, only the first one will fire an ADDED item.
184+
* When the last dupe is removed, only then will it fire a REMOVED item.
185+
* @param source
186+
* @return An Observable emitting changed mapped items with an ADDED, REMOVED, or UPDATED flags
187+
*/
146188
public static <T,R> Observable<ListChange<R>> fromObservableListDistinctMappings(final ObservableList<T> source, Func1<T,R> mapper) {
147189
return ObservableListSource.fromObservableListDistinctMappings(source,mapper);
148190
}

0 commit comments

Comments
 (0)