Re: Make TransformationList (Filtered and Sorted) extendable

2020-08-26 Thread Nir Lisker
Hi Tobias,

I thought that ReactFX superseded EasyBind and InhiBeans. What is the
current relation between these?
In any case, while removing the final modifier could work (I didn't look
into it much), I suggest to take a broader approach. These libraries have
many features that I think are desirable to add to JavaFX, and they could
be added cleanly considering that we don't need to jump through the hoops
that a 3rd party library needs to. For example, the Val and Var extensions
could be integrated seamlessly (more or less) into the current classes,
solving problems such as the current "select" mechanism and wrong recursive
behavior.

I suggest to look at an approach where we adapt these libraries for javaFX
rather than adapting JavaFX for these libraries. If you are familiar with
these libraries, can we try to form a broader plan and see what meets the
bar?

- Nir

On Sun, Aug 16, 2020 at 4:29 PM Tobias Diez  wrote:

> Hello everybody,
>
> Right now it is hard to extend the FilteredList and the SortedList as these
> classes are marked final. This makes it practically impossible to add
> convenient helper methods, or change or extend the behavior of these
> classes.
> I agree that normally you don't need to extend them, but I also don't see
> any reason why you shouldn't be allowed to do so.
>
> Usually, you could use composition over inheritance if a class is marked
> final but you still want to extend it. However, some of the controls expect
> really a SortedList , e.g.
>
> https://github.com/openjdk/jfx/blob/master/modules/javafx.controls/src/main/
> java/javafx/scene/control/TableView.java#L442
> 
> So this approach does not work either.
>
> The motivation for me comes from some limitations that we encountered while
> developing EasyBind, a small library to make bindings easier. We provide a
> few convenient methods that extend the ObservableList, and we want to
> provide a fluent interface similar to streams, e.g.
> EasyBind.wrap(standard observable list).filter(predicate).map(mapper).
> For this to work, the filter method needs to return a FilteredList with the
> additional map method. The easiest solution would be to derive from
> FilteredList, and implement the "EasyObservableList" interface that we
> have.
>
> Removing the final keyword is done in the following PR:
> https://github.com/openjdk/jfx/pull/278
>
> Looking forward to your feedback.
> Best regards
> Tobias
>
>


Make TransformationList (Filtered and Sorted) extendable

2020-08-16 Thread Tobias Diez
Hello everybody,

Right now it is hard to extend the FilteredList and the SortedList as these
classes are marked final. This makes it practically impossible to add
convenient helper methods, or change or extend the behavior of these
classes.
I agree that normally you don't need to extend them, but I also don't see
any reason why you shouldn't be allowed to do so.

Usually, you could use composition over inheritance if a class is marked
final but you still want to extend it. However, some of the controls expect
really a SortedList , e.g.
https://github.com/openjdk/jfx/blob/master/modules/javafx.controls/src/main/
java/javafx/scene/control/TableView.java#L442
So this approach does not work either.

The motivation for me comes from some limitations that we encountered while
developing EasyBind, a small library to make bindings easier. We provide a
few convenient methods that extend the ObservableList, and we want to
provide a fluent interface similar to streams, e.g.
EasyBind.wrap(standard observable list).filter(predicate).map(mapper).
For this to work, the filter method needs to return a FilteredList with the
additional map method. The easiest solution would be to derive from
FilteredList, and implement the "EasyObservableList" interface that we have.

Removing the final keyword is done in the following PR:
https://github.com/openjdk/jfx/pull/278

Looking forward to your feedback.
Best regards
Tobias