Cached preferred size values cause layout problems in BoxPane
-------------------------------------------------------------
Key: PIVOT-226
URL: https://issues.apache.org/jira/browse/PIVOT-226
Project: Pivot
Issue Type: Bug
Affects Versions: 1.3
Reporter: Greg Brown
Assignee: Greg Brown
Priority: Minor
Fix For: 1.3
We currently cache the values of the preferred size calculations for
performance reasons. As a result, when a vertical BoxPane is set to fill the
available space, the widest component doesn't get scaled up (nor do any other
components that report the same preferred width).
One possible fix is to call invalidate() on the component in BoxPane#layout()
before asking it for its constrained preferred height. That ensures that we get
the correct value, and it doesn't impose a significant performance penalty most
of the time.
However, this may not be the "right" place to put this logic. Since this is a
side effect of caching logic in Component, the logic for invalidating the cache
probably also belongs in Component. Ideally, containers such as BoxPane
shouldn't need to know that they must call invalidate() in order to clear the
cache.
A better solution may be to add a method to Skin that will allow Component to
ask it how to handle cases like this. The exact nature/name of this method is
TBD. Some ideas:
isFixedAspectRatio():boolean
isVariableAspectRatio():boolean
getPreferredAspectRatio():float (if Float.NaN, aspect ratio is not fixed)
If any of these return true/non-NaN, Component would know that it shouldn't use
the cached value.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.