com.partnersoft.codex
Class CodexEditManager

java.lang.Object
  extended by com.partnersoft.codex.CodexEditManager

public class CodexEditManager
extends java.lang.Object

Controls the undo stack. However, the most important thing this class does is periodically flush edited CodexResources to disk. It saves every edited CodexResource every ten seconds. Call initialize() to kick off the saver thread.

Author:
Russell Cagle Copyright 2006 Partner Software, Inc.

Method Summary
 void addCodexUndoListener(CodexUndoListener listener)
           
 void addListDataListener(javax.swing.event.ListDataListener listener)
           
 void applyResourceEdit(CodexResourceEdit edit)
          Adds it to the undo stack and applies it.
 void applyStructuralEdit(CodexStructuralEdit edit)
          Adds it to the undo stack and applies it.
 boolean canRedo()
           
 boolean canUndo()
           
 void flush()
           
 int getEditIndex(CodexEdit edit)
           
 java.util.ArrayList<CodexEdit> getEdits()
          Please don't modify the array!
protected  java.io.File getGraveyard()
           
 int getLastSave()
          The index of the last edit that was saved.
 int getLastUndo()
          The index of the last edit that was undone.
 void redo()
           
 void removeCodexUndoListener(CodexUndoListener listener)
           
 void removeListDataListener(javax.swing.event.ListDataListener listener)
           
static CodexEditManager singleton()
           
 void startSaverThread()
           
 void stopSaverThread()
           
 void undo()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

singleton

public static CodexEditManager singleton()

getGraveyard

protected java.io.File getGraveyard()

addCodexUndoListener

public void addCodexUndoListener(CodexUndoListener listener)

addListDataListener

public void addListDataListener(javax.swing.event.ListDataListener listener)

applyResourceEdit

public void applyResourceEdit(CodexResourceEdit edit)
Adds it to the undo stack and applies it.

Parameters:
edit -

applyStructuralEdit

public void applyStructuralEdit(CodexStructuralEdit edit)
Adds it to the undo stack and applies it.

Parameters:
edit -

canRedo

public boolean canRedo()

canUndo

public boolean canUndo()

flush

public void flush()

getEditIndex

public int getEditIndex(CodexEdit edit)

getEdits

public java.util.ArrayList<CodexEdit> getEdits()
Please don't modify the array!

Returns:

getLastSave

public int getLastSave()
The index of the last edit that was saved.

Returns:

getLastUndo

public int getLastUndo()
The index of the last edit that was undone.

Returns:

redo

public void redo()
Throws:
java.lang.IllegalStateException - if there is nothing to redo.

removeCodexUndoListener

public void removeCodexUndoListener(CodexUndoListener listener)

removeListDataListener

public void removeListDataListener(javax.swing.event.ListDataListener listener)

startSaverThread

public void startSaverThread()
Throws:
java.lang.IllegalStateException - if the SaverThread has already been started.

stopSaverThread

public void stopSaverThread()

undo

public void undo()