Package javax.swing.undo

Examples of javax.swing.undo.UndoableEdit


    /**
     * Removes an object, depending on its type
     */
    private UndoableEdit removeLastPathComponent(Object object) {

        UndoableEdit undo = null;

        if (object instanceof DataMap) {
            undo = new RemoveUndoableEdit(application, (DataMap) object);
            removeDataMap((DataMap) object);
        }
View Full Code Here


            }catch(Exception e){}
        }

        public void undoableEditHappened(UndoableEditEvent e) {
            try{
                UndoableEdit edit = e.getEdit();
                ((UndoManager)vUndoManagers.elementAt(tabbed.getSelectedIndex())).addEdit(edit);
                // undomgr.addEdit(edit);
                updateUndo(); //_actualiza estado de botones
            }catch(Exception ex){}
        }
View Full Code Here

    }

    public void undo() throws javax.swing.undo.CannotUndoException {
        compoundEdit.end();

        UndoableEdit edit = editToBeUndone();
        if (((StructuredEdit) editToBeUndone()).editedTime() ==
                firstModified) {
            firstModified = 0;
        } else if (firstModified == 0) {
            firstModified = ((StructuredEdit) editToBeUndone()).editedTime();
View Full Code Here

        super.undo();
        firePropertyChangeEvent(UndoManager.RedoName, redoable, canRedo());
    }

    public void undoableEditHappened(UndoableEditEvent uee) {
        UndoableEdit edit = uee.getEdit();
        boolean undoable = canUndo();

        long editTime = System.currentTimeMillis();

        if (firstModified == 0 ||
View Full Code Here

    String[] list = new String[edits.size()];
    Iterator<UndoableEdit> itr = edits.iterator();
    int i = 0;

    while (itr.hasNext()) {
      UndoableEdit e = itr.next();
      list[i++] = e.getPresentationName();
    }

    return list;
  }
View Full Code Here

        assertEquals(pos.size(), v.size());
        int[] offsets = new int[v.size()];
        for (int i = 0; i < pos.size(); i++) {
            offsets[i] = pos.get(i).getOffset();
        }
        UndoableEdit ue = content.remove(0, 9);
        ue.undo();
        for (int i = 0; i < pos.size(); i++) {
            assertEquals(offsets[i], pos.get(i).getOffset());
        }
    }
View Full Code Here

        cont1 = new GapContent() {
            private static final long serialVersionUID = 1L;

            @Override
            public UndoableEdit remove(int where, int len) throws BadLocationException {
                UndoableEdit u = super.remove(where, len);
                return u;
            }

            @Override
            public UndoableEdit insertString(int offset, String str)
                    throws BadLocationException {
                UndoableEdit u = super.insertString(offset, str);
                return u;
            }

            @SuppressWarnings("unchecked")
            @Override
View Full Code Here

        } catch (NullPointerException e) {
        }
    }

    public void testCreatePositionBeforeUndo() throws BadLocationException {
        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());
    }
View Full Code Here

        ue.redo();
        assertEquals(3, pos.getOffset());
    }

    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

        ue.undo();
        assertEquals(5, pos.getOffset());
    }

    public void testCreatePositionAfterInsert() throws BadLocationException {
        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());
    }
View Full Code Here

TOP

Related Classes of javax.swing.undo.UndoableEdit

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.