net.sourceforge.jdatepicker
Class AbstractDateModel<T>

java.lang.Object
  extended by net.sourceforge.jdatepicker.AbstractDateModel<T>
Type Parameters:
T -
All Implemented Interfaces:
DateModel<T>
Direct Known Subclasses:
SqlDateModel, UtilCalendarModel, UtilDateModel

public abstract class AbstractDateModel<T>
extends java.lang.Object
implements DateModel<T>

Created 18 April 2010 Updated 26 April 2010

Author:
Juan Heyns

Constructor Summary
protected AbstractDateModel()
           
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener changeListener)
          Adds a ChangeListener.
 void addDay(int add)
          Add or substract number of day.
 void addMonth(int add)
          Add or substract number of months.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to the list of bean listeners.
 void addYear(int add)
          Add or substract number of years.
protected  void fireChangeEvent()
           
protected  void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
           
protected abstract  T fromCalendar(java.util.Calendar from)
           
 int getDay()
          Getters and setters which represent a gregorian date.
 int getMonth()
          Getters and setters which represent a gregorian date.
 T getValue()
          Get the value this model represents.
 int getYear()
          Getters and setters which represent a gregorian date.
 boolean isSelected()
          Is the value selected or is it not.
 void removeChangeListener(javax.swing.event.ChangeListener changeListener)
          Removes the specified ChangeListener.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener from the list of bean listeners.
 void setDate(int year, int month, int day)
          Getters and setters which represent a gregorian date.
 void setDay(int day)
          Getters and setters which represent a gregorian date.
 void setMonth(int month)
          Getters and setters which represent a gregorian date.
 void setSelected(boolean selected)
          Set the value as selected.
 void setValue(T value)
          Set the value this model represents.
 void setYear(int year)
          Getters and setters which represent a gregorian date.
protected abstract  java.util.Calendar toCalendar(T from)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDateModel

protected AbstractDateModel()
Method Detail

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener changeListener)
Description copied from interface: DateModel
Adds a ChangeListener. ChangeListeners will be notified when the internal state of the control changes. This means that as a user scrolls through dates the internal model changes, which fires a ChangeEvent each time it changes.

Specified by:
addChangeListener in interface DateModel<T>

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener changeListener)
Description copied from interface: DateModel
Removes the specified ChangeListener. ChangeListeners will be notified when the selected date is changed.

Specified by:
removeChangeListener in interface DateModel<T>

fireChangeEvent

protected void fireChangeEvent()

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface: DateModel
Adds a PropertyChangeListener to the list of bean listeners. The listener is registered for all bound properties of the target bean.

Specified by:
addPropertyChangeListener in interface DateModel<T>
Parameters:
listener - the PropertyChangeListener to be added
See Also:
DateModel.removePropertyChangeListener(PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface: DateModel
Removes a PropertyChangeListener from the list of bean listeners. This method should be used to remove PropertyChangeListeners that were registered for all bound properties of the target bean.

Specified by:
removePropertyChangeListener in interface DateModel<T>
Parameters:
listener - the PropertyChangeListener to be removed
See Also:
DateModel.addPropertyChangeListener(PropertyChangeListener)

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)

getDay

public int getDay()
Description copied from interface: DateModel
Getters and setters which represent a gregorian date.

Specified by:
getDay in interface DateModel<T>
Returns:

getMonth

public int getMonth()
Description copied from interface: DateModel
Getters and setters which represent a gregorian date.

Specified by:
getMonth in interface DateModel<T>
Returns:

getYear

public int getYear()
Description copied from interface: DateModel
Getters and setters which represent a gregorian date.

Specified by:
getYear in interface DateModel<T>
Returns:

getValue

public T getValue()
Description copied from interface: DateModel
Get the value this model represents.

Specified by:
getValue in interface DateModel<T>
Returns:

setDay

public void setDay(int day)
Description copied from interface: DateModel
Getters and setters which represent a gregorian date.

Specified by:
setDay in interface DateModel<T>

addDay

public void addDay(int add)
Description copied from interface: DateModel
Add or substract number of day.

Specified by:
addDay in interface DateModel<T>

setMonth

public void setMonth(int month)
Description copied from interface: DateModel
Getters and setters which represent a gregorian date.

Specified by:
setMonth in interface DateModel<T>

addMonth

public void addMonth(int add)
Description copied from interface: DateModel
Add or substract number of months.

Specified by:
addMonth in interface DateModel<T>

setYear

public void setYear(int year)
Description copied from interface: DateModel
Getters and setters which represent a gregorian date.

Specified by:
setYear in interface DateModel<T>

addYear

public void addYear(int add)
Description copied from interface: DateModel
Add or substract number of years.

Specified by:
addYear in interface DateModel<T>

setValue

public void setValue(T value)
Description copied from interface: DateModel
Set the value this model represents.

Specified by:
setValue in interface DateModel<T>

setDate

public void setDate(int year,
                    int month,
                    int day)
Description copied from interface: DateModel
Getters and setters which represent a gregorian date.

Specified by:
setDate in interface DateModel<T>

isSelected

public boolean isSelected()
Description copied from interface: DateModel
Is the value selected or is it not.

Specified by:
isSelected in interface DateModel<T>
Returns:

setSelected

public void setSelected(boolean selected)
Description copied from interface: DateModel
Set the value as selected.

Specified by:
setSelected in interface DateModel<T>

toCalendar

protected abstract java.util.Calendar toCalendar(T from)

fromCalendar

protected abstract T fromCalendar(java.util.Calendar from)


Copyright © 2010. All Rights Reserved.