JDK-8156089 : Provide official API so subclasses can override layout bounds computation
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: scenegraph
  • Affected Version: 8u92
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: os_x
  • CPU: x86
  • Submitted: 2016-05-02
  • Updated: 2018-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
A DESCRIPTION OF THE REQUEST :
As javafx.scene.Node#layoutBoundsProperty() and the related getters are all final, overriding #impl_computeLayoutBounds() currently is the only possibility a client has to adjust the layout bounds computation. I would like to request a protected computeLayoutBounds() method as official API, so that clients would not have to rely on deprecated/internal hooks.

JUSTIFICATION :
As a legal use case please consider the GeometryNode implementation (http://git.eclipse.org/c/gef/org.eclipse.gef4.git/tree/org.eclipse.gef4.fx/src/org/eclipse/gef4/fx/nodes/GeometryNode.java) that is provided by the Eclipse Graphical Editing Framework. It delivers some sort of resizable shape, based on a Region. 

As it needs to guarantee that the values passed in to resize() are properly reflected within the layoutBounds (and the offset between geometric bounds and layout bounds cannot be properly computed because of lacking API) overriding super.impl_computeLayoutBounds() currently is the only chance to guarantee the resize contract. Through a protected computeLayoutBounds() method that use case could be handsomely realized. 

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Migrate impl_computeLayoutBounds() into computeLayoutBounds() and remove the deprecation flag.
ACTUAL -
impl_computeLayoutBounds() is deprecated and marked as internal.

CUSTOMER SUBMITTED WORKAROUND :
There is no workaround. As soon as impl_computeLayoutBounds() is removed, all use cases where clients would like to adjust the layout bounds computation, are no longer realizable.


Comments
I will consider it when I work on JDK-8144585 next week.
05-05-2016