org.sourceforge.espro.model
Class AbstractModel

java.lang.Object
  extended by org.sourceforge.espro.model.AbstractModel
All Implemented Interfaces:
java.io.Serializable, ModelInterface
Direct Known Subclasses:
Item, ItemData, Person, QData, Questionnaire, RunLogger, RunnableQuestionnaire, Settings

public abstract class AbstractModel
extends java.lang.Object
implements ModelInterface, java.io.Serializable

The AbstractModel containts a PropertyChangeSupport and a handling for setting and getting the saved state of the model.

Version:
2.0
Author:
(c) 2007 Martin Kaffanke
See Also:
Serialized Form

Field Summary
 java.beans.PropertyChangeSupport pcs
          The property change support.
 
Constructor Summary
AbstractModel()
          The initial function.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a generic property change listener.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Adds a specific property change listener for the given property name.
 boolean isSaved()
          Returns wether the questionnaire is saved.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a property change listener.
 void setSaved(boolean saved)
          Sets the saved state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pcs

public java.beans.PropertyChangeSupport pcs
The property change support.

Constructor Detail

AbstractModel

public AbstractModel()
The initial function.

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a generic property change listener.

Specified by:
addPropertyChangeListener in interface ModelInterface
Parameters:
listener - The listener.

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Adds a specific property change listener for the given property name.

Specified by:
addPropertyChangeListener in interface ModelInterface
Parameters:
propertyName - The name of the property.
listener - The listener.

isSaved

public boolean isSaved()
Returns wether the questionnaire is saved.

Returns:
the saved, which can be true or false.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a property change listener.

Specified by:
removePropertyChangeListener in interface ModelInterface
Parameters:
listener - The listener to remove.

setSaved

public void setSaved(boolean saved)
Sets the saved state. This is done application internally, so for endusers there will not be any reason to use that except if you plan to write a new save procedure of a questionnaire i.e. into a database.

Fires a 'saved' property change if the state changes.

Parameters:
saved - the saved to set