Package javax.swing.text.AbstractDocument

Examples of javax.swing.text.AbstractDocument.DefaultDocumentEvent


        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


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

    public void testChangedUpdate() {
        event = doc.new DefaultDocumentEvent(4, 5, EventType.CHANGE);
        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.changedUpdate(view, event, alloc);
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 testInsertSameAttrsDocStart() throws Exception {
        insertOffset = 0;
        // 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 testInsertDiffAttrsDocStart() throws Exception {
        insertOffset = 0;
        // doc.insertString(insertOffset, caps, italic);
        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[] { 0, 8 }, new int[] { 0, 3, 3, 8 });
View Full Code Here

     * <code>setUp()</code>.
     */
    public void testInsertSameAttrsMiddle() throws Exception {
        // doc.insertString(insertOffset, caps, bold);
        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 testInsertSameAttrsEnd() throws Exception {
        insertOffset += 2;
        // doc.insertString(insertOffset, caps, bold);
        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

     * <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

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.