adalogo.gui.editor

Class CompoundUndoManager

Implemented Interfaces:
DocumentListener

public class CompoundUndoManager
extends UndoManager
implements DocumentListener

This class will merge individual edits into a single larger edit. That is, characters entered sequentially will be grouped together and undone as a group. Any attribute changes will be considered as part of the group and will therefore be undone when the group is undone.

original code from camickr
http://forum.java.sun.com/thread.jspa?threadID=637225

Nested Class Summary

Field Summary

CompoundUndoManager.RedoAction
redoAction
CompoundUndoManager.UndoAction
undoAction

Constructor Summary

CompoundUndoManager(JTextComponent textComp)

Method Summary

void
changedUpdate(DocumentEvent e)
void
insertUpdate(DocumentEvent e)
Updates to the Document as a result of Undo/Redo will cause the Caret to be repositioned
void
redo()
Add a DocumentLister before the redo is done so we can position the Caret correctly as each edit is redone.
void
removeUpdate(DocumentEvent e)
void
undo()
Add a DocumentLister before the undo is done so we can position the Caret correctly as each edit is undone.
void
undoableEditHappened(UndoableEditEvent e)
handle undoable edit and then update the actions.

Field Details

redoAction

public CompoundUndoManager.RedoAction redoAction


undoAction

public CompoundUndoManager.UndoAction undoAction

Constructor Details

CompoundUndoManager

public CompoundUndoManager(JTextComponent textComp)

Method Details

changedUpdate

public void changedUpdate(DocumentEvent e)


insertUpdate

public void insertUpdate(DocumentEvent e)
Updates to the Document as a result of Undo/Redo will cause the Caret to be repositioned


redo

public void redo()
Add a DocumentLister before the redo is done so we can position the Caret correctly as each edit is redone.


removeUpdate

public void removeUpdate(DocumentEvent e)


undo

public void undo()
Add a DocumentLister before the undo is done so we can position the Caret correctly as each edit is undone.


undoableEditHappened

public void undoableEditHappened(UndoableEditEvent e)
handle undoable edit and then update the actions.