<Swing Dev> [9] Review request for 8048110: Using tables in JTextPane leads to infinite loop in FlowLayout.layoutRow

dmitry markov dmitry.markov at oracle.com
Thu Aug 21 09:03:55 UTC 2014


Hello,

Reminder. Could you review this, please?

Thanks,
Dmitry
On 18/08/2014 12:10, dmitry markov wrote:
> Hello Sergey,
>
> LogicalView.forwardUpdate() sends update event to all views followed 
> by the changed place. This event will cause view to drop the cache and 
> re-calculate its break points. This method was added under JDK-8024395 
> <https://bugs.openjdk.java.net/browse/JDK-8024395> and intended for 
> the documents contained only text elements. The current implementation 
> does not expect that non-text element, (e.g. a table) can be added to 
> the document.
> If the table is added to the document with flow layout, the invocation 
> of LogicalView.forwardUpdate() will produce some negative visual 
> effects (table will be displayed several times). In case of replacing 
> the text by the table the situation much worse, since the FlowView 
> will try to re-layout the removed text and hangs.
>
> We have to send the update events to all instances of GlyphView 
> followed by changed place for proper text line breaks calculation, see 
> JDK-8024395 <https://bugs.openjdk.java.net/browse/JDK-8024395>, 
> JDK-8014863 <https://bugs.openjdk.java.net/browse/JDK-8014863>. That's 
> why I added checks for GlyphView instance. I understand this might be 
> not a good place, but only here we have information about all views in 
> the document and can forward update to them, if any.
> Please note another approach to solve the problems with line breaks 
> calculation - re-calculate break spots any time when a view is laid 
> out. As far as I know it is used in jdk6, but this solution is not 
> suitable, since it causes serious performance problems in case of 
> large documents.
>
> Also I have updated the fix. New version - 
> http://cr.openjdk.java.net/~dmarkov/8048110/jdk9/webrev.01/
> Now LogicalView.forwardUpdate() sends update only to GlyphView 
> followed by the changed place. This resolves the problem when the 
> table is located in the middle of the text line.
>
> Thanks,
> Dmitry
>
> On 15/08/2014 12:56, Sergey Bylokhov wrote:
>> Hello, Dmitry.
>>>> The LogicalView.forwardUpdate() should send an update event to the views
>>>> followed by the changed place, only when an instance of GlyphView has
>>>> changed; otherwise it should invoke View.forwardUpdate() to handle the
>>>> update properly.
>> Can you share additional information about the fix. Why LogicalView should send an update if GlyphView was changed only. Because before the fix LocalView knows nothing about GlyphView.
>>
>> Thanks,
>> Dmitry
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20140821/f4f2781c/attachment.html>


More information about the swing-dev mailing list