classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: Swing text document structure fixes


From: Roman Kennke
Subject: [cp-patches] FYI: Swing text document structure fixes
Date: Wed, 23 Nov 2005 14:19:20 +0000

Hi,

I have added lots of Mauve tests for the element structure updates in
DefaultStyledDocument and the corresponding DocumentEvents that should
be fired. Obviously my previous implementation was mostly bogus and it
was pure luck that anything worked at all with the JTextPane. The test
cases were very interesting to play with and I think now I understand a
little better what the ElementBuffer class should really do. The old fun
with underspecified APIs ;-)

I fixed the AbstractDocument and DefaultStyledDocument to make all these
new Mauve tests pass. However, since I threw away almost all of the old
code in this area, this still means a kind of regression to the previous
state, we throw some more exceptions now than before. I will extend the
testsuite for the ElementBuffer some more to track down the remaining
behavioural aspects of this class.

2005-11-23  Roman Kennke  <address@hidden>

        * javax/swing/text/DefaultStyledDocument.java
        (ElementBuffer.numEndTags): New field.
        (ElementBuffer.numStartTags): New field.
        (ElementBuffer.elementStack): New field.
        (ElementBuffer.ElementBuffer): Initialize element stack here.
        (ElementBuffer.changeUpdate): Correctly perform splitting of
        elements.
        (ElementBuffer.split): Change to make recursive splits possible.
        (ElementBuffer.insert): Clear and initialize elementStack and num*
        fields.
        (ElementBuffer.inserUpdate): Inlined the functionality for start
        and end tags. Call endEdit on finish.
        (ElementBuffer.endEdit): New method. Finishes off an edit run.
        (ElementBuffer.prepareContentInsertion): New method. Prepares
        the insertion of content.
        (ElementBuffer.insertParagraph): New method. Inserts a new
        paragraph at a given offset.
        (ElementBuffer.insertContentTag): Call prepareContentInsertion
first.
        Fixed behaviour for all the different possible directions.
        (ElementBuffer.addEdit): New method. Adds an element edit to the
        document event and possible merges with previous edits.
        (insert): Only fire event when something has really changed.
        * javax/swing/text/AbstractDocument.java
        (insertString): Only fire event when something has really changed.
        (DefaultDocumentEvent.modified): New field.
        (DefaultDocumentEvent.DefaultDocumentEvent): Inititialize modified
        field.
        (DefaultDocumentEvent.addEdit): Set modified flag to true.

/Roman

Attachment: patch.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]