[
https://issues.apache.org/jira/browse/PIVOT-772?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Roger Whitcomb reopened PIVOT-772:
----------------------------------
Hi Noel,
After some more testing with our real application, there are still some funny
things remaining:
1) Often the first time I call "getCharacterBounds" after an arbitrary insert
it gets really large Y values:
index: 90, char 0xa, bounds: org.apache.pivot.wtk.Bounds [4,1306;2x16]
index: 123, char 0x2e, bounds: org.apache.pivot.wtk.Bounds [214,116;7x16]
2) It seems to not scroll enough so that by the last line often the last one or
more lines are not visible. This looks to be because the TextArea component
height isn't getting updated correctly. For instance, in this case the Bounds
is returning a Y value of 308 (plus line size of 16), but the viewHeight for
the TextArea component (during "scrollAreaToVisible") is only returning 280,
resulting in an incorrect "scrollTop" calculation:
index: 414, char 0xa, bounds: org.apache.pivot.wtk.Bounds [291,308;2x16]
scrollAreaToVisible: area [291,304,2,16], viewport org.apache.pivot.wtk.Bounds
[0,0;523x260]
scrollAreaToVisible: deltaX = 0
scrollAreaToVisible: deltaY = 60
scrollAreaToVisible: viewHeight = 280
scrollAreaToVisible: new scrollTop=20
But, if you take the scrollbar to the bottom end, the final "scrollTop" gets to
be (and should be) 84 (which includes the 308 + 16 for that line, plus another
16 for the empty line at the bottom + 4 for ??, or 344 altogether which = 260 +
84). So, the cumulative error is 64 pixels in this example, which leaves me
about 4 lines still scrolled off the bottom.
As you can probably tell, I still don't understand all the calculations
involved here.
You can see these errors (a little bit, not as pronounced) using the example
code.
I put tracing statements into Component.scrollAreaToVisible to get these
results.
Thanks again for your attention to this issue.
> Exceptions thrown when calling getCharacterBounds of TextArea when incomplete
> lines exist
> -----------------------------------------------------------------------------------------
>
> Key: PIVOT-772
> URL: https://issues.apache.org/jira/browse/PIVOT-772
> Project: Pivot
> Issue Type: Bug
> Components: wtk
> Affects Versions: 2.0.1
> Environment: Windows XP SP3, JRE 1.6_25 or JRE 1.7 (beta)
> Reporter: Roger Whitcomb
> Assignee: Noel Grandin
> Priority: Minor
> Fix For: 2.0.1
>
> Attachments: Scroll.java, scroll.bxml, scroll.log, scroll2.log
>
> Original Estimate: 48h
> Remaining Estimate: 48h
>
> If partial lines are appended to a TextArea and then "getCharacterBounds"
> followed by "scrollAreaToVisible" is called, Pivot throws
> java.lang.IndexOutOfBoundsException from
> TextAreaSkinParagraphView.getCharacterBounds:
> java.lang.IndexOutOfBoundsException: ix = 38
> at sun.font.StandardGlyphVector.getGlyphLogicalBounds(Unknown Source)
> at
> org.apache.pivot.wtk.skin.TextAreaSkinParagraphView.getCharacterBounds(TextAreaSkinParagraphView.java:393)
> at
> org.apache.pivot.wtk.skin.TextAreaSkin.getCharacterBounds(TextAreaSkin.java:442)
> at
> org.apache.pivot.wtk.TextArea.getCharacterBounds(TextArea.java:1243)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira