Package javax.swing.text.AbstractDocument

Examples of javax.swing.text.AbstractDocument.DefaultDocumentEvent


     * <code>setUp()</code>.
     */
    public void testInsertDiffAttrsMiddle() throws Exception {
        // doc.insertString(insertOffset, caps, null);
        content.insertString(insertOffset, caps);
        event = doc.new DefaultDocumentEvent(insertOffset, capsLen, EventType.INSERT);
        ElementSpec spec = new ElementSpec(null, ElementSpec.ContentType, capsLen);
        buf.insert(insertOffset, capsLen, new ElementSpec[] { spec }, event);
        List<?> edits = getEdits(event);
        assertEquals(1, edits.size());
        assertChange(edits.get(0), new int[] { 5, 12 }, new int[] { 5, 7, 7, 10, 10, 12 });
View Full Code Here


     */
    public void testInsertDiffAttrsEnd() throws Exception {
        insertOffset += 2;
        // doc.insertString(insertOffset, caps, null);
        content.insertString(insertOffset, caps);
        event = doc.new DefaultDocumentEvent(insertOffset, capsLen, EventType.INSERT);
        ElementSpec spec = new ElementSpec(null, ElementSpec.ContentType, capsLen);
        buf.insert(insertOffset, capsLen, new ElementSpec[] { spec }, event);
        List<?> edits = getEdits(event);
        assertEquals(1, edits.size());
        assertChange(edits.get(0), new int[] { 5, 12 }, new int[] { 5, 9, 9, 12 });
View Full Code Here

     */
    public void testInsertDiffSameAttrsEnd() throws Exception {
        insertOffset += 2;
        // doc.insertString(insertOffset, caps, italic);
        content.insertString(insertOffset, caps);
        event = doc.new DefaultDocumentEvent(insertOffset, capsLen, EventType.INSERT);
        ElementSpec spec = new ElementSpec(italic, ElementSpec.ContentType, capsLen);
        spec.setDirection(ElementSpec.JoinNextDirection);
        buf.insert(insertOffset, capsLen, new ElementSpec[] { spec }, event);
        List<?> edits = getEdits(event);
        assertEquals(1, edits.size());
View Full Code Here

     */
    public void testInsertSameAttrsParStart() throws Exception {
        insertOffset = paragraph.getEndOffset();
        // doc.insertString(insertOffset, caps, null);
        content.insertString(insertOffset, caps);
        event = doc.new DefaultDocumentEvent(insertOffset, capsLen, EventType.INSERT);
        ElementSpec[] specs = { new ElementSpec(null, ElementSpec.EndTagType),
                new ElementSpec(null, ElementSpec.StartTagType),
                new ElementSpec(null, ElementSpec.ContentType, capsLen), };
        specs[1].setDirection(ElementSpec.JoinNextDirection);
        specs[2].setDirection(ElementSpec.JoinNextDirection);
View Full Code Here

     */
    public void testInsertDiffAttrsParStart() throws Exception {
        insertOffset = paragraph.getEndOffset();
        // doc.insertString(insertOffset, caps, italic);
        content.insertString(insertOffset, caps);
        event = doc.new DefaultDocumentEvent(insertOffset, capsLen, EventType.INSERT);
        ElementSpec[] specs = { new ElementSpec(null, ElementSpec.EndTagType),
                new ElementSpec(null, ElementSpec.StartTagType),
                new ElementSpec(italic, ElementSpec.ContentType, capsLen), };
        specs[1].setDirection(ElementSpec.JoinNextDirection);
        buf.insert(insertOffset, capsLen, specs, event);
View Full Code Here

     */
    public void testInsertSameAttrsDocEnd() throws Exception {
        insertOffset = doc.getLength();
        // doc.insertString(insertOffset, caps, null);
        content.insertString(insertOffset, caps);
        event = doc.new DefaultDocumentEvent(insertOffset, capsLen, EventType.INSERT);
        ElementSpec spec = new ElementSpec(null, ElementSpec.ContentType, capsLen);
        spec.setDirection(ElementSpec.JoinPreviousDirection);
        buf.insert(insertOffset, capsLen, new ElementSpec[] { spec }, event);
        List<?> edits = getEdits(event);
        assertEquals(0, edits.size());
View Full Code Here

     */
    public void testInsertDiffAttrsDocEnd() throws Exception {
        insertOffset = doc.getLength();
        // doc.insertString(insertOffset, caps, italic);
        content.insertString(insertOffset, caps);
        event = doc.new DefaultDocumentEvent(insertOffset, capsLen, EventType.INSERT);
        ElementSpec spec = new ElementSpec(italic, ElementSpec.ContentType, capsLen);
        buf.insert(insertOffset, capsLen, new ElementSpec[] { spec }, event);
        List<?> edits = getEdits(event);
        assertEquals(1, edits.size());
        assertChange(edits.get(0), new int[] { 16, 24 }, new int[] { 16, 20, 20, 23, 23, 24 });
View Full Code Here

        assertNull(preferenceChange);
        view.updateDamage(event, shape, factory);
        assertNull(lineRange);
        preferenceChange.check(true, true);
        preferenceChange = null;
        event = ((AbstractDocument) doc).new DefaultDocumentEvent(3, 14,
                DocumentEvent.EventType.CHANGE);
        view.updateDamage(event, shape, factory);
        lineRange.check(0, 0, shape, container);
        lineRange = null;
        assertNull(preferenceChange);
        event = ((AbstractDocument) doc).new DefaultDocumentEvent(7, 12,
                DocumentEvent.EventType.CHANGE);
        view.updateDamage(event, shape, factory);
        lineRange.check(1, 1, shape, container);
        lineRange = null;
        assertNull(preferenceChange);
View Full Code Here

                    updateDamageCalled = true;
                }
            }
        };
        shape = new Rectangle(500, 500);
        event = ((AbstractDocument) doc).new DefaultDocumentEvent(0, 0,
                DocumentEvent.EventType.CHANGE);
        factory = new ViewFactory() {
            public View create(final Element element) {
                fail("factory.create() isn't supposed to be called");
                return null;
View Full Code Here

    public void testInsertThreePars() throws Exception {
        final String text = "first\nsecond\nthird";
        final int textLen = text.length();
        //doc.insertString(0, text, null);
        content.insertString(0, text);
        event = doc.new DefaultDocumentEvent(0, textLen, EventType.INSERT);
        ElementSpec[] specs = { new ElementSpec(null, ElementSpec.ContentType, 6),
                new ElementSpec(null, ElementSpec.EndTagType),
                new ElementSpec(null, ElementSpec.StartTagType),
                new ElementSpec(null, ElementSpec.ContentType, 7),
                new ElementSpec(null, ElementSpec.EndTagType),
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.