de.sciss.app
Class AbstractCompoundEdit

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by javax.swing.undo.CompoundEdit
          extended by de.sciss.app.AbstractCompoundEdit
All Implemented Interfaces:
PerformableEdit, java.io.Serializable, javax.swing.undo.UndoableEdit
Direct Known Subclasses:
BasicCompoundEdit

public abstract class AbstractCompoundEdit
extends javax.swing.undo.CompoundEdit
implements PerformableEdit

This subclass of CompoundEdit is used to synchronize an Undo or Redo operation. If for example, several edits of writing to a MultirateTrackEditor are recorded, this happens in a synchronized block. This class guarantees that an appropriate synchronization is maintained in an undo / redo operation.

Version:
0.58, 28-Sep-07
Author:
Hanns Holger Rutz
See Also:
Serialized Form
Todo:
perform() should optimize by checking addEdit and replaceEdit calls

Field Summary
 
Fields inherited from class javax.swing.undo.CompoundEdit
edits
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
protected AbstractCompoundEdit()
          Creates a CompountEdit object
protected AbstractCompoundEdit(java.lang.String presentationName)
          Creates a CompountEdit object with a given name
 
Method Summary
 void addPerform(PerformableEdit edit)
           
 void cancel()
          Cancels the compound edit and undos all sub edits made so far.
protected abstract  void cancelDone()
          This gets called after the cancel operation but still inside the sync block.
 void debugDump(int nest)
           
 java.lang.String getPresentationName()
           
 java.lang.String getRedoPresentationName()
           
protected  java.lang.String getResourceString(java.lang.String key)
           
 java.lang.String getUndoPresentationName()
           
 PerformableEdit perform()
           
 void redo()
          Performs redo on all compound sub edits
protected abstract  void redoDone()
          This gets called after the redo operation but still inside the sync block.
 void undo()
          Performs undo on all compound sub edits
protected abstract  void undoDone()
          This gets called after the undo operation but still inside the sync block.
 
Methods inherited from class javax.swing.undo.CompoundEdit
addEdit, canRedo, canUndo, die, end, isInProgress, isSignificant, lastEdit, toString
 
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
 
Methods inherited from interface javax.swing.undo.UndoableEdit
addEdit, canRedo, canUndo, die, isSignificant, replaceEdit
 

Constructor Detail

AbstractCompoundEdit

protected AbstractCompoundEdit()
Creates a CompountEdit object


AbstractCompoundEdit

protected AbstractCompoundEdit(java.lang.String presentationName)
Creates a CompountEdit object with a given name

Parameters:
presentationName - text describing the compound edit
Method Detail

undo

public void undo()
Performs undo on all compound sub edits

Specified by:
undo in interface javax.swing.undo.UndoableEdit
Overrides:
undo in class javax.swing.undo.CompoundEdit

redo

public void redo()
Performs redo on all compound sub edits

Specified by:
redo in interface javax.swing.undo.UndoableEdit
Overrides:
redo in class javax.swing.undo.CompoundEdit

cancel

public void cancel()
Cancels the compound edit and undos all sub edits made so far.


undoDone

protected abstract void undoDone()
This gets called after the undo operation but still inside the sync block. Subclasses can use this to fire any notification events.


redoDone

protected abstract void redoDone()
This gets called after the redo operation but still inside the sync block. Subclasses can use this to fire any notification events.


cancelDone

protected abstract void cancelDone()
This gets called after the cancel operation but still inside the sync block. Subclasses can use this to fire any notification events.


getPresentationName

public java.lang.String getPresentationName()
Specified by:
getPresentationName in interface javax.swing.undo.UndoableEdit
Overrides:
getPresentationName in class javax.swing.undo.CompoundEdit

getUndoPresentationName

public java.lang.String getUndoPresentationName()
Specified by:
getUndoPresentationName in interface javax.swing.undo.UndoableEdit
Overrides:
getUndoPresentationName in class javax.swing.undo.CompoundEdit

getRedoPresentationName

public java.lang.String getRedoPresentationName()
Specified by:
getRedoPresentationName in interface javax.swing.undo.UndoableEdit
Overrides:
getRedoPresentationName in class javax.swing.undo.CompoundEdit

getResourceString

protected java.lang.String getResourceString(java.lang.String key)

addPerform

public void addPerform(PerformableEdit edit)

perform

public PerformableEdit perform()
Specified by:
perform in interface PerformableEdit

debugDump

public void debugDump(int nest)
Specified by:
debugDump in interface PerformableEdit