RFR: 8290844: Add Skin.install() method [v9]

Jeanette Winzenburg fastegal at openjdk.org
Wed Oct 5 12:26:23 UTC 2022


On Tue, 4 Oct 2022 19:27:55 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> modules/javafx.controls/src/main/java/javafx/scene/control/Skin.java line 90:
>> 
>>> 88:      */
>>> 89:     default public void install() { }
>>> 90: 
>> 
>> what about calling install more than once? There are arguments for either:
>> 
>> - in symmetry to dispose, it should be allowed 
>> - regarding this as an "out-sourced" part of the constructor - to allow/enforce proper cleanup - it shouldn't
>> 
>> whatever the decision, it must be specified
>
> re-phrased the comment, please let me know if the new version is clearer (or suggest an alternative if not).

hmm .. it's still using setSkin :)

What about following the lead of dispose doc closely:

> Called by Skinnable when the Skin is attached/set (whatever, you are the native speakers ;) to the Skinnable. This method allows a Skin to ... (same as currently) ..
> 
> Must be called exactly once _after_ a previous Skin - if any - is disposed.
> 
> (same as current)
> 
> 

Still not quite sure the spec is clear enough to express the precondition for this method: in words it's something like "there must not be any other skin with other.getSkinnable() == this.getSkinnable()", that is all other potential skins are disposed - but that sounds a bit unbounded ...

Aside: strictly speaking, the dispose doc is over-specified "Called by the Skinnable.." - which is making our own code violating that contract: dispose is called freely from other collaborators, f.i. during auto-sizing of columns, doing layout in VirtualFlow .. just saying :)

-------------

PR: https://git.openjdk.org/jfx/pull/845


More information about the openjfx-dev mailing list