package framework; import java.lang.reflect.*; import java.io.*; import java.util.*; /** Base class for all application models.

Provides mechanisms for serialization.

Example:

      public class MyModel extends Model {
		  // Application-specific data and logic goes here
	  }
   
*/ public class Model extends Observable implements Serializable { /** Name of file where model is stored. */ private String fname = null; /** True if there are unsaved changes. */ private boolean unsavedChanges = false; /** Gets the name of the file where model is or will be stored. Returns null if the model doesn't yet have a file name. @return file name or null */ public String getFname() { return fname; } /** Sets or changes the name of the file where the model will be stored. @param name The new name of the file. */ public void setFname(String name) { fname = name; } /** True if there are unsaved changes in the model. This flag is set to false each time the model is saved to fname. @return true if unsaved changes, false otherwise. */ public boolean getUnsavedChanges() { return unsavedChanges; } /** Called in model extensions after each edit or modification and called by gateway after each save operation. @param status new value for unsavedChanges. */ public void setUnsavedChanges(boolean status) { unsavedChanges = status; } /** Notifies all registered views to call their update methods. This method is called in model subclasses each time there is some change that may require the views to update themselves.

For example, each mutator method in a model subclass should end with:

	      setUnsavedChanges(true);
	      notifyViews();
	   
*/ public void notifyViews() { setChanged(); notifyObservers(); clearChanged(); } }