|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.undo.AbstractUndoableEdit
javax.swing.undo.CompoundEdit
javax.swing.undo.UndoManager
proyecto.undo.CompoundUndoManager
public class CompoundUndoManager
CompoundUndoManager.
Existe un problema cuando se rehace y se deshace acciones en nuestro editor, ello viene debido a que el UndoManager de java considera una acción el pintado de la palabra. Por eso se necesita adaptar dicha clase para el funcionamiento correcto del deshacer y rehacer (undo y redo).
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.
CompoundEdit
,
UndoManager
,
Serialized FormNested Class Summary | |
---|---|
(package private) class |
CompoundUndoManager.MyCompoundEdit
The Class MyCompoundEdit. |
Field Summary | |
---|---|
CompoundEdit |
compoundEdit
The compound edit. |
Fields inherited from class javax.swing.undo.CompoundEdit |
---|
edits |
Fields inherited from class javax.swing.undo.AbstractUndoableEdit |
---|
RedoName, UndoName |
Constructor Summary | |
---|---|
CompoundUndoManager(JTextComponent editor)
Constructor compound undo manager. |
Method Summary | |
---|---|
void |
changedUpdate(DocumentEvent e)
|
void |
insertUpdate(DocumentEvent e)
Implement DocumentListener Updates to the Document as a result of Undo/Redo will cause the Caret to be repositioned |
static void |
main(String[] args)
Método main. |
void |
redo()
Add a DocumentLister before the redo is done so we can position |
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)
Whenever an UndoableEdit happens the edit will either be absorbed by the current compound edit or a new compound edit will be started |
Methods inherited from class javax.swing.undo.UndoManager |
---|
addEdit, canRedo, canUndo, canUndoOrRedo, discardAllEdits, editToBeRedone, editToBeUndone, end, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, redoTo, setLimit, toString, trimEdits, trimForLimit, undoOrRedo, undoTo |
Methods inherited from class javax.swing.undo.CompoundEdit |
---|
die, getPresentationName, isInProgress, isSignificant, lastEdit |
Methods inherited from class javax.swing.undo.AbstractUndoableEdit |
---|
replaceEdit |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public CompoundEdit compoundEdit
Constructor Detail |
---|
public CompoundUndoManager(JTextComponent editor)
editor
- the editorMethod Detail |
---|
public void undo()
undo
in interface UndoableEdit
undo
in class UndoManager
UndoManager.undo()
public void redo()
redo
in interface UndoableEdit
redo
in class UndoManager
UndoManager.redo()
public void undoableEditHappened(UndoableEditEvent e)
undoableEditHappened
in interface UndoableEditListener
undoableEditHappened
in class UndoManager
UndoManager.undoableEditHappened(javax.swing.event.UndoableEditEvent)
public void insertUpdate(DocumentEvent e)
insertUpdate
in interface DocumentListener
DocumentListener.insertUpdate(javax.swing.event.DocumentEvent)
public void removeUpdate(DocumentEvent e)
removeUpdate
in interface DocumentListener
public void changedUpdate(DocumentEvent e)
changedUpdate
in interface DocumentListener
public static void main(String[] args)
args
- the arguments
Creado : Parras, 05-oct-2009
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |