ca.sqlpower.architect.olap.undo
Class OLAPUndoManager

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.olap.undo.OLAPUndoManager
All Implemented Interfaces:
NotifyingUndoManager, java.io.Serializable, java.util.EventListener, javax.swing.event.UndoableEditListener, javax.swing.undo.UndoableEdit

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

A customized undo manager that works well with the OLAP business model and GUI.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.undo.CompoundEdit
edits
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
OLAPUndoManager(OLAPObject root)
           
 
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)
           
 void endCompoundEdit()
           
 boolean isAtRememberedPosition()
           
protected  void redoTo(javax.swing.undo.UndoableEdit edit)
           
 void rememberPosition()
          Marks this undo manager's current position.
 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 startCompoundEdit(java.lang.String presentationName)
           
protected  void trimEdits(int from, int to)
          This override is just a hook for the "remembered position" system.
protected  void undoTo(javax.swing.undo.UndoableEdit edit)
           
 
Methods inherited from class javax.swing.undo.UndoManager
canRedo, canUndo, canUndoOrRedo, discardAllEdits, editToBeRedone, editToBeUndone, end, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, redo, setLimit, toString, trimForLimit, undo, undoableEditHappened, undoOrRedo
 
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
canRedo, canUndo, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, redo, undo
 

Constructor Detail

OLAPUndoManager

public OLAPUndoManager(OLAPObject root)
Method Detail

rememberPosition

public void rememberPosition()
Marks this undo manager's current position.


isAtRememberedPosition

public boolean isAtRememberedPosition()

trimEdits

protected void trimEdits(int from,
                         int to)
This override is just a hook for the "remembered position" system. If we are trimming off the first edit, and our remembered undoable edit was null (which only happens when the remembered position is before the first edit), we "unremember" the position because it is now impossible to get back there. If we didn't do this, if the user undoes back to the beginning of the undo vector, we would report that we're at the remembered position, but it would be a lie.

Overrides:
trimEdits in class javax.swing.undo.UndoManager

undoTo

protected void undoTo(javax.swing.undo.UndoableEdit edit)
               throws javax.swing.undo.CannotUndoException
Overrides:
undoTo in class javax.swing.undo.UndoManager
Throws:
javax.swing.undo.CannotUndoException

redoTo

protected void redoTo(javax.swing.undo.UndoableEdit edit)
               throws javax.swing.undo.CannotRedoException
Overrides:
redoTo in class javax.swing.undo.UndoManager
Throws:
javax.swing.undo.CannotRedoException

addEdit

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

startCompoundEdit

public void startCompoundEdit(java.lang.String presentationName)

endCompoundEdit

public void endCompoundEdit()

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


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