org.vizzini.util
Class AbstractDocument

java.lang.Object
  extended by org.vizzini.util.AbstractDocument
All Implemented Interfaces:
Serializable, IDocument
Direct Known Subclasses:
AbstractGameState

public abstract class AbstractDocument
extends Object
implements IDocument

Provides implementations of methods required by documents.

Since:
v0.1
Version:
v0.1
Author:
Jeffrey M. Thompson
See Also:
Serialized Form

Constructor Summary
AbstractDocument()
          Construct this object with the given parameter.
AbstractDocument(Object owner)
          Construct this object with the given parameter.
 
Method Summary
 void addDirtyListener(PropertyChangeListener listener)
          Add a PropertyChangeListener for the dirty property to the listener list.
 void addFileListener(PropertyChangeListener listener)
          Add a PropertyChangeListener for the file property to the listener list.
 IDocument getDocument()
          Return the document.
 DocumentSupport getDocumentSupport()
          Return the document support object.
 File getFile()
          Return the file associated with this document.
 boolean isDirty()
          Return the flag indicating if this document has changed since the last save.
 boolean isFileAssociated()
          Return true if this document has an associated File.
 boolean isSaveable()
          Return true if this document needs to be saved.
 void open()
          Open the associated file, thereby populating the document.
 void removeDirtyListener(PropertyChangeListener listener)
          Remove a PropertyChangeListener for the dirty property from the listener list.
 void removeFileListener(PropertyChangeListener listener)
          Remove a PropertyChangeListener for the file property from the listener list.
 void reset()
          Reset this document.
 void save()
          Save the document.
 void saveAs(File file)
          Save the document to the given file.
 void setDirty(boolean isDirty)
          Set the dirty flag.
 void setDocument(IDocument document)
          Set the document.
 void setFile(File file)
          Set the associated file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDocument

public AbstractDocument()
Construct this object with the given parameter.

Since:
v0.1

AbstractDocument

public AbstractDocument(Object owner)
Construct this object with the given parameter.

Since:
v0.1
Method Detail

setDirty

public void setDirty(boolean isDirty)
Set the dirty flag.

Specified by:
setDirty in interface IDocument
Since:
v0.1

isDirty

public boolean isDirty()
Return the flag indicating if this document has changed since the last save.

Specified by:
isDirty in interface IDocument
Since:
v0.1

setDocument

public void setDocument(IDocument document)
Set the document.

Since:
v0.1

getDocument

public IDocument getDocument()
Return the document.

Since:
v0.1

getDocumentSupport

public DocumentSupport getDocumentSupport()
Return the document support object.

Since:
v0.1

setFile

public void setFile(File file)
Set the associated file.

Specified by:
setFile in interface IDocument
Since:
v0.1

getFile

public File getFile()
Return the file associated with this document.

Specified by:
getFile in interface IDocument
Since:
v0.1

isFileAssociated

public boolean isFileAssociated()
Return true if this document has an associated File.

Specified by:
isFileAssociated in interface IDocument
Since:
v0.1

isSaveable

public boolean isSaveable()
Return true if this document needs to be saved.

Specified by:
isSaveable in interface IDocument
Since:
v0.1

addDirtyListener

public void addDirtyListener(PropertyChangeListener listener)
Add a PropertyChangeListener for the dirty property to the listener list.

Specified by:
addDirtyListener in interface IDocument
Parameters:
listener - The PropertyChangeListener to be added.
Since:
v0.1

addFileListener

public void addFileListener(PropertyChangeListener listener)
Add a PropertyChangeListener for the file property to the listener list.

Specified by:
addFileListener in interface IDocument
Parameters:
listener - The PropertyChangeListener to add.
Since:
v0.1

open

public void open()
          throws FileNotFoundException,
                 IOException,
                 ClassNotFoundException
Open the associated file, thereby populating the document. File is a required property.

Specified by:
open in interface IDocument
Throws:
FileNotFoundException
IOException
ClassNotFoundException
Since:
v0.1

removeDirtyListener

public void removeDirtyListener(PropertyChangeListener listener)
Remove a PropertyChangeListener for the dirty property from the listener list.

Specified by:
removeDirtyListener in interface IDocument
Parameters:
listener - The PropertyChangeListener to remove.
Since:
v0.1

removeFileListener

public void removeFileListener(PropertyChangeListener listener)
Remove a PropertyChangeListener for the file property from the listener list.

Specified by:
removeFileListener in interface IDocument
Parameters:
listener - The PropertyChangeListener to remove.
Since:
v0.1

reset

public void reset()
Reset this document.

Specified by:
reset in interface IDocument
Since:
v0.1

save

public void save()
          throws FileNotFoundException,
                 IOException
Save the document. File and document are required properties.

Specified by:
save in interface IDocument
Throws:
FileNotFoundException
IOException
Since:
v0.1

saveAs

public void saveAs(File file)
            throws FileNotFoundException,
                   IOException
Save the document to the given file.

Specified by:
saveAs in interface IDocument
Throws:
FileNotFoundException
IOException
Since:
v0.1


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02