Closed homebeaver closed 2 years ago
Is this only happening for empty title or empty description? I can't reproduce this in the SVG viewer demo.
If this is only happening in those cases, I'd rather throw an exception in the RichTooltip.Builder.build()
to not accept rich tooltips like that and force application code to provide that content.
With SVG File Viewer I open the folder
theming/src/main/java/org/pushingpixels/radiance/theming/internal/svg/
The titleLabelWidth is calculated in BasicRichTooltipPanelUI$RichTooltipPanelLayout layoutContainer
line 327. I add a log-trace there:
// The title label
int titleLabelWidth = parent.getWidth() - ins.left - ins.right;
if(titleLabelWidth<0)
LOG.info("parent Container:"+parent + ", parent.getWidth()="+parent.getWidth() + ", ins.left="+ins.left + ", ins.right="+ins.right);
... results to
INFORMATION: parent Container:org.pushingpixels.radiance.component.internal.ui.common.JRichTooltipPanel[,0,0,1x1,invalid,layout=org.pushingpixels.radiance.component.internal.ui.common.BasicRichTooltipPanelUI$RichTooltipPanelLayout,alignmentX=0.0,alignmentY=0.0,border=org.pushingpixels.radiance.theming.internal.utils.border.RadianceBorder@372f64a0,flags=9,maximumSize=,minimumSize=,preferredSize=],
parent.getWidth()=1, ins.left=5, ins.right=5
So titleLabelWidth
is -9!
The fix should address the real issue, which is a 1x1 size of the JRichTooltipPanel
Comment on the new commit:
This is still addressing the symptom. It should not be getting to a place where the size is 1x1.
The first place to check would be RichTooltipPanelLayout.preferredLayoutSize. The next one would be in RichTooltipManager.showTipWindow or maybe a bit before to track where the size is computed and set on the JRichTooltipPanel. There's a block in lines 205-207 that computes that.
Hi @kirill-grouchnikov I could not find why JRichTooltipPanel is 1x1
But I can reproduce the problem:
How to reproduce:
Where do I find SvgViewer413
?
commit 67b3bf0
Still not seeing this. Is this happening for you on other machines with different OS / JVM versions?
Ah, I see it now with Java 17
Ugh, I would consider this a regression introduced in the JDK by this commit, and in particular this line that sets the popup content to the size of 1x1 before pack
ing it.
Not much I can do in Radiance to work around this except for short-circuiting and not doing anything in the layout pass if the size is 1x1.
Hi Kirill,
when using SVG File Viewer I get this OfBoundsException. To reproduce try to get the tooltip on an icon at right border.
Version of Radiance (latest development is 6.5-SNAPSHOT) : v5.0.0
Sub-project (Common, Animation, Theming, Component, ...) : component
Version of Java (current minimum is 9) : 17
Version of OS : WIN-10
The issue you're experiencing (expected vs actual, screenshot, stack trace etc)
Stack trace (line numbers not exact, because I add some log traces):