Comments (5)
Makes perfect sense. I'll implement this later in 1.0 as well as the 2.0 branch.
from rxjavafx.
Wouldn't it make more sense to emit an ObservableValue<T>
rather than just a JavaFX Observable
? The JavaFX Observable
(not Rx one) does not have the getValue()
method, but the ObservableValue<T>
does. I imagine that would be more useful.
public static <T> Observable<ObservableValue<T>> fromInvalidations(final ObservableValue<T> fxObservable) {
return Observable.create(subscriber -> {
final InvalidationListener listener = s -> subscriber.onNext(fxObservable);
fxObservable.addListener(listener);
subscriber.add(JavaFxSubscriptions.unsubscribeInEventDispatchThread(() -> fxObservable.removeListener(listener)));
});
}
Would it also make sense to overload a Property<T>
version as well? That way we can have access to a setValue()
method for each emitted Property<T>
?
public static <T> Observable<Property<T>> fromInvalidations(final Property<T> fxProperty) {
return Observable.create(subscriber -> {
final InvalidationListener listener = s -> subscriber.onNext(fxProperty);
fxProperty.addListener(listener);
subscriber.add(JavaFxSubscriptions.unsubscribeInEventDispatchThread(() -> fxProperty.removeListener(listener)));
});
}
from rxjavafx.
The main difference is, that ObservableList<>
, ObservableSet<>
, ObservableMap<>
and Property<>
all implement the Observable
interface and this could be used without knowing the specific type. If you know it you should use valuesOf
, changesOf
and so on.
from rxjavafx.
@protogenes that makes sense. Okay I'll implement your way.
from rxjavafx.
@protogenes Implemented in 1.x. I'll do 2.x as soon as I merge the new Scheduler for that branch. Let me know if that's ready.
from rxjavafx.
Related Issues (20)
- Ebook Learning RxJava with JavaFX not navigatable HOT 3
- Additional Transformer factories HOT 1
- Getting index in ListChange HOT 1
- Help with Deployment of 2.11 HOT 20
- Java 11 Automatic-Module-Name HOT 2
- JavaFxObservable.valuesOf(fxObservable, nullSentinel) does not emmit first nullSentinel HOT 1
- JavaFxObservable.valuesOf() and Bindings.bindBidirectional() strange behaviour. HOT 3
- JavaFxObservable.actionEventsOf().subscribeOn(Schedulers.newThread()) misses some emissions HOT 3
- 2.11.0-RC16 / error: cannot access JavaFxObserver HOT 4
- Mockito complaining with Java 11/Gradle 5 HOT 1
- No factories should subscribeOn() the Platform thread
- JavaFxObserver#onError: custom implementation HOT 1
- Need help with maintenance, call for collaborators HOT 9
- Support scene accelerators HOT 4
- Change object not emitted when observed property had changed to null
- A typo on Gitbook guide
- It looks like passing all the tests with openjfx 13.0.1 HOT 2
- Error - cannot access io.reactivex.Observable HOT 1
- Is there a plan to use RXJava 3 ? HOT 2
- Setting up a new build chain for stable/nightly releases.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rxjavafx.