ca.sqlpower.architect.undo
Class UndoManager

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by javax.swing.undo.CompoundEdit
          extended by javax.swing.undo.UndoManager
              extended by ca.sqlpower.architect.undo.UndoManager
All Implemented Interfaces:
NotifyingUndoManager, java.io.Serializable, java.util.EventListener, javax.swing.event.UndoableEditListener, javax.swing.undo.UndoableEdit

public class UndoManager
extends javax.swing.undo.UndoManager
implements NotifyingUndoManager

See Also:
Serialized Form

Nested Class Summary
 class UndoManager.SQLObjectUndoableEventAdapter
          Converts received SQLObjectEvents into UndoableEdits, PropertyChangeEvents into specific edits and adds them to an UndoManager.
 
Field Summary
 
Fields inherited from class javax.swing.undo.CompoundEdit
edits
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
UndoManager(PlayPen playPen)
          Creates a new UndoManager and attaches it to the given PlayPen's component and SQL Object model events.
UndoManager(SQLObject sqlObjectRoot)
           
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          Adds the given change listener, which will be notified with a ChangeEvent every time this undo manager's state has changed.
 boolean addEdit(javax.swing.undo.UndoableEdit anEdit)
          Adds then given edit to this undo manager.
 boolean canRedo()
           
 boolean canUndo()
           
 void fireStateChanged()
          Notifies listeners that the undo/redo list might have changed.
 UndoManager.SQLObjectUndoableEventAdapter getEventAdapter()
          Returns the event adapter for SQLObjects and compound events.
 int getRedoableEditCount()
           
 int getUndoableEditCount()
           
 boolean isRedoing()
           
 boolean isUndoing()
           
 boolean isUndoOrRedoing()
           
 java.lang.String printUndoVector()
           
 void redo()
          Calls super.redo() then refreshes the undo/redo actions.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Removes the given change listener, so it will no longer be notified when this manager's state changes.
 void undo()
          Calls super.undo() then refreshes the undo/redo actions.
 
Methods inherited from class javax.swing.undo.UndoManager
canUndoOrRedo, discardAllEdits, editToBeRedone, editToBeUndone, end, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, redoTo, setLimit, toString, trimEdits, trimForLimit, undoableEditHappened, 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
 
Methods inherited from interface ca.sqlpower.architect.undo.NotifyingUndoManager
getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName
 

Constructor Detail

UndoManager

public UndoManager(PlayPen playPen)
            throws ArchitectException
Creates a new UndoManager and attaches it to the given PlayPen's component and SQL Object model events.

Parameters:
playPen - The play pen to track undo/redo history for.
Throws:
ArchitectException - If the manager fails to listen to all objects in the play pen's database hierarchy.

UndoManager

public UndoManager(SQLObject sqlObjectRoot)
            throws ArchitectException
Throws:
ArchitectException
Method Detail

addEdit

public boolean addEdit(javax.swing.undo.UndoableEdit anEdit)
Adds then given edit to this undo manager.

Warning: Edits added here do not respect compounding. You can add a whole CompoundEdit here, but if the current state of the undo manager is that it's in a compound edit, it doesn't matter. You will get individual edits when you add individual edits.

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

undo

public void undo()
          throws javax.swing.undo.CannotUndoException
Calls super.undo() then refreshes the undo/redo actions.

Specified by:
undo in interface NotifyingUndoManager
Specified by:
undo in interface javax.swing.undo.UndoableEdit
Overrides:
undo in class javax.swing.undo.UndoManager
Throws:
javax.swing.undo.CannotUndoException

redo

public void redo()
          throws javax.swing.undo.CannotRedoException
Calls super.redo() then refreshes the undo/redo actions.

Specified by:
redo in interface NotifyingUndoManager
Specified by:
redo in interface javax.swing.undo.UndoableEdit
Overrides:
redo in class javax.swing.undo.UndoManager
Throws:
javax.swing.undo.CannotRedoException

canUndo

public boolean canUndo()
Specified by:
canUndo in interface NotifyingUndoManager
Specified by:
canUndo in interface javax.swing.undo.UndoableEdit
Overrides:
canUndo in class javax.swing.undo.UndoManager

canRedo

public boolean canRedo()
Specified by:
canRedo in interface NotifyingUndoManager
Specified by:
canRedo in interface javax.swing.undo.UndoableEdit
Overrides:
canRedo in class javax.swing.undo.UndoManager

getUndoableEditCount

public int getUndoableEditCount()

getRedoableEditCount

public int getRedoableEditCount()

isRedoing

public boolean isRedoing()

isUndoing

public boolean isUndoing()

isUndoOrRedoing

public boolean isUndoOrRedoing()

getEventAdapter

public UndoManager.SQLObjectUndoableEventAdapter getEventAdapter()
Returns the event adapter for SQLObjects and compound events. This is an implementation detail specific to undo/redo on the relational play pen, and it will be going away soon.


addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
Description copied from interface: NotifyingUndoManager
Adds the given change listener, which will be notified with a ChangeEvent every time this undo manager's state has changed. The manager's state generally changes when an undoable edit is added, or an undo or redo operation is performed.

Specified by:
addChangeListener in interface NotifyingUndoManager

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)
Description copied from interface: NotifyingUndoManager
Removes the given change listener, so it will no longer be notified when this manager's state changes.

Specified by:
removeChangeListener in interface NotifyingUndoManager

fireStateChanged

public void fireStateChanged()
Notifies listeners that the undo/redo list might have changed.


printUndoVector

public java.lang.String printUndoVector()


Copyright © 2003-2007 SQL Power Group Inc. www.sqlpower.ca