Package javax.swing.undo

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


        UndoableEdit ue = content.remove(3, 8);
        Position pos = content.createPosition(3);
        assertEquals(3, pos.getOffset());
        ue.undo();
        assertEquals(11, pos.getOffset());
        ue.redo();
        assertEquals(3, pos.getOffset());
    }

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


    public void testCreatePositionAfterUndone() throws BadLocationException {
        UndoableEdit ue = content.remove(3, 8);
        ue.undo();
        Position pos = content.createPosition(5);
        assertEquals(5, pos.getOffset());
        ue.redo();
        assertEquals(3, pos.getOffset());
        ue.undo();
        assertEquals(5, pos.getOffset());
    }
View Full Code Here

        UndoableEdit ue = content.insertString(10, "big ");
        Position pos = content.createPosition(12);
        assertEquals(12, pos.getOffset());
        ue.undo();
        assertEquals(10, pos.getOffset());
        ue.redo();
        assertEquals(12, pos.getOffset());
    }

    public static int getIndex(final Position pos) {
        try {
View Full Code Here

        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());
    }

    public void testCreatePositionAfterUndone() throws BadLocationException {
        UndoableEdit undoable;
View Full Code Here

        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();
        assertEquals(5, pos.getOffset());
    }
View Full Code Here

        undoable = content.insertString(10, "big ");
        Position pos = content.createPosition(12);
        assertEquals(12, pos.getOffset());
        undoable.undo();
        assertEquals(10, pos.getOffset());
        undoable.redo();
        assertEquals(12, pos.getOffset());
    }

    public void testCreatePosition_WithInvalidValues() throws BadLocationException {
        content = new StringContent(10);
View Full Code Here

        content.getChars(0, content.length(), text);
        assertEquals(20, text.array.length);
        assertEquals("01^^^2345\n", content.getString(0, content.length()));
        ue.undo();
        assertEquals("012345\n", content.getString(0, content.length()));
        ue.redo();
        assertEquals("01^^^2345\n", content.getString(0, content.length()));
    }

    public void testInsertString_WithInvalidValues() throws BadLocationException {
        content = new StringContent();
View Full Code Here

        assertFalse(undoable.canRedo());
        assertTrue(undoable.canUndo());
        undoable.undo();
        assertTrue(undoable.canRedo());
        assertFalse(undoable.canUndo());
        undoable.redo();
        assertFalse(undoable.canRedo());
        assertTrue(undoable.canUndo());
        assertFalse(undoable.addEdit(null));
        assertFalse(undoable.addEdit(undoable));
    }
View Full Code Here

        assertEquals(20, text.array.length);
        assertNotNull(undoable);
        assertEquals("0111111\n", content.getString(0, content.length()));
        undoable.undo();
        assertEquals("012345^11111\n", content.getString(0, content.length()));
        undoable.redo();
        assertEquals("0111111\n", content.getString(0, content.length()));
    }

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

        assertFalse(undoable.canRedo());
        assertTrue(undoable.canUndo());
        undoable.undo();
        assertTrue(undoable.canRedo());
        assertFalse(undoable.canUndo());
        undoable.redo();
        assertFalse(undoable.canRedo());
        assertTrue(undoable.canUndo());
        assertFalse(undoable.addEdit(null));
        assertFalse(undoable.addEdit(undoable));
    }
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.