com.icesoft.faces.facelets.component.select

## Class SelectInputCalendar

- java.lang.Object
- - com.icesoft.faces.facelets.component.select.SelectInputCalendar

- All Implemented Interfaces:
    java.io.Serializable
  Direct Known Subclasses:
    SelectInputTime

      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:

  someSelectInputCalendar.setDate(myDate);

  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.

  Author:
    ICEfaces Technologies Inc.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.GregorianCalendar` | `calendar`
    `static int` | `NUMBER_OF_YEARS_DISPLAY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SelectInputCalendar()` Creates a new SelectInputCalendar object.
    `SelectInputCalendar(java.util.TimeZone timezone)` Creates a new SelectInputCalendar object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### NUMBER_OF_YEARS_DISPLAY

          public static final int NUMBER_OF_YEARS_DISPLAY

      See Also:
        Constant Field Values

    - #### calendar

          protected java.util.GregorianCalendar calendar

  - ### Constructor Detail

    - #### SelectInputCalendar

          public SelectInputCalendar(java.util.TimeZone timezone)

      Creates a new SelectInputCalendar object.
      Parameters:
        `timezone` - timezone that the calendar resides in.

    - #### SelectInputCalendar

          public SelectInputCalendar()

      Creates a new SelectInputCalendar object. The server's current timezone is used for this instance.

  - ### Method Detail

    - #### setTimeZone

          public void setTimeZone(java.util.TimeZone timezone)

      Sets the timezone used by the GregorianCalendar instance.
      Parameters:
        `timezone` - timezone to be applied the the GregorianCalendar instance.

    - #### monthChanged

          public void monthChanged(javax.faces.event.ValueChangeEvent event)

      When the month selection component is changed, this method makes sure that the calendar is correctly updated. As a side effect of a month change, the day value may be incremented to compensate for the correct number of days in the given month.
      Parameters:
        `event` - jsf value change event.

    - #### dayChanged

          public void dayChanged(javax.faces.event.ValueChangeEvent event)

      When the day selection component is changed, this method makes sure the calendar object is correctly updated.
      Parameters:
        `event` - jsf value change event.

    - #### yearChanged

          public void yearChanged(javax.faces.event.ValueChangeEvent event)

      When the year selection component is changed, this method makes sure that the calendar is correctly updated. A day check also takes place to ensure that the leap year is accounted for, adjustments are made as needed.
      Parameters:
        `event` - jsf value change event.

    - #### setDate

          public void setDate(java.util.Date date)

    - #### updateCalendarValues

          protected void updateCalendarValues()

      Converts the calendar values into three primary values, year, month and day, represented by ints.

    - #### setDefaultMaxDays

          protected void setDefaultMaxDays()

      Sets the default max number of days to display in the selection component. The number of days is based on the GregorianCalendar actual maximum for the current day of month which takes into account leap years and other calendar oddities.

    - #### setMaxYears

          protected void setMaxYears()

      Sets the max number of years to display in the selection component. The max number of years is defined by the constant NUMBER_OF_YEARS_DISPLAY.

    - #### getCalendar

          public java.util.GregorianCalendar getCalendar()

    - #### setCalendar

          public void setCalendar(java.util.GregorianCalendar calendar)

    - #### getMonth

          public int getMonth()

    - #### setMonth

          public void setMonth(int month)

    - #### getDay

          public int getDay()

    - #### setDay

          public void setDay(int day)

    - #### getYear

          public int getYear()

    - #### setYear

          public void setYear(int year)

    - #### getMonths

          public javax.faces.model.SelectItem[] getMonths()

    - #### getDays

          public javax.faces.model.SelectItem[] getDays()

    - #### getYears

          public javax.faces.model.SelectItem[] getYears()

Copyright 2025 ICEsoft Technologies Canada, Corp. All Rights Reserved.