<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>I had a look and made list of every transition with their properties:<br/>
Transition<br/>
-> FadeTransition (node, duration)<br/>
-> FillTransition (shape, duration)<br/>
-> ParallelTransition (node)<br/>
-> PathTransition (node, duration)<br/>
-> PauseTransition (duration)<br/>
-> RotateTransition (node, duration)<br/>
-> ScaleTransition (node, duration)<br/>
-> SequentialTransition (node)<br/>
-> StrokeTransition (shape, duration)<br/>
-> TranslateTransition (node, duration)</div>
<div> </div>
<div>We can save a lot of duplicated code for the duration property since it always does the same thing, which is calling <em>setCycleDuration()</em>.<br/>
This also beneficial for other developers so they don't need to deal with that when creating an own Transition class with a duration.<br/>
<em>setNode()</em> or <em>setShape()</em> are simple property setters. So maybe a mix of an abstract class and interfaces makes sense here.</div>
<div> </div>
<div>E.g.<br/>
Abstract class: TimedTransition<br/>
Interface: NodeTransition</div>
<div>Interface: ShapeTransition</div>
<div>
<div>
<div>For <em>SequentialTransition </em>and <em>ParallelTransition </em>we can also think of an abstract superclass as they share a lot of code.<br/>
And this would also be useful for developers as this abstract superclass deals already with e.g. all the <em>children</em> property stuff for you when extending such superclass.</div>
<div> </div>
<div>-- Marius</div>
<div> </div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Montag, 08. Mai 2023 um 23:18 Uhr<br/>
<b>Von:</b> "Nir Lisker" <nlisker@gmail.com><br/>
<b>An:</b> "Carl Carlec" <carl.carlec@gmail.com><br/>
<b>Cc:</b> openjfx-dev@openjdk.org<br/>
<b>Betreff:</b> Re: Define an intermediate superclass for Transitions with a duration property</div>
<div name="quoted-content">
<div>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.
<div> </div>
<div>I think that some prototyping is required first.
<div>
<div> </div>
<div>- Nir</div>
<div> </div>
<div>[1] <a href="https://bugs.openjdk.org/browse/JDK-8091607" target="_blank">https://bugs.openjdk.org/browse/JDK-8091607</a></div>
<div>[2] <a href="https://bugs.openjdk.org/browse/JDK-8226456" target="_blank">https://bugs.openjdk.org/browse/JDK-8226456</a></div>
<div> </div>
</div>
</div>
</div>
<div class="gmail_quote">
<div class="gmail_attr">On Mon, May 8, 2023 at 10:03 PM Carl Carlec <<a href="mailto:carl.carlec@gmail.com" onclick="parent.window.location.href='mailto:carl.carlec@gmail.com'; return false;" target="_blank">carl.carlec@gmail.com</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin: 0.0px 0.0px 0.0px 0.8ex;border-left: 1.0px solid rgb(204,204,204);padding-left: 1.0ex;">
<div>
<div>
<div style="color: rgb(0,0,0);margin-bottom: 0.0px;margin-left: 0.0px;margin-top: 0.0px;">Hello JavaFX community,</div>
<div style="color: rgb(0,0,0);margin-bottom: 0.0px;margin-left: 0.0px;margin-top: 0.0px;">I've created a draft PR for an enhancement to Transitions: <a href="https://github.com/openjdk/jfx/pull/1061" target="_blank" title="https://github.com/openjdk/jfx/pull/1061">https://github.com/openjdk/jfx/pull/1061</a></div>
<div style="color: rgb(0,0,0);margin-bottom: 0.0px;margin-left: 0.0px;margin-top: 0.0px;">JavaFX contains many different Transitions that have a durationProperty() and related getter/setter.</div>
<div style="color: rgb(0,0,0);margin-bottom: 0.0px;margin-left: 0.0px;margin-top: 0.0px;">Those transitions benefit from an abstract super class which defines this once. </div>
<div style="color: rgb(0,0,0);margin-bottom: 0.0px;margin-left: 0.0px;margin-top: 0.0px;">This will therefore reduce a lot of code duplications or big switch-cases to handle all Transitions like the one linked in the ticket.</div>
<p style="color: rgb(0,0,0);margin-bottom: 0.0px;margin-left: 0.0px;margin-top: 0.0px;"> </p>
<div style="color: rgb(0,0,0);margin-bottom: 0.0px;margin-left: 0.0px;margin-top: 0.0px;">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.</div>
<div style="color: rgb(0,0,0);margin-bottom: 0.0px;margin-left: 0.0px;margin-top: 0.0px;">Those Transitions are affected: FadeTransition, FillTransition, PathTransition, PauseTransition, RotateTransition, ScaleTransition, StrokeTransition, TranslateTransition.</div>
<p style="color: rgb(0,0,0);margin-bottom: 0.0px;margin-left: 0.0px;margin-top: 0.0px;"> </p>
<div style="color: rgb(0,0,0);margin-bottom: 0.0px;margin-left: 0.0px;margin-top: 0.0px;">Feedback welcome!</div>
<p style="color: rgb(0,0,0);margin-bottom: 0.0px;margin-left: 0.0px;margin-top: 0.0px;"> </p>
<div style="color: rgb(0,0,0);margin-bottom: 0.0px;margin-left: 0.0px;margin-top: 0.0px;">Carl</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div></div></body></html>