|
||||||||||
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 Calendar |
calendar
|
static SortedSet<Date> |
EMPTY_DATES
|
protected EventListenerMap |
listenerMap
|
protected Locale |
locale
the locale used by the calendar. |
protected Date |
lowerBound
|
protected Date |
upperBound
|
Constructor Summary | |
---|---|
AbstractDateSelectionModel()
Instantiates a DateSelectionModel with default locale. |
|
AbstractDateSelectionModel(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(TimeZone oldTimeZone)
Adjusts all stored dates to a new time zone. |
protected Date |
endOfDay(Date date)
Returns the end of the day of the given date in this model's calendar. |
protected void |
fireValueChanged(DateSelectionEvent.EventType eventType)
|
Calendar |
getCalendar()
Returns a clone of the calendar used by this model. |
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. |
Locale |
getLocale()
Returns the Locale of this model's calendar. |
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. |
TimeZone |
getTimeZone()
Returns the TimeZone of this model. |
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(Date selected,
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(Locale locale)
Sets the Locale of this model's calendar. |
void |
setLowerBound(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(TimeZone timeZone)
Sets the TimeZone of this model. |
void |
setUpperBound(Date upperBound)
Set the upper bound date that is allowed to be selected for this model. |
protected Date |
startOfDay(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 SortedSet<Date> EMPTY_DATES
protected EventListenerMap listenerMap
protected boolean adjusting
protected Calendar calendar
protected Date upperBound
protected Date lowerBound
protected Locale locale
NOTE: need to keep separately as a Calendar has no getter.
Constructor Detail |
---|
public AbstractDateSelectionModel()
public AbstractDateSelectionModel(Locale locale)
locale
- the Locale to use with this model, defaults to Locale.default()
if null.Method Detail |
---|
public Calendar getCalendar()
getCalendar
in interface DateSelectionModel
public 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 DateSelectionModel
DateSelectionModel.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 DateSelectionModel
firstDayOfWeek
- The first day of the week.DateSelectionModel.getFirstDayOfWeek()
,
Calendar
public int getMinimalDaysInFirstWeek()
getMinimalDaysInFirstWeek
in interface DateSelectionModel
public void setMinimalDaysInFirstWeek(int minimalDays)
setMinimalDaysInFirstWeek
in interface DateSelectionModel
minimalDays
- the minimal number of days in the first week of the year.DateSelectionModel.getMinimalDaysInFirstWeek()
,
Calendar
public TimeZone getTimeZone()
getTimeZone
in interface DateSelectionModel
DateSelectionModel.setTimeZone(TimeZone)
public void setTimeZone(TimeZone timeZone)
setTimeZone
in interface DateSelectionModel
timeZone
- the TimeZone to use in this model, must not be null.DateSelectionModel.getTimeZone()
protected void adjustDatesToTimeZone(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 Locale getLocale()
getLocale
in interface DateSelectionModel
public void setLocale(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 DateSelectionModel
locale
- the Locale to use. If null, the default Locale is used.protected Date startOfDay(Date date)
date
- the Date to get the start for.
protected Date endOfDay(Date date)
date
- the Date to get the start for.
protected boolean isSameDay(Date selected, 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 Date getUpperBound()
getUpperBound
in interface DateSelectionModel
public void setUpperBound(Date upperBound)
setUpperBound
in interface DateSelectionModel
upperBound
- upper boundpublic Date getLowerBound()
getLowerBound
in interface DateSelectionModel
public void setLowerBound(Date lowerBound)
setLowerBound
in interface DateSelectionModel
lowerBound
- lower bound date or null if not setpublic boolean isAdjusting()
isAdjusting
in interface DateSelectionModel
public void setAdjusting(boolean adjusting)
setAdjusting
in interface DateSelectionModel
adjusting
- a flag to turn the adjusting property on/off.public void addDateSelectionListener(DateSelectionListener l)
addDateSelectionListener
in interface DateSelectionModel
l
- listener to add to this modelpublic void removeDateSelectionListener(DateSelectionListener l)
removeDateSelectionListener
in interface DateSelectionModel
l
- listener to remove from this modelpublic 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 |