org.vizzini.util
Class DocumentSupport

java.lang.Object
  extended by org.vizzini.util.DocumentSupport
All Implemented Interfaces:
Serializable, IDocument

public class DocumentSupport
extends Object
implements IDocument

Provides implementations of methods required by documents.

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

Field Summary
protected static String DIRTY_PROPERTY
          Dirty property.
protected static String FILE_PROPERTY
          File property.
 
Constructor Summary
DocumentSupport()
          Construct this object.
 
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.
 File getFile()
          Return the file associated with this document.
 Object getOwner()
          Return the owner.
protected  PropertyChangeManager getPropertyChangeManager()
          Return the property change manager.
 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.
 void setOwner(Object owner)
          Set the owner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIRTY_PROPERTY

protected static final String DIRTY_PROPERTY
Dirty property.

See Also:
Constant Field Values

FILE_PROPERTY

protected static final String FILE_PROPERTY
File property.

See Also:
Constant Field Values
Constructor Detail

DocumentSupport

public DocumentSupport()
Construct this object.

Since:
v0.1
Method Detail

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

getDocument

public IDocument getDocument()
Return the document.

Since:
v0.1

getFile

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

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

getOwner

public Object getOwner()
Return the owner.

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

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

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

setDirty

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

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

setDocument

public void setDocument(IDocument document)
Set the document.

Since:
v0.1

setFile

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

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

setOwner

public void setOwner(Object owner)
Set the owner.

Since:
v0.1

getPropertyChangeManager

protected PropertyChangeManager getPropertyChangeManager()
Return the property change manager.

Since:
v0.2


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02