net.sf.nachocalendar.model
Class DefaultDateSelectionModel

java.lang.Object
  extended by net.sf.nachocalendar.model.DefaultDateSelectionModel
All Implemented Interfaces:
DateSelectionModel

public class DefaultDateSelectionModel
extends java.lang.Object
implements DateSelectionModel

Default implementation for DateSelectionModel interface.

Author:
Ignacio Merani

Field Summary
 
Fields inherited from interface net.sf.nachocalendar.model.DateSelectionModel
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION
 
Constructor Summary
DefaultDateSelectionModel()
          Default constructor.
 
Method Summary
 void addDateSelectionListener(DateSelectionListener listener)
          Registers DateSelectionListener to receive events.
 void addSelectionInterval(java.util.Date from, java.util.Date to)
          Adds the interval to the selection.
 void clearSelection()
          Clears the current selection.
 java.util.Date getLeadSelectionDate()
          Returns the lead selection Date.
 java.lang.Object getSelectedDate()
          Returns the selected Date.
 java.lang.Object[] getSelectedDates()
          Sets the selected Dates.
 int getSelectionMode()
          Returns the selection mode.
 boolean getValueIsAdjusting()
          Returns true if the current changes to the value property are part of a series of changes.
 boolean isSelectedDate(java.util.Date date)
          Checks if provided date is selected.
 boolean isSelectionEmpty()
          Checks if selection is empty.
 void removeDateSelectionListener(DateSelectionListener listener)
          Removes DateSelectionListener from the list of listeners.
 void removeSelectionInterval(java.util.Date from, java.util.Date to)
          Removes the interval from selection.
 void setLeadSelectionDate(java.util.Date date)
          Sets the lead selection Date.
 void setSelectedDate(java.lang.Object date)
          Sets the selected Date.
 void setSelectedDates(java.lang.Object[] dates)
          Sets the selected Dates.
 void setSelectionMode(int selectionMode)
          Sets the selection mode.
 void setValueIsAdjusting(boolean b)
          This attribute indicates that any upcoming changes to the value of the model should be considered a single event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDateSelectionModel

public DefaultDateSelectionModel()
Default constructor.

Method Detail

addSelectionInterval

public void addSelectionInterval(java.util.Date from,
                                 java.util.Date to)
Description copied from interface: DateSelectionModel
Adds the interval to the selection.

Specified by:
addSelectionInterval in interface DateSelectionModel
Parameters:
from - starting date
to - end date
See Also:
DateSelectionModel.addSelectionInterval(java.util.Date, java.util.Date)

clearSelection

public void clearSelection()
Description copied from interface: DateSelectionModel
Clears the current selection.

Specified by:
clearSelection in interface DateSelectionModel
See Also:
DateSelectionModel.clearSelection()

isSelectedDate

public boolean isSelectedDate(java.util.Date date)
Description copied from interface: DateSelectionModel
Checks if provided date is selected.

Specified by:
isSelectedDate in interface DateSelectionModel
Parameters:
date - Date to check.
Returns:
true if date is selected
See Also:
DateSelectionModel.isSelectedDate(java.util.Date)

isSelectionEmpty

public boolean isSelectionEmpty()
Description copied from interface: DateSelectionModel
Checks if selection is empty.

Specified by:
isSelectionEmpty in interface DateSelectionModel
Returns:
true if selection is empty.
See Also:
DateSelectionModel.isSelectionEmpty()

removeSelectionInterval

public void removeSelectionInterval(java.util.Date from,
                                    java.util.Date to)
Description copied from interface: DateSelectionModel
Removes the interval from selection.

Specified by:
removeSelectionInterval in interface DateSelectionModel
Parameters:
from - starting date
to - end date
See Also:
DateSelectionModel.removeSelectionInterval(java.util.Date, java.util.Date)

addDateSelectionListener

public void addDateSelectionListener(DateSelectionListener listener)
Registers DateSelectionListener to receive events.

Specified by:
addDateSelectionListener in interface DateSelectionModel
Parameters:
listener - The listener to register.

removeDateSelectionListener

public void removeDateSelectionListener(DateSelectionListener listener)
Removes DateSelectionListener from the list of listeners.

Specified by:
removeDateSelectionListener in interface DateSelectionModel
Parameters:
listener - The listener to remove.

getSelectionMode

public int getSelectionMode()
Description copied from interface: DateSelectionModel
Returns the selection mode.

Specified by:
getSelectionMode in interface DateSelectionModel
Returns:
Returns the selectionMode.

setSelectionMode

public void setSelectionMode(int selectionMode)
Description copied from interface: DateSelectionModel
Sets the selection mode.

Specified by:
setSelectionMode in interface DateSelectionModel
Parameters:
selectionMode - The selectionMode to set.

getLeadSelectionDate

public java.util.Date getLeadSelectionDate()
Description copied from interface: DateSelectionModel
Returns the lead selection Date.

Specified by:
getLeadSelectionDate in interface DateSelectionModel
Returns:
lead selection Date.
See Also:
DateSelectionModel.getLeadSelectionDate()

setLeadSelectionDate

public void setLeadSelectionDate(java.util.Date date)
Description copied from interface: DateSelectionModel
Sets the lead selection Date.

Specified by:
setLeadSelectionDate in interface DateSelectionModel
Parameters:
date - lead selection Date.
See Also:
DateSelectionModel.setLeadSelectionDate(java.util.Date)

getSelectedDate

public java.lang.Object getSelectedDate()
Description copied from interface: DateSelectionModel
Returns the selected Date.

Specified by:
getSelectedDate in interface DateSelectionModel
Returns:
selected Date.
See Also:
DateSelectionModel.getSelectedDate()

getSelectedDates

public java.lang.Object[] getSelectedDates()
Description copied from interface: DateSelectionModel
Sets the selected Dates.

Specified by:
getSelectedDates in interface DateSelectionModel
Returns:
selected Dates.
See Also:
DateSelectionModel.getSelectedDates()

setSelectedDate

public void setSelectedDate(java.lang.Object date)
Description copied from interface: DateSelectionModel
Sets the selected Date.

Specified by:
setSelectedDate in interface DateSelectionModel
Parameters:
date - selected Date.
See Also:
DateSelectionModel.setSelectedDate(java.lang.Object)

setSelectedDates

public void setSelectedDates(java.lang.Object[] dates)
Description copied from interface: DateSelectionModel
Sets the selected Dates.

Specified by:
setSelectedDates in interface DateSelectionModel
Parameters:
dates - selected Dates.
See Also:
DateSelectionModel.setSelectedDates(java.lang.Object[])

setValueIsAdjusting

public void setValueIsAdjusting(boolean b)
Description copied from interface: DateSelectionModel
This attribute indicates that any upcoming changes to the value of the model should be considered a single event.

Specified by:
setValueIsAdjusting in interface DateSelectionModel

getValueIsAdjusting

public boolean getValueIsAdjusting()
Description copied from interface: DateSelectionModel
Returns true if the current changes to the value property are part of a series of changes.

Specified by:
getValueIsAdjusting in interface DateSelectionModel
Returns: