|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DateSelectionModel
The Model used by calendar components. It controls the Calendar to use and keeps selection-related state.
Nested Class Summary | |
---|---|
static class |
DateSelectionModel.SelectionMode
|
Method Summary | |
---|---|
void |
addDateSelectionListener(DateSelectionListener listener)
Add the specified listener to this model. |
void |
addSelectionInterval(java.util.Date startDate,
java.util.Date endDate)
Adds the specified selection interval to the selection model. |
void |
clearSelection()
Clears any selection from the selection model. |
java.util.Calendar |
getCalendar()
Returns a clone of the calendar used by this model. |
int |
getFirstDayOfWeek()
Gets what the first day of the week is; e.g., Calendar.SUNDAY in the U.S., Calendar.MONDAY
in France. |
java.util.Date |
getFirstSelectionDate()
Returns the earliest date in the selection or null if the selection is empty. |
java.util.Date |
getLastSelectionDate()
Returns the latest date in the selection or null if the selection is empty. |
java.util.Locale |
getLocale()
Returns the Locale of this model's calendar. |
java.util.Date |
getLowerBound()
Return the lower bound date that is allowed to be selected for this model. |
int |
getMinimalDaysInFirstWeek()
Gets the minimal number of days in the first week of the year. |
java.util.Date |
getNormalizedDate(java.util.Date date)
Returns a normalized Date as used by the implementation, if any. |
java.util.SortedSet<java.util.Date> |
getSelection()
Returns the current selection. |
DateSelectionModel.SelectionMode |
getSelectionMode()
Get the selection mode. |
java.util.TimeZone |
getTimeZone()
Returns the TimeZone of this model. |
java.util.SortedSet<java.util.Date> |
getUnselectableDates()
Returns a SortedSet of Dates that are unselectable. |
java.util.Date |
getUpperBound()
Return the upper bound date that is allowed to be selected for this model. |
boolean |
isAdjusting()
Returns the property to decide whether the selection is intermediate or final. |
boolean |
isSelected(java.util.Date date)
Returns true if the date specified is selected, false otherwise. |
boolean |
isSelectionEmpty()
Returns true if the selection is empty, false otherwise. |
boolean |
isUnselectableDate(java.util.Date unselectableDate)
Returns true is the specified date is unselectable. |
void |
removeDateSelectionListener(DateSelectionListener listener)
Remove the specified listener to this model. |
void |
removeSelectionInterval(java.util.Date startDate,
java.util.Date endDate)
Removes the specifed selection interval from the selection model. |
void |
setAdjusting(boolean adjusting)
Set the property to mark upcoming selections as intermediate/ final. |
void |
setFirstDayOfWeek(int firstDayOfWeek)
Sets what the first day of the week is. |
void |
setLocale(java.util.Locale locale)
Sets the Locale of this model's calendar. |
void |
setLowerBound(java.util.Date lowerBound)
Set the lower bound date that is allowed to be selected for this model. |
void |
setMinimalDaysInFirstWeek(int minimalDays)
Sets the minimal number of days in the first week of the year. |
void |
setSelectionInterval(java.util.Date startDate,
java.util.Date endDate)
Sest the specified selection interval to the selection model. |
void |
setSelectionMode(DateSelectionModel.SelectionMode mode)
Set the selection mode. |
void |
setTimeZone(java.util.TimeZone timeZone)
Sets the TimeZone of this model. |
void |
setUnselectableDates(java.util.SortedSet<java.util.Date> unselectableDates)
Sets a collection of dates which are not selectable. |
void |
setUpperBound(java.util.Date upperBound)
Set the upper bound date that is allowed to be selected for this model. |
Method Detail |
---|
DateSelectionModel.SelectionMode getSelectionMode()
void setSelectionMode(DateSelectionModel.SelectionMode mode)
mode
- new selection modejava.util.Calendar getCalendar()
int getFirstDayOfWeek()
Calendar.SUNDAY
in the U.S., Calendar.MONDAY
in France. This is needed when the model selection mode is
WEEK_INTERVAL_SELECTION
.
PENDING JW: move week-interval selection from JXMonthView into the model.
setFirstDayOfWeek(int)
void setFirstDayOfWeek(int firstDayOfWeek)
Calendar.SUNDAY
in US, Calendar.MONDAY
in France. Fires a DateSelectionEvent of type CALENDAR_CHANGED, if the
value is different from the old. The default value depends on the Calendar's default. PENDING JW: actually, it's a bound property. Use a propertyChangeListener?
firstDayOfWeek
- The first day of the week.getFirstDayOfWeek()
,
Calendar
int getMinimalDaysInFirstWeek()
void setMinimalDaysInFirstWeek(int minimalDays)
minimalDays
- the minimal number of days in the first week of the year.getMinimalDaysInFirstWeek()
,
Calendar
java.util.TimeZone getTimeZone()
setTimeZone(TimeZone)
void setTimeZone(java.util.TimeZone timeZone)
timeZone
- the TimeZone to use in this model, must not be null.getTimeZone()
java.util.Locale getLocale()
void setLocale(java.util.Locale locale)
The default value is Locale.default().
PENDING JW: fall back to JComponent.getDefaultLocale instead? We use this with components anyway?
PENDING JW: actually, it's a bound property. Use a propertyChangeListener?
locale
- the Locale to use. If null, the default Locale is used.void addSelectionInterval(java.util.Date startDate, java.util.Date endDate)
startDate
- interval start date, must not be nullendDate
- interval end date >= start date, must not be null
java.lang.NullPointerException
- if any of the dates is nullvoid setSelectionInterval(java.util.Date startDate, java.util.Date endDate)
startDate
- interval start date, must not be nullendDate
- interval end date >= start date, must not be null
java.lang.NullPointerException
- if any of the dates is nullvoid removeSelectionInterval(java.util.Date startDate, java.util.Date endDate)
startDate
- interval start date, must not be nullendDate
- interval end date >= start date, must not be null
java.lang.NullPointerException
- if any of the dates is nullvoid clearSelection()
java.util.SortedSet<java.util.Date> getSelection()
java.util.Date getFirstSelectionDate()
getLastSelectionDate()
,
getSelection()
,
isSelectionEmpty()
java.util.Date getLastSelectionDate()
getFirstSelectionDate()
,
getSelection()
,
isSelectionEmpty()
boolean isSelected(java.util.Date date)
Note: it is up to implementations to define the exact notion of selected. It does not imply the exact date as given is contained the set returned from getSelection().
date
- date to check for selection, must not be null
java.lang.NullPointerException
- if the date is nulljava.util.Date getNormalizedDate(java.util.Date date)
The overall contract:
if ((date != null) && isSelectable(date)) {
setSelectionInterval(date, date);
assertEquals(getNormalized(date), getFirstSelectionDate();
}
java.lang.NullPointerException
- if given date is null.boolean isSelectionEmpty()
java.util.SortedSet<java.util.Date> getUnselectableDates()
SortedSet
of Dates that are unselectable.
- Returns:
- sorted set of dates
void setUnselectableDates(java.util.SortedSet<java.util.Date> unselectableDates)
Note: it is up to implementations to define the exact notion of unselectableDate. It does not imply the only the exact date as given is unselectable, it might have a period like "all dates on the same day". PENDING JW: any collection would do - why insist on a SortedSet?
unselectableDates
- dates that are unselectable, must not be null and
must not contain null dates.boolean isUnselectableDate(java.util.Date unselectableDate)
unselectableDate
- the date to check for unselectability, must not be null.
java.util.Date getUpperBound()
void setUpperBound(java.util.Date upperBound)
upperBound
- upper boundjava.util.Date getLowerBound()
void setLowerBound(java.util.Date lowerBound)
lowerBound
- lower bound date or null if not setvoid setAdjusting(boolean adjusting)
adjusting
- a flag to turn the adjusting property on/off.boolean isAdjusting()
void addDateSelectionListener(DateSelectionListener listener)
listener
- listener to add to this modelvoid removeDateSelectionListener(DateSelectionListener listener)
listener
- listener to remove from this model
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |