public class SelectInputCalendar
extends java.lang.Object
implements java.io.Serializable
Backing bean that should be used with the SelectInputCalendar component. The intended use is to only use the bean with the SelectInputCalendar and ideally only manipulate the calendar instance variable. If the api you are interacting with uses Date object then it can be easily be changed to a GregorianCalendar object with the method setTime(). For example:
This class doesn't currently have any JSF validation facilities but it could easily be extended. However the GregorianCalendar object will automatically correct most dates.
| Modifier and Type | Field and Description |
|---|---|
protected java.util.GregorianCalendar |
calendar |
static int |
NUMBER_OF_YEARS_DISPLAY |
| Constructor and Description |
|---|
SelectInputCalendar()
Creates a new SelectInputCalendar object.
|
SelectInputCalendar(java.util.TimeZone timezone)
Creates a new SelectInputCalendar object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dayChanged(javax.faces.event.ValueChangeEvent event)
When the day selection component is changed, this method makes sure
the calendar object is correctly updated.
|
java.util.GregorianCalendar |
getCalendar() |
int |
getDay() |
javax.faces.model.SelectItem[] |
getDays() |
int |
getMonth() |
javax.faces.model.SelectItem[] |
getMonths() |
int |
getYear() |
javax.faces.model.SelectItem[] |
getYears() |
void |
monthChanged(javax.faces.event.ValueChangeEvent event)
When the month selection component is changed, this method makes sure
that the calendar is correctly updated.
|
void |
setCalendar(java.util.GregorianCalendar calendar) |
void |
setDate(java.util.Date date) |
void |
setDay(int day) |
protected void |
setDefaultMaxDays()
Sets the default max number of days to display in the selection
component.
|
protected void |
setMaxYears()
Sets the max number of years to display in the selection component.
|
void |
setMonth(int month) |
void |
setTimeZone(java.util.TimeZone timezone)
Sets the timezone used by the GregorianCalendar instance.
|
void |
setYear(int year) |
protected void |
updateCalendarValues()
Converts the calendar values into three primary values, year, month and
day, represented by ints.
|
void |
yearChanged(javax.faces.event.ValueChangeEvent event)
When the year selection component is changed, this method makes sure that
the calendar is correctly updated.
|
public static final int NUMBER_OF_YEARS_DISPLAY
protected java.util.GregorianCalendar calendar
public SelectInputCalendar(java.util.TimeZone timezone)
timezone - timezone that the calendar resides in.public SelectInputCalendar()
public void setTimeZone(java.util.TimeZone timezone)
timezone - timezone to be applied the the GregorianCalendar instance.public void monthChanged(javax.faces.event.ValueChangeEvent event)
event - jsf value change event.public void dayChanged(javax.faces.event.ValueChangeEvent event)
event - jsf value change event.public void yearChanged(javax.faces.event.ValueChangeEvent event)
event - jsf value change event.public void setDate(java.util.Date date)
protected void updateCalendarValues()
protected void setDefaultMaxDays()
protected void setMaxYears()
public java.util.GregorianCalendar getCalendar()
public void setCalendar(java.util.GregorianCalendar calendar)
public int getMonth()
public void setMonth(int month)
public int getDay()
public void setDay(int day)
public int getYear()
public void setYear(int year)
public javax.faces.model.SelectItem[] getMonths()
public javax.faces.model.SelectItem[] getDays()
public javax.faces.model.SelectItem[] getYears()
Copyright 2025 ICEsoft Technologies Canada, Corp. All Rights Reserved.