if I have a JavaFX property and I create an event stream from this property:
EventStreams.nonNullValuesOf(node.boundsInParentProperty())
Is there a possibility to set the source (in this case the "node") at creation time or to get this object later in a subscription?
For example:
EventStream<...> stream = EventStreams.nonNullValuesOf(node.boundsInParentProperty());
...
stream.subscribe((node, bounds) -> ...);
or at creation time:
EventStream<...> stream = EventStreams.valueAndSource(node.boundsInParentProperty(), node);
OK I got what I want with:
EventStreams.nonNullValuesOf(node.boundsInParentProperty()).map(bounds -> ...)
My problem was that I have a list with N node objects which are reachable at iteration time. Solved my problem like:
EventStream<Tuple2<Node, Bounds>> eventStream = nodes.stream().
map(node -> EventStreams.nonNullValuesOf(node.boundsInParentProperty()).map(bounds -> Tuples.t(node, bounds))).
reduce((es, esAccu) -> EventStreams.merge(es, esAccu)).
orElse(EventStreams.never());