org.jdesktop.swingx
Class DefaultDateSelectionModel

java.lang.Object
  extended by org.jdesktop.swingx.DefaultDateSelectionModel
All Implemented Interfaces:
DateSelectionModel

public class DefaultDateSelectionModel
extends Object
implements DateSelectionModel


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jdesktop.swingx.DateSelectionModel
DateSelectionModel.SelectionMode
 
Constructor Summary
DefaultDateSelectionModel()
           
 
Method Summary
 void addDateSelectionListener(DateSelectionListener l)
          Add the specified listener to this model
 void addSelectionInterval(Date startDate, Date endDate)
          Add the specified selection interval to the selection model
 void clearSelection()
          Clear any selection from the selection model
protected  void fireValueChanged(DateSelectionEvent.EventType eventType)
           
 List<DateSelectionListener> getDateSelectionListeners()
           
 int getFirstDayOfWeek()
          Gets what the first day of the week is; e.g., Calendar.SUNDAY in the U.S., Calendar.MONDAY in France.
 Date getLowerBound()
          Return the lower bound date that is allowed to be selected for this model
 SortedSet<Date> getSelection()
          Get the current selection
 DateSelectionModel.SelectionMode getSelectionMode()
          Get the selection mode
 SortedSet<Date> getUnselectableDates()
          Returns a SortedSet of Dates that are unselectable
 Date getUpperBound()
          Return the upper bound date that is allowed to be selected for this model
 boolean isSelected(Date date)
          Return true if the date specified is selected, false otherwise
 boolean isSelectionEmpty()
          Return true if the selection is empty, false otherwise
 boolean isUnselectableDate(Date date)
          Return true is the specified date is unselectable
 void removeDateSelectionListener(DateSelectionListener l)
          Remove the specified listener to this model
 void removeSelectionInterval(Date startDate, Date endDate)
          Remove the specifed selection interval from the selection model
 void setFirstDayOfWeek(int firstDayOfWeek)
          Sets what the first day of the week is; e.g., Calendar.SUNDAY in US, Calendar.MONDAY in France.
 void setLowerBound(Date lowerBound)
          Set the lower bound date that is allowed to be selected for this model
 void setSelectionInterval(Date startDate, Date endDate)
          Set the specified selection interval to the selection model
 void setSelectionMode(DateSelectionModel.SelectionMode selectionMode)
          Set the selection mode
 void setUnselectableDates(SortedSet<Date> unselectableDates)
          Set which dates are unable to be selected
 void setUpperBound(Date upperBound)
          Set the upper bound date that is allowed to be selected for this model
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDateSelectionModel

public DefaultDateSelectionModel()
Method Detail

getSelectionMode

public DateSelectionModel.SelectionMode getSelectionMode()
Get the selection mode

Specified by:
getSelectionMode in interface DateSelectionModel
Returns:
return the current selection mode

setSelectionMode

public void setSelectionMode(DateSelectionModel.SelectionMode selectionMode)
Set the selection mode

Specified by:
setSelectionMode in interface DateSelectionModel
Parameters:
selectionMode - new selection mode

getFirstDayOfWeek

public int getFirstDayOfWeek()
Description copied from interface: DateSelectionModel
Gets what the first day of the week is; e.g., Calendar.SUNDAY in the U.S., Calendar.MONDAY in France. This is needed when the model selection mode is WEEK_INTERVAL_SELECTION. The default value is Calendar.SUNDAY

Specified by:
getFirstDayOfWeek in interface DateSelectionModel
Returns:
int The first day of the week.

setFirstDayOfWeek

public void setFirstDayOfWeek(int firstDayOfWeek)
Description copied from interface: DateSelectionModel
Sets what the first day of the week is; e.g., Calendar.SUNDAY in US, Calendar.MONDAY in France.

Specified by:
setFirstDayOfWeek in interface DateSelectionModel
Parameters:
firstDayOfWeek - The first day of the week.
See Also:
Calendar

addSelectionInterval

public void addSelectionInterval(Date startDate,
                                 Date endDate)
Add the specified selection interval to the selection model

Specified by:
addSelectionInterval in interface DateSelectionModel
Parameters:
startDate - interval start date
endDate - interval end date

setSelectionInterval

public void setSelectionInterval(Date startDate,
                                 Date endDate)
Set the specified selection interval to the selection model

Specified by:
setSelectionInterval in interface DateSelectionModel
Parameters:
startDate - interval start date
endDate - interval end date

removeSelectionInterval

public void removeSelectionInterval(Date startDate,
                                    Date endDate)
Remove the specifed selection interval from the selection model

Specified by:
removeSelectionInterval in interface DateSelectionModel
Parameters:
startDate - interval start date
endDate - interval end date

clearSelection

public void clearSelection()
Clear any selection from the selection model

Specified by:
clearSelection in interface DateSelectionModel

getSelection

public SortedSet<Date> getSelection()
Get the current selection

Specified by:
getSelection in interface DateSelectionModel
Returns:
sorted set of selected dates

isSelected

public boolean isSelected(Date date)
Return true if the date specified is selected, false otherwise

Specified by:
isSelected in interface DateSelectionModel
Parameters:
date - date to check for selection
Returns:
true if the date is selected, false otherwise

isSelectionEmpty

public boolean isSelectionEmpty()
Return true if the selection is empty, false otherwise

Specified by:
isSelectionEmpty in interface DateSelectionModel
Returns:
true if the selection is empty, false otherwise

addDateSelectionListener

public void addDateSelectionListener(DateSelectionListener l)
Add the specified listener to this model

Specified by:
addDateSelectionListener in interface DateSelectionModel
Parameters:
l - listener to add to this model

removeDateSelectionListener

public void removeDateSelectionListener(DateSelectionListener l)
Remove the specified listener to this model

Specified by:
removeDateSelectionListener in interface DateSelectionModel
Parameters:
l - listener to remove from this model

getUnselectableDates

public SortedSet<Date> getUnselectableDates()
Returns a SortedSet of Dates that are unselectable

Specified by:
getUnselectableDates in interface DateSelectionModel
Returns:
sorted set of dates

setUnselectableDates

public void setUnselectableDates(SortedSet<Date> unselectableDates)
Set which dates are unable to be selected

Specified by:
setUnselectableDates in interface DateSelectionModel
Parameters:
unselectableDates - dates that are unselectable

isUnselectableDate

public boolean isUnselectableDate(Date date)
Return true is the specified date is unselectable

Specified by:
isUnselectableDate in interface DateSelectionModel
Parameters:
date - the date to check for unselectability
Returns:
true is the date is unselectable, false otherwise

getUpperBound

public Date getUpperBound()
Return the upper bound date that is allowed to be selected for this model

Specified by:
getUpperBound in interface DateSelectionModel
Returns:
upper bound date or null if not set

setUpperBound

public void setUpperBound(Date upperBound)
Set the upper bound date that is allowed to be selected for this model

Specified by:
setUpperBound in interface DateSelectionModel
Parameters:
upperBound - upper bound

getLowerBound

public Date getLowerBound()
Return the lower bound date that is allowed to be selected for this model

Specified by:
getLowerBound in interface DateSelectionModel
Returns:
lower bound date or null if not set

setLowerBound

public void setLowerBound(Date lowerBound)
Set the lower bound date that is allowed to be selected for this model

Specified by:
setLowerBound in interface DateSelectionModel
Parameters:
lowerBound - lower bound date or null if not set

getDateSelectionListeners

public List<DateSelectionListener> getDateSelectionListeners()

fireValueChanged

protected void fireValueChanged(DateSelectionEvent.EventType eventType)