Package javax.swing.text.AbstractDocument

Examples of javax.swing.text.AbstractDocument.DefaultDocumentEvent


     */
    public void testInsertDiffAttrsDocEnd() throws Exception {
        insertOffset = doc.getLength();
        // doc.insertString(insertOffset, newLine, italic);
        content.insertString(insertOffset, newLine);
        event = doc.new DefaultDocumentEvent(insertOffset, newLineLen, EventType.INSERT);
        ElementSpec[] specs = { new ElementSpec(italic, ElementSpec.ContentType, newLineLen),
                new ElementSpec(null, ElementSpec.EndTagType),
                new ElementSpec(null, ElementSpec.StartTagType) };
        specs[2].setDirection(ElementSpec.JoinFractureDirection);
        buf.insert(insertOffset, newLineLen, specs, event);
View Full Code Here


            final AttributeSet[] attributes) {
        DefStyledDoc_Helpers.assertChildren(element, offsets, attributes);
    }

    private DefaultDocumentEvent createEvent(final int offset, final int length) {
        event = doc.new DefaultDocumentEvent(offset, length, EventType.CHANGE);
        return event;
    }
View Full Code Here

            final AttributeSet[] attributes) {
        DefStyledDoc_Helpers.assertChildren(element, offsets, attributes);
    }

    private DefaultDocumentEvent createEvent(final int offset, final int length) {
        event = doc.new DefaultDocumentEvent(offset, length, EventType.CHANGE);
        return event;
    }
View Full Code Here

     */
    public void testInsertSameAttrsDocStart3NewLines() throws Exception {
        insertOffset = 0;
        // doc.insertString(insertOffset, newLines3, null);
        content.insertString(insertOffset, newLines3);
        event = doc.new DefaultDocumentEvent(insertOffset, newLines3Len, EventType.INSERT);
        ElementSpec[] specs = { new ElementSpec(null, ElementSpec.ContentType, newLineLen),
                new ElementSpec(null, ElementSpec.EndTagType),
                new ElementSpec(null, ElementSpec.StartTagType),
                new ElementSpec(null, ElementSpec.ContentType, newLineLen),
                new ElementSpec(null, ElementSpec.EndTagType),
View Full Code Here

     */
    public void testInsertSameAttrsDocStart3NewLinesText() throws Exception {
        insertOffset = 0;
        // doc.insertString(insertOffset, newLines3Text, null);
        content.insertString(insertOffset, newLines3Text);
        event = doc.new DefaultDocumentEvent(insertOffset, newLines3Len * 2, EventType.INSERT);
        ElementSpec[] specs = { new ElementSpec(null, ElementSpec.ContentType, newLineLen * 2),
                new ElementSpec(null, ElementSpec.EndTagType),
                new ElementSpec(bold, ElementSpec.StartTagType),
                new ElementSpec(null, ElementSpec.ContentType, newLineLen * 2),
                new ElementSpec(null, ElementSpec.EndTagType),
View Full Code Here

                new ElementSpec(root.getElement(1).getAttributes(), ElementSpec.StartTagType, 0),
                new ElementSpec(SimpleAttributeSet.EMPTY, ElementSpec.ContentType, 5) };
        specs[0].setDirection(ElementSpec.JoinPreviousDirection);
        specs[2].setDirection(ElementSpec.JoinFractureDirection);
        specs[3].setDirection(ElementSpec.JoinNextDirection);
        event = doc.new DefaultDocumentEvent(doc.getLength(), 6, EventType.INSERT);
        int off = doc.getLength();
        // Insert the text into the content, so that ElementBuffer
        // could use proper offsets (or BadLocationException may be thrown).
        doc.getContent().insertString(off, "\nthird");
        doc.writeLock();
View Full Code Here

                super.remove(offset, length, event);
                assertEquals(0, edits.size());
            }
        };
        doc.buffer = buf;
        event = doc.new DefaultDocumentEvent(2, 2, EventType.REMOVE);
        doc.writeLock();
        try {
            buf.remove(2, 2, event);
        } finally {
            doc.writeUnlock();
View Full Code Here

                super.remove(offset, length, event);
                assertEquals(1, edits.size());
            }
        };
        doc.buffer = buf;
        event = doc.new DefaultDocumentEvent(2, 2, EventType.REMOVE);
        doc.writeLock();
        try {
            buf.remove(4, 3, event);
        } finally {
            doc.writeUnlock();
View Full Code Here

        super.tearDown();
        viewsCreated.clear();
    }

    public void testInsertUpdate() {
        event = doc.new DefaultDocumentEvent(4, 5, EventType.INSERT);
        event.addEdit(new ElementEdit(p1, 0, new Element[] { p1L }, new Element[] { p1L }));
        event.end();
        view.layout(alloc.width, alloc.height);
        assertTrue(view.isAllocationValid());
        view.strategy.insertUpdate(view, event, alloc);
View Full Code Here

        assertFalse(view.isLayoutValid(X_AXIS));
        assertFalse(view.isLayoutValid(Y_AXIS));
    }

    public void testRemoveUpdate() {
        event = doc.new DefaultDocumentEvent(4, 5, EventType.REMOVE);
        event.addEdit(new ElementEdit(p1, 0, new Element[] { p1L }, new Element[] { p1L }));
        event.end();
        view.layout(alloc.width, alloc.height);
        assertTrue(view.isAllocationValid());
        view.strategy.removeUpdate(view, event, alloc);
View Full Code Here

TOP

Related Classes of javax.swing.text.AbstractDocument.DefaultDocumentEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.