phenote.edit
Class DirtyDocumentIndicator

java.lang.Object
  extended by phenote.edit.DirtyDocumentIndicator
All Implemented Interfaces:
java.util.EventListener, org.bbop.framework.VetoableShutdownListener, CharListChangeListener, LoadSaveListener, CharChangeListener

public class DirtyDocumentIndicator
extends java.lang.Object
implements CharChangeListener, CharListChangeListener, LoadSaveListener, org.bbop.framework.VetoableShutdownListener

Listens for editing by the user to indicate that the document needs saving before it's closed. Editing state is reset anytime a user saves the document. Implements VetoableShutdownListener to be used by GUIManager when a user attempts to quit.

Author:
Jim Balhoff

Method Summary
 void charChanged(CharChangeEvent e)
          charChanged comes from user edit, so set edited to true, BUT...
 void fileLoaded(java.io.File f)
           
 void fileSaved(java.io.File f)
           
static DirtyDocumentIndicator inst()
           
 boolean isDocumentDirty()
          Currently this returns true if there has been any non-add(add blank row) edits However if one does an edit and then does undo this will still return true.
 void newCharList(CharListChangeEvent e)
           
 boolean okToClearData()
           
 boolean willShutdown()
          from VetoableShutdownListener interface, this method is called from plus/obo/bbop framework on exit, if document is dirty it calls up user dialog to query about saving changes and cancelling exit, if false is returned(cancel) then shutdown is cancelled/vetoed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

inst

public static DirtyDocumentIndicator inst()

charChanged

public void charChanged(CharChangeEvent e)
charChanged comes from user edit, so set edited to true, BUT... if just an Add - adding a blank row - its an irrelevant edit and not really a dirtying of the document, so ignore adds

Specified by:
charChanged in interface CharChangeListener

newCharList

public void newCharList(CharListChangeEvent e)
Specified by:
newCharList in interface CharListChangeListener

fileLoaded

public void fileLoaded(java.io.File f)
Specified by:
fileLoaded in interface LoadSaveListener

fileSaved

public void fileSaved(java.io.File f)
Specified by:
fileSaved in interface LoadSaveListener

isDocumentDirty

public boolean isDocumentDirty()
Currently this returns true if there has been any non-add(add blank row) edits However if one does an edit and then does undo this will still return true. Even better would be to check the Transaction list in EditManager for non-add edits


willShutdown

public boolean willShutdown()
from VetoableShutdownListener interface, this method is called from plus/obo/bbop framework on exit, if document is dirty it calls up user dialog to query about saving changes and cancelling exit, if false is returned(cancel) then shutdown is cancelled/vetoed

Specified by:
willShutdown in interface org.bbop.framework.VetoableShutdownListener

okToClearData

public boolean okToClearData()