Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright 2014 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package rx.observables;
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList;
import javafx.collections.ObservableMap;
import javafx.collections.ObservableSet;
import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.event.EventType;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Dialog;
import javafx.scene.control.MenuItem;
import javafx.stage.Window;
import javafx.stage.WindowEvent;
import javafx.util.Duration;
import rx.Observable;
import rx.functions.Func1;
import java.util.concurrent.atomic.AtomicLong;
import rx.javafx.sources.*;
import rx.subscriptions.JavaFxSubscriptions;
import java.util.Map;
public enum JavaFxObservable {
; // no instances
/**
* Creates an observable corresponding to javafx Node events.
*
* @param node The target of the UI events.
* @param eventType The type of the observed UI events
* @return An Observable of UI events, appropriately typed
*/
public static Observable fromNodeEvents(final Node node, final EventType eventType) {
return NodeEventSource.fromNodeEvents(node, eventType);
}
/**
* Create an rx Observable from a javafx ObservableValue
*
* @param fxObservable the observed ObservableValue
* @param the type of the observed value
* @return an Observable emitting values as the wrapped ObservableValue changes
*/
public static Observable fromObservableValue(final ObservableValue fxObservable) {
return ObservableValueSource.fromObservableValue(fxObservable);
}
/**
* Create an rx Observable from a javafx ObservableValue, and emits changes with old and new value pairs
*
* @param fxObservable the observed ObservableValue
* @param the type of the observed value
* @return an Observable emitting values as the wrapped ObservableValue changes
*/
public static Observable> fromObservableValueChanges(final ObservableValue fxObservable) {
return ObservableValueSource.fromObservableValueChanges(fxObservable);
}
/**
* Creates an observable corresponding to javafx Scene events.
*
* @param scene The target of the UI events.
* @param eventType The type of the observed UI events
* @return An Observable of UI events, appropriately typed
*/
public static Observable fromSceneEvents(final Scene scene, final EventType eventType) {
return SceneEventSource.fromSceneEvents(scene,eventType);
}
/**
* Creates an observable corresponding to javafx Window events.
*
* @param window The target of the UI events.
* @param eventType The type of the observed UI events
* @return An Observable of UI events, appropriately typed
*/
public static Observable fromWindowEvents(final Window window, final EventType eventType) {
return WindowEventSource.fromWindowEvents(window,eventType);
}
/**
* Creates an observable corresponding to javafx Node action events.
*
* @param node The target of the ActionEvents
* @return An Observable of UI ActionEvents
*/
public static Observable fromActionEvents(final Node node) {
return ActionEventSource.fromActionEvents(node);
}
/**
* Creates an observable corresponding to javafx ContextMenu action events.
*
* @param contextMenu The target of the ActionEvents
* @return An Observable of UI ActionEvents
*/
public static Observable fromActionEvents(final ContextMenu contextMenu) {
return ActionEventSource.fromActionEvents(contextMenu);
}
/**
* Creates an observable corresponding to javafx MenuItem action events.
*
* @param menuItem The target of the ActionEvents
* @return An Observable of UI ActionEvents
*/
public static Observable fromActionEvents(final MenuItem menuItem) {
return ActionEventSource.fromActionEvents(menuItem);
}
/**
* Creates an observable that emits an ObservableList every time it is modified
*
* @param source The target ObservableList of the ListChange events
* @return An Observable emitting the ObservableList each time it changes
*/
public static Observable> fromObservableList(final ObservableList source) {
return ObservableListSource.fromObservableList(source);
}
/**
* Creates an observable that emits all additions to an ObservableList
*
* @param source The target ObservableList for the item add events
* @return An Observable emitting items added to the ObservableList
*/
public static Observable fromObservableListAdds(final ObservableList source) {
return ObservableListSource.fromObservableListAdds(source);
}
/**
* Creates an observable that emits all removal items from an ObservableList
*
* @param source The target ObservableList for the item removal events
* @return An Observable emitting items removed from the ObservableList
*/
public static Observable fromObservableListRemovals(final ObservableList source) {
return ObservableListSource.fromObservableListRemovals(source);
}
/**
* Creates an observable that emits all updated items from an ObservableList.
* If you declare an ObservableList that listens to one or more properties of each element,
* you can emit the changed items every time these properties are modified
*
ObservableList sourceList = FXCollections.observableArrayList(user -> new javafx.beans.Observable[]{user.age} );
* @param source The target ObservableList for the item update events
*
* @return An Observable emitting items updated in the ObservableList
*/
public static Observable fromObservableListUpdates(final ObservableList source) {
return ObservableListSource.fromObservableListUpdates(source);
}
/**
* Emits all added, removed, and updated items from an ObservableList
* @param source
* @return An Observable emitting changed items with an ADDED, REMOVED, or UPDATED flag
*/
public static Observable> fromObservableListChanges(final ObservableList source) {
return ObservableListSource.fromObservableListChanges(source);
}
/**
* Emits distinctly added and removed items from an ObservableList.
* If dupe items with identical hashcode/equals evaluations are added to an ObservableList, only the first one will fire an ADDED item.
* When the last dupe is removed, only then will it fire a REMOVED item.
* @param source
* @return An Observable emitting changed items with an ADDED, REMOVED, or UPDATED flag
*/
public static Observable> fromObservableListDistinctChanges(final ObservableList source) {
return ObservableListSource.fromObservableListDistinctChanges(source);
}
/**
* Emits distinctly added and removed T items from an ObservableList based on a mapping to an R value.
* 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.
* When the last R dupe is removed, only then will it fire a REMOVED T item.
* @param source
* @return An Observable emitting changed items with an ADDED, REMOVED, or UPDATED flag
*/
public static Observable> fromObservableListDistinctChanges(final ObservableList source, Func1 mapper) {
return ObservableListSource.fromObservableListDistinctChanges(source,mapper);
}
/**
* Emits distinctly added and removed mappings to each R item from an ObservableList.
* 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.
* When the last dupe is removed, only then will it fire a REMOVED R item.
* @param source
* @return An Observable emitting changed mapped items with an ADDED, REMOVED, or UPDATED flag
*/
public static Observable> fromObservableListDistinctMappings(final ObservableList source, Func1 mapper) {
return ObservableListSource.fromObservableListDistinctMappings(source,mapper);
}
/**
* Creates an observable that emits an ObservableMap every time it is modified
*
* @param source The target ObservableMap of the MapChange events
* @return An Observable emitting the ObservableMap each time it changes
*/
public static Observable> fromObservableMap(final ObservableMap source) {
return ObservableMapSource.fromObservableMap(source);
}
/**
* Creates an observable that emits all additions to an ObservableMap
*
* @param source The target ObservableMap for the item add events
* @return An Observable emitting Entry items added to the ObservableMap
*/
public static Observable> fromObservableMapAdds(final ObservableMap source) {
return ObservableMapSource.fromObservableMapAdds(source);
}
/**
* Creates an observable that emits all removal items from an ObservableMap
*
* @param source The target ObservableMap for the item removal events
* @return An Observable emitting items removed Entry items from the ObservableMap
*/
public static Observable> fromObservableMapRemovals(final ObservableMap source) {
return ObservableMapSource.fromObservableMapRemovals(source);
}
/**
* Emits all added and removed items (including swaps) from an ObservableMap
* @param source
* @return An Observable emitting changed entries with an ADDED or REMOVED flag
*/
public static Observable> fromObservableMapChanges(final ObservableMap source) {
return ObservableMapSource.fromObservableMapChanges(source);
}
/**
* Creates an observable that emits an ObservableSet every time it is modified
*
* @param source The target ObservableSet of the SetChange events
* @return An Observable emitting the ObservableSet each time it changes
*/
public static Observable> fromObservableSet(final ObservableSet source) {
return ObservableSetSource.fromObservableSet(source);
}
/**
* Creates an observable that emits all additions to an ObservableSet
*
* @param source The target ObservableSet for the item add events
* @return An Observable emitting items added to the ObservableSet
*/
public static Observable fromObservableSetAdds(final ObservableSet source) {
return ObservableSetSource.fromObservableSetAdds(source);
}
/**
* Creates an observable that emits all removal items from an ObservableSet
*
* @param source The target ObservableSet for the item removal events
* @return An Observable emitting items removed items from the ObservableSet
*/
public static Observable fromObservableSetRemovals(final ObservableSet source) {
return ObservableSetSource.fromObservableSetRemovals(source);
}
/**
* Emits all added and removed items (including swaps) from an ObservableSet
* @param source
* @return An Observable emitting changed entries with an ADDED or REMOVED flag
*/
public static Observable> fromObservableSetChanges(final ObservableSet source) {
return ObservableSetSource.fromObservableSetChanges(source);
}
/**
* Returns an Observable that emits a 0L and ever increasing numbers after each duration of time thereafter
*/
public static Observable interval(final Duration duration) {
return TimerSource.interval(duration);
}
/**
* Returns an Observable that emits the T response of a Dialog. If no response was given then the Observable will be empty.
*/
public static Observable fromDialog(Dialog dialog) {
return DialogSource.fromDialogSource(dialog);
}
}