Package javax.swing.text.AbstractDocument

Examples of javax.swing.text.AbstractDocument.DefaultDocumentEvent.undo()


        assertTrue(edit.addEdit(insert));
        assertTrue(edit.addEdit(remove));
        assertEquals(2, getEdits(edit).size());
        // Stop collecting and make undo
        edit.end();
        edit.undo();
        // The document should be in its intial state
        assertEquals("", doc.getText(0, doc.getLength()));
    }

    private static HashMap<?, ?> getChanges(final DefaultDocumentEvent event) {
View Full Code Here


        }
        edit.addEdit((UndoableEdit) getEdits(edit).get(0));
        edit.end();
        // A new edit shouldn't be added 'cause we have called end()
        assertFalse(edit.addEdit((UndoableEdit) getEdits(edit).get(1)));
        edit.undo();
        edit.redo();
        // Do the check
        for (int i = 0; i < parent.length; i++) {
            ElementChange change = edit.getChange(parent[i]);
            assertSame("Objects are not same at " + i, child[i], change);
View Full Code Here

        assertSame(undoEvent.getEdit(), remove);
        insert = null;
        remove = null;
        undoEvent = null;
        // Try to undo
        removeEvent.undo();
        assertNull(remove);
        assertNotNull(insert);
        assertNull(undoEvent);
        DefaultDocumentEvent undoInsertEvent = insert;
        insert = null;
View Full Code Here

        assertTrue(edit.addEdit(insert));
        assertTrue(edit.addEdit(remove));
        assertEquals(2, getEdits(edit).size());
        // Stop collecting and make undo
        edit.end();
        edit.undo();
        // The document should be in its intial state
        assertEquals("", doc.getText(0, doc.getLength()));
    }

    private static HashMap<?, ?> getChanges(final DefaultDocumentEvent event) {
View Full Code Here

        }
        edit.addEdit((UndoableEdit) getEdits(edit).get(0));
        edit.end();
        // A new edit shouldn't be added 'cause we have called end()
        assertFalse(edit.addEdit((UndoableEdit) getEdits(edit).get(1)));
        edit.undo();
        edit.redo();
        // Do the check
        for (int i = 0; i < parent.length; i++) {
            ElementChange change = edit.getChange(parent[i]);
            assertSame("Objects are not same at " + i, child[i], change);
View Full Code Here

        assertSame(undoEvent.getEdit(), remove);
        insert = null;
        remove = null;
        undoEvent = null;
        // Try to undo
        removeEvent.undo();
        assertNull(remove);
        assertNotNull(insert);
        assertNull(undoEvent);
        DefaultDocumentEvent undoInsertEvent = insert;
        insert = null;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.