Define an intermediate superclass for Transitions with a duration property
Nir Lisker
nlisker at gmail.com
Mon May 8 21:18:59 UTC 2023
I am unconvinced yet that this is a good path. The reason is that different
transitions have different combinations of properties to them. JDK-8091607
[1] asks for a common superclass for transitions that have a Node
property. JDK-8226456 [2] asks for a common superclass for parent
transitions (although this case is a bit different), Since only 1
superclass is possible, it might be better to use interfaces for these. The
problem described in the ticket and in [1] is that many instanceof checks
are needed, and this can be relieved with an interface as well. Code
duplication will still be present though.
I think that some prototyping is required first.
- Nir
[1] https://bugs.openjdk.org/browse/JDK-8091607
[2] https://bugs.openjdk.org/browse/JDK-8226456
On Mon, May 8, 2023 at 10:03 PM Carl Carlec <carl.carlec at gmail.com> wrote:
> Hello JavaFX community,
> I've created a draft PR for an enhancement to Transitions:
> https://github.com/openjdk/jfx/pull/1061
> JavaFX contains many different Transitions that have a durationProperty()
> and related getter/setter.
> Those transitions benefit from an abstract super class which defines this
> once.
> This will therefore reduce a lot of code duplications or big switch-cases
> to handle all Transitions like the one linked in the ticket.
>
>
> I propose to create a new abstract class called TimedTransition, which
> extends from Transition and defines the durationProperty() + getter/setter.
> All Transitions which define a durationProperty() will now extend from it
> and do not need to define it.
> Those Transitions are affected: FadeTransition, FillTransition,
> PathTransition, PauseTransition, RotateTransition, ScaleTransition,
> StrokeTransition, TranslateTransition.
>
>
> Feedback welcome!
>
>
> Carl
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20230509/8a2357b1/attachment-0001.htm>
More information about the openjfx-dev
mailing list