net.sf.nachocalendar.model
Class DefaultDataModel
java.lang.Object
net.sf.nachocalendar.model.DefaultDataModel
- DataModel
public class DefaultDataModel
extends java.lang.Object
implements DataModel
Default implementation for DataModel. It has a collection
to contain the data and convenient accesor methods
DefaultDataModel
public DefaultDataModel()
Creates a new instance of DefaultDataModel.
addData
public void addData(Date date,
Object o)
Adds new data to the Collection.
date
- the new dateo
- the new data
addDataModelListener
public void addDataModelListener(DataModelListener listener)
Registers DataModelListener to receive events.
listener
- The listener to register.
clear
public void clear()
Removes all data from the Collection.
getAll
public Map getAll()
Returns a Collection with the data.
getData
public Object getData(Date date)
Checks if the date provided has data.
date
- Date to be checked
- the data or null if it has not
getSize
public int getSize()
Returns the quantity of data in the Collection.
- the size of the Collection
removeData
public void removeData(Date date)
Removes the provided data from the Collection.
date
- date to be removed
removeDataModelListener
public void removeDataModelListener(DataModelListener listener)
Removes DataModelListener from the list of listeners.
listener
- The listener to remove.