Interface ICalendar

  • All Superinterfaces:
    IAnyGroup<ICalendar>, IComponent<ICalendar>, IHtmlBasedComponent<ICalendar>, IXulElement<ICalendar>

    public interface ICalendar
    extends IXulElement<ICalendar>, IAnyGroup<ICalendar>
    Immutable Calendar component

    A calendar.

    Support @Action

    Name Action Type
    onWeekClick Denotes a user clicks upon a label of week of year. [ZK EE].

    The First Day of the Week

    The first day of the week is decided by the locale (actually the return value of the getFirstDayOfWeek method in the Calendar). You can also control the first day of the week by the use of the session attribute and the library property. Please refer to The First Day of the Week for details.

    2DigitYearStart

    You can control the 2DigitYearStart by the use of the library property, for example,

     <library-property>
         <name>org.zkoss.web.preferred.2DigitYearStart</name>
         <value>1950</value>
     </library-property>
     
     

    Constraint

    You could specify what value to accept for input controls by use of the constraint attribute. It could be a combination of no future, no past, and no today.

    It also supports an interval of dates. For example,

     
     IDatebox.ofConstraint("between 20071225 and 20071203");
     IDatebox.ofConstraint("before 20071225");
     IDatebox.ofConstraint("after 20071225");
     
     
    Author:
    katherine
    See Also:
    Calendar
    • Field Detail

      • DEFAULT

        static final ICalendar DEFAULT
        Constant for default attributes of this immutable component.
    • Method Detail

      • getWidgetClass

        default java.lang.String getWidgetClass()
        Returns the client widget class.

        Default: "zul.db.Calendar"

        Specified by:
        getWidgetClass in interface IComponent<ICalendar>
      • getConstraint

        @Nullable
        java.lang.String getConstraint()
        Returns the client constraint to validate the value entered by a user. if any.

        Default: null

      • withConstraint

        ICalendar withConstraint​(@Nullable
                                 java.lang.String constraint)
        Returns a copy of this immutable component with the specified constraint.

        Sets the client constraint to validate the value entered by a user; you can specify the following values or Regular Expression.

        Condition Description
        no future Date in the future is not allowed.
        no past Date in the past is not allowed.
        no today Today is not allowed.
        between yyyyMMdd and yyyyMMdd Date only allowed between the specified range. The format must be yyyyMMdd, such as
        
         ICalendar.ofConstraint("between 20211225 and 20211203");
             
        after yyyyMMdd Date only allowed after (and including) the specified date. The format must be yyyyMMdd, such as
        
         ICalendar.ofConstraint("after 20211225");
             
        before yyyyMMdd Date only allowed before (and including) the specified date. The format must be yyyyMMdd, such as
        
         ICalendar.ofConstraint("before 20211225");
             
        Parameters:
        constraint - The client constraint of the component.

        Default: null.

        Returns:
        A modified copy of the this object
      • getName

        @Nullable
        java.lang.String getName()
        Returns the name of this component.

        Default: null.

        The name is used only to work with "legacy" Web application that handles user's request by servlets. It works only with HTTP/HTML-based browsers. It doesn't work with other kind of clients.

        Don't use this method if your application is purely based on ZK's event-driven model.

      • withName

        ICalendar withName​(@Nullable
                           java.lang.String name)
        Returns a copy of this immutable component with the specified name.

        Sets the name of this component.

        The name is used only to work with "legacy" Web application that handles user's request by servlets. It works only with HTTP/HTML-based browsers. It doesn't work with other kind of clients.

        Don't use this method if your application is purely based on ZK's event-driven model.

        Parameters:
        name - The name of this component.

        Default: null.

        Returns:
        A modified copy of the this object
      • getValue

        default java.util.Date getValue()
        Returns the value that is assigned to this component, never null.

        Default: ZonedDateTime.now()

      • withValue

        ICalendar withValue​(java.util.Date value)
        Returns a copy of this immutable component with the specified value.

        Assigns a value to this component.

        Parameters:
        value - The value of the calendar.

        Default: ZonedDateTime.now().

        Returns:
        A modified copy of the this object
      • getValueInZonedDateTime

        @Lazy
        default java.time.ZonedDateTime getValueInZonedDateTime()
        Returns the value (in ZonedDateTime) that is assigned to this component, never null.

        Default: ZonedDateTime.now()

      • withValueInZonedDateTime

        default ICalendar withValueInZonedDateTime​(java.time.ZonedDateTime value)
        Returns a copy of this immutable component with the specified value.

        Assigns a value to this component.

        Parameters:
        value - The value of the calendar.

        Default: ZonedDateTime.now().

        Returns:
        A modified copy of the this object
      • getValueInLocalDateTime

        @Lazy
        default java.time.LocalDateTime getValueInLocalDateTime()
        Returns the value (in LocalDateTime) that is assigned to this component, never null.

        Default: ZonedDateTime.now().

      • withValueInLocalDateTime

        default ICalendar withValueInLocalDateTime​(java.time.LocalDateTime value)
        Returns a copy of this immutable component with the specified value.

        Assigns a value to this component.

        Parameters:
        value - The value of the calendar.

        Default: ZonedDateTime.now().

        Returns:
        A modified copy of the this object
      • getValueInLocalDate

        @Lazy
        default java.time.LocalDate getValueInLocalDate()
        Returns the value (in LocalDate) that is assigned to this component, never null.

        Default: ZonedDateTime.now().

      • withValueInLocalDate

        default ICalendar withValueInLocalDate​(java.time.LocalDate value)
        Returns a copy of this immutable component with the specified value.

        Assigns a value to this component.

        Parameters:
        value - The value of the calendar.

        Default: ZonedDateTime.now().

        Returns:
        A modified copy of the this object
      • isWeekOfYear

        default boolean isWeekOfYear()
        Returns whether enable to show the week number within the current year or not.

        Default: false

      • withWeekOfYear

        ICalendar withWeekOfYear​(boolean weekOfYear)
        Returns a copy of this immutable component with the specified weekOfYear.

        Sets whether enable to show the week number within the current year or not. [ZK EE]

        Parameters:
        weekOfYear - Whether enable to show the week number within the current year or not.

        Default: ZonedDateTime.now().

        Returns:
        A modified copy of the this object
      • getShowTodayLink

        default boolean getShowTodayLink()
        Returns whether enable to show the link that jump to today in day view

        Default: false

      • withShowTodayLink

        ICalendar withShowTodayLink​(boolean showTodayLink)
        Returns a copy of this immutable component with the specified showTodayLink.

        Sets whether enable to show the link that jump to today in day view

        Parameters:
        showTodayLink - true to show a link to jump to today.

        Default: false.

        Returns:
        A modified copy of the this object
      • getTodayLinkLabel

        default java.lang.String getTodayLinkLabel()
        Returns the label of the link that jump to today in day view

        Default: "Today"

      • withTodayLinkLabel

        ICalendar withTodayLinkLabel​(java.lang.String todayLinkLabel)
        Returns a copy of this immutable component with the specified todayLinkLabel.

        Sets the label of the link that jump to today in day view.

        Parameters:
        todayLinkLabel - The label of the link to jump to today.

        Default: "Today".

        Returns:
        A modified copy of the this object
      • of

        static ICalendar of​(java.util.Date date)
        Return the instance of the given date.
        Parameters:
        date - The date to indicate the time for the calendar.
      • of

        static ICalendar of​(java.time.temporal.Temporal date)
        Return the instance of the given date.
        Parameters:
        date - The date to indicate the time for the calendar.
      • ofConstraint

        static ICalendar ofConstraint​(java.lang.String constraint)
        Returns the instance with the given constraint.
        Parameters:
        constraint - The calendar constraint
      • ofId

        static ICalendar ofId​(java.lang.String id)
        Returns the instance with the given id.
        Parameters:
        id - The id to identify this component