Java Calendar Component v3.1
www.java-calendar.com

com.imagine.component.calendar.selection
Class CalendarSelectionModel

java.lang.Object
  extended bycom.imagine.component.calendar.selection.CalendarSelectionModel
Direct Known Subclasses:
CalendarSelectionModelMultipleIntervalSelection, CalendarSelectionModelSingleIntervalSelection, CalendarSelectionModelSingleSelection

public abstract class CalendarSelectionModel
extends java.lang.Object

Defines the calendar selection model.


Constructor Summary
CalendarSelectionModel()
           
 
Method Summary
abstract  void addCalendarSelectionListener(CalendarSelectionListener calendarSelectionListener)
          Add a calendar component listener.
abstract  java.util.Date getAnchorSelectionDate()
          Get the anchor selection date.
 CalendarComponent getCalendarComponent()
          Get the calendar component associated.
abstract  java.util.Date getLeadSelectionDate()
          Get the lead selection date.
abstract  java.lang.String getName()
          Get the name of the selection model.
abstract  java.util.Date[] getSelectedDates()
          An array containing the selected dates.
 boolean isDateDisabled(java.util.Date date)
          Returns true if the specified date is disabled.
 boolean isDateSelectable(java.util.Date date)
          Returns true if the specified date can be selectable.
abstract  boolean isDateSelected(java.util.Date date)
          Returns true if the specified date is selected.
 boolean isEmptySelectionAllowed()
          If true the empty selection is allowed.
abstract  boolean processKeyEvent(java.util.Date date, KeyEventType keyEventType, java.awt.event.KeyEvent keyEvent)
          Process the specified key event received from the calendar component.
abstract  boolean processMouseEvent(java.util.Date date, MouseEventType mouseEventType, java.awt.event.MouseEvent mouseEvent)
          Process the specified mouse event received from the calendar component.
abstract  boolean processMouseMotionEvent(java.util.Date date, MouseMotionEventType mouseEventType, java.awt.event.MouseEvent mouseEvent)
          Process the specified mouse motion event received from the calendar component.
abstract  boolean removeCalendarSelectionListener(CalendarSelectionListener calendarSelectionListener)
          Remove a calendar component listener.
abstract  void setAnchorSelectionDate(java.util.Date date)
          Set the anchor selection date.
 void setCalendarComponent(CalendarComponent calendarComponent)
          Set the calendar component associated.
 void setEmptySelectionAllowed(boolean emptySelectionAllowed)
          Sets whether the empty selection is allowed.
abstract  void setLeadSelectionDate(java.util.Date date)
          Set the lead selection date.
abstract  void setSelectedDates(java.util.Date[] dates)
          Set the selected dates.
 java.lang.String toString()
          A string representation of this selection model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CalendarSelectionModel

public CalendarSelectionModel()
Method Detail

setCalendarComponent

public final void setCalendarComponent(CalendarComponent calendarComponent)
Set the calendar component associated.

Parameters:
calendarComponent -

getCalendarComponent

public final CalendarComponent getCalendarComponent()
Get the calendar component associated.

Returns:
The calendar component associated.

processKeyEvent

public abstract boolean processKeyEvent(java.util.Date date,
                                        KeyEventType keyEventType,
                                        java.awt.event.KeyEvent keyEvent)
Process the specified key event received from the calendar component.

Parameters:
date - The current selected date.
keyEventType - The key event type.
keyEvent - The key event to process.
Returns:
true if the event was processed.

processMouseEvent

public abstract boolean processMouseEvent(java.util.Date date,
                                          MouseEventType mouseEventType,
                                          java.awt.event.MouseEvent mouseEvent)
Process the specified mouse event received from the calendar component.

Parameters:
date - The current selected date.
mouseEventType - The mouse event type.
mouseEvent - The mouse event to process.
Returns:
true if the event was processed.

processMouseMotionEvent

public abstract boolean processMouseMotionEvent(java.util.Date date,
                                                MouseMotionEventType mouseEventType,
                                                java.awt.event.MouseEvent mouseEvent)
Process the specified mouse motion event received from the calendar component.

Parameters:
date - The current selected date.
mouseEvent - The mouse event to process.
Returns:
true if the event was processed.

isDateSelected

public abstract boolean isDateSelected(java.util.Date date)
Returns true if the specified date is selected.

Parameters:
date - The date to be checked whether it is selected. If the date is null, it tests if the selection is empty.
Returns:
true if the provided date is selected.

isDateSelectable

public boolean isDateSelectable(java.util.Date date)
Returns true if the specified date can be selectable. The disabled dates which are defined through the isDateDisabled(Date date) function are a subset of the dates that cannot be selected. By default this function returns true if the isDateDisabled(Date date) function returns false, but the user may also specify by implementing this function other dates which are not disabled, but cannot be selected. If the input date is null, then this method will return true only if the empty date selection is allowed.

Parameters:
date - The date to be checked whether it is selectable.
Returns:
true if the specified date can be selectable.

isDateDisabled

public boolean isDateDisabled(java.util.Date date)
Returns true if the specified date is disabled. A disabled date is a date that cannot be selected and also it is usually displayed using a special renderer. The default implementation of this function is to return false, but one can extend one of the existing selection models and specify an algorithm to test whether a specified date is disabled.

Parameters:
date - The date to be checked whether it is disabled.
Returns:
true if the provided date is disabled.

isEmptySelectionAllowed

public boolean isEmptySelectionAllowed()
If true the empty selection is allowed.

Returns:
true If the empty selection is allowed.

setEmptySelectionAllowed

public void setEmptySelectionAllowed(boolean emptySelectionAllowed)
                              throws EmptySelectionNotAllowedException
Sets whether the empty selection is allowed.

Parameters:
emptySelectionAllowed - true if empty selection is allowed. False otherwise.
Throws:
EmptySelectionNotAllowedException - Thrown when there is no date selected and it is tried to be not allowed empty selection.

setSelectedDates

public abstract void setSelectedDates(java.util.Date[] dates)
Set the selected dates.

Parameters:
dates - An array containing the selected dates.

getSelectedDates

public abstract java.util.Date[] getSelectedDates()
An array containing the selected dates.

Returns:
An array containing the selected dates.

getName

public abstract java.lang.String getName()
Get the name of the selection model.

Returns:
The name of the selection model.

getAnchorSelectionDate

public abstract java.util.Date getAnchorSelectionDate()
Get the anchor selection date. This is the first selected date in the selected range.

Returns:
The anchor selection date.

setAnchorSelectionDate

public abstract void setAnchorSelectionDate(java.util.Date date)
Set the anchor selection date. This is the first selected date in the selected range.

Parameters:
date - The anchor selection date.

getLeadSelectionDate

public abstract java.util.Date getLeadSelectionDate()
Get the lead selection date. This is the second selected date in the selected range.

Returns:
The lead selection date.

setLeadSelectionDate

public abstract void setLeadSelectionDate(java.util.Date date)
Set the lead selection date. This is the second selected date in the selected range.

Parameters:
date - The lead selection date.

addCalendarSelectionListener

public abstract void addCalendarSelectionListener(CalendarSelectionListener calendarSelectionListener)
Add a calendar component listener.

Parameters:
calendarSelectionListener - The calendar component listener to be added.

removeCalendarSelectionListener

public abstract boolean removeCalendarSelectionListener(CalendarSelectionListener calendarSelectionListener)
Remove a calendar component listener.

Parameters:
calendarSelectionListener - The calendar component listener to be removed.

toString

public java.lang.String toString()
A string representation of this selection model.


Java Calendar Component v3.1
www.java-calendar.com