Package javax.swing.undo

Examples of javax.swing.undo.UndoableEdit.undo()


        // This call causes all the garbage collected positions to be
        // removed from the internal list
        UndoableEdit ue = content.remove(0, 5);
        assertEquals("5678", content.getString(0, content.length() - 1));
        // Test (it shouldn't fail with any NullPointerException)
        ue.undo();
        assertEquals("012345678", content.getString(0, content.length() - 1));
    }
}
View Full Code Here


        insertEdit = content.insertString(0, "01234");
    }

    public void testUndoInsertEnd() throws BadLocationException {
        UndoableEdit ue = content.insertString(5, "567");
        ue.undo();
        assertEquals("01234\n", content.getString(0, content.length()));
    }

    public void testUndoInsertStart() throws BadLocationException {
        UndoableEdit ue = content.insertString(0, "321");
View Full Code Here

        assertEquals("01234\n", content.getString(0, content.length()));
    }

    public void testUndoInsertStart() throws BadLocationException {
        UndoableEdit ue = content.insertString(0, "321");
        ue.undo();
        assertEquals("01234\n", content.getString(0, content.length()));
    }

    public void testUndoInsertMiddle() throws BadLocationException {
        UndoableEdit ue = content.insertString(3, "999");
View Full Code Here

        assertEquals("01234\n", content.getString(0, content.length()));
    }

    public void testUndoInsertMiddle() throws BadLocationException {
        UndoableEdit ue = content.insertString(3, "999");
        ue.undo();
        assertEquals("01234\n", content.getString(0, content.length()));
    }

    public void testUndoRemoveEnd() throws BadLocationException {
        UndoableEdit ue = content.remove(3, 2);
View Full Code Here

        assertEquals("01234\n", content.getString(0, content.length()));
    }

    public void testUndoRemoveEnd() throws BadLocationException {
        UndoableEdit ue = content.remove(3, 2);
        ue.undo();
        assertEquals("01234\n", content.getString(0, content.length()));
    }

    public void testUndoRemoveStart() throws BadLocationException {
        UndoableEdit ue = content.remove(0, 2);
View Full Code Here

        assertEquals("01234\n", content.getString(0, content.length()));
    }

    public void testUndoRemoveStart() throws BadLocationException {
        UndoableEdit ue = content.remove(0, 2);
        ue.undo();
        assertEquals("01234\n", content.getString(0, content.length()));
    }

    public void testUndoRemoveMiddle() throws BadLocationException {
        UndoableEdit ue = content.remove(3, 2);
View Full Code Here

        assertEquals("01234\n", content.getString(0, content.length()));
    }

    public void testUndoRemoveMiddle() throws BadLocationException {
        UndoableEdit ue = content.remove(3, 2);
        ue.undo();
        assertEquals("01234\n", content.getString(0, content.length()));
    }

    public void testUndoPresentationInsertName() {
        final String name = BasicSwingTestCase.isHarmony() ? "addition" : "";
View Full Code Here

        content = new StringContent(10);
        content.insertString(0, "0123456789");
        undoable = content.remove(3, 5);
        Position pos1 = content.createPosition(3);
        assertEquals(3, pos1.getOffset());
        undoable.undo();
        content = new StringContent(10);
        content.insertString(0, "0123456789");
        undoable = content.remove(3, 5);
        Position pos = content.createPosition(3);
        assertEquals(3, pos.getOffset());
View Full Code Here

        content = new StringContent(10);
        content.insertString(0, "0123456789");
        undoable = content.remove(3, 5);
        Position pos = content.createPosition(3);
        assertEquals(3, pos.getOffset());
        undoable.undo();
        assertEquals(8, pos.getOffset());
        undoable.redo();
        assertEquals(3, pos.getOffset());
    }
View Full Code Here

    public void testCreatePositionAfterUndone() throws BadLocationException {
        UndoableEdit undoable;
        content = new StringContent(10);
        content.insertString(0, "0123456789");
        undoable = content.remove(3, 5);
        undoable.undo();
        Position pos = content.createPosition(5);
        assertEquals(5, pos.getOffset());
        undoable.redo();
        assertEquals(3, pos.getOffset());
        undoable.undo();
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.