|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jdesktop.swingx.calendar.AbstractDateSelectionModel
public abstract class AbstractDateSelectionModel
Abstract base implementation of DateSelectionModel. Implements notification, Calendar related properties and lower/upper bounds.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.jdesktop.swingx.calendar.DateSelectionModel |
|---|
DateSelectionModel.SelectionMode |
| Field Summary | |
|---|---|
protected boolean |
adjusting
|
protected java.util.Calendar |
calendar
|
static java.util.SortedSet<java.util.Date> |
EMPTY_DATES
|
protected EventListenerMap |
listenerMap
|
protected java.util.Locale |
locale
the locale used by the calendar. |
protected java.util.Date |
lowerBound
|
protected java.util.Date |
upperBound
|
| Constructor Summary | |
|---|---|
AbstractDateSelectionModel()
Instantiates a DateSelectionModel with default locale. |
|
AbstractDateSelectionModel(java.util.Locale locale)
Instantiates a DateSelectionModel with the given locale. |
|
| Method Summary | |
|---|---|
void |
addDateSelectionListener(DateSelectionListener l)
Add the specified listener to this model. |
protected void |
adjustDatesToTimeZone(java.util.TimeZone oldTimeZone)
Adjusts all stored dates to a new time zone. |
protected java.util.Date |
endOfDay(java.util.Date date)
Returns the end of the day of the given date in this model's calendar. |
protected void |
fireValueChanged(DateSelectionEvent.EventType eventType)
|
java.util.Calendar |
getCalendar()
Returns a clone of the calendar used by this model. |
java.util.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. |
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.TimeZone |
getTimeZone()
Returns the TimeZone of this model. |
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. |
protected boolean |
isSameDay(java.util.Date selected,
java.util.Date compare)
Returns a boolean indicating whether the given dates are on the same day in the coordinates of the model's calendar. |
void |
removeDateSelectionListener(DateSelectionListener l)
Remove the specified listener to this 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 |
setTimeZone(java.util.TimeZone timeZone)
Sets the TimeZone of this model. |
void |
setUpperBound(java.util.Date upperBound)
Set the upper bound date that is allowed to be selected for this model. |
protected java.util.Date |
startOfDay(java.util.Date date)
Returns the start of the day of the given date in this model's calendar. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jdesktop.swingx.calendar.DateSelectionModel |
|---|
addSelectionInterval, clearSelection, getFirstSelectionDate, getLastSelectionDate, getNormalizedDate, getSelection, getSelectionMode, getUnselectableDates, isSelected, isSelectionEmpty, isUnselectableDate, removeSelectionInterval, setSelectionInterval, setSelectionMode, setUnselectableDates |
| Field Detail |
|---|
public static final java.util.SortedSet<java.util.Date> EMPTY_DATES
protected EventListenerMap listenerMap
protected boolean adjusting
protected java.util.Calendar calendar
protected java.util.Date upperBound
protected java.util.Date lowerBound
protected java.util.Locale locale
NOTE: need to keep separately as a Calendar has no getter.
| Constructor Detail |
|---|
public AbstractDateSelectionModel()
public AbstractDateSelectionModel(java.util.Locale locale)
locale - the Locale to use with this model, defaults to Locale.default()
if null.| Method Detail |
|---|
public java.util.Calendar getCalendar()
getCalendar in interface DateSelectionModelpublic 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.
getFirstDayOfWeek in interface DateSelectionModelDateSelectionModel.setFirstDayOfWeek(int)public 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?
setFirstDayOfWeek in interface DateSelectionModelfirstDayOfWeek - The first day of the week.DateSelectionModel.getFirstDayOfWeek(),
Calendarpublic int getMinimalDaysInFirstWeek()
getMinimalDaysInFirstWeek in interface DateSelectionModelpublic void setMinimalDaysInFirstWeek(int minimalDays)
setMinimalDaysInFirstWeek in interface DateSelectionModelminimalDays - the minimal number of days in the first week of the year.DateSelectionModel.getMinimalDaysInFirstWeek(),
Calendarpublic java.util.TimeZone getTimeZone()
getTimeZone in interface DateSelectionModelDateSelectionModel.setTimeZone(TimeZone)public void setTimeZone(java.util.TimeZone timeZone)
setTimeZone in interface DateSelectionModeltimeZone - the TimeZone to use in this model, must not be null.DateSelectionModel.getTimeZone()protected void adjustDatesToTimeZone(java.util.TimeZone oldTimeZone)
This implementation resets all dates to null, clears everything. Subclasses may override to really map to the new time zone.
oldTimeZone - the old time zonepublic java.util.Locale getLocale()
getLocale in interface DateSelectionModelpublic 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?
setLocale in interface DateSelectionModellocale - the Locale to use. If null, the default Locale is used.protected java.util.Date startOfDay(java.util.Date date)
date - the Date to get the start for.
protected java.util.Date endOfDay(java.util.Date date)
date - the Date to get the start for.
protected boolean isSameDay(java.util.Date selected,
java.util.Date compare)
selected - one of the dates to check, must not be null.compare - the other of the dates to check, must not be null.
public java.util.Date getUpperBound()
getUpperBound in interface DateSelectionModelpublic void setUpperBound(java.util.Date upperBound)
setUpperBound in interface DateSelectionModelupperBound - upper boundpublic java.util.Date getLowerBound()
getLowerBound in interface DateSelectionModelpublic void setLowerBound(java.util.Date lowerBound)
setLowerBound in interface DateSelectionModellowerBound - lower bound date or null if not setpublic boolean isAdjusting()
isAdjusting in interface DateSelectionModelpublic void setAdjusting(boolean adjusting)
setAdjusting in interface DateSelectionModeladjusting - a flag to turn the adjusting property on/off.public void addDateSelectionListener(DateSelectionListener l)
addDateSelectionListener in interface DateSelectionModell - listener to add to this modelpublic void removeDateSelectionListener(DateSelectionListener l)
removeDateSelectionListener in interface DateSelectionModell - listener to remove from this modelpublic java.util.List<DateSelectionListener> getDateSelectionListeners()
protected void fireValueChanged(DateSelectionEvent.EventType eventType)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||