Interface ITimebox

  • All Superinterfaces:
    IAnyGroup<ITimebox>, IChildrenOfInputgroup<ITimebox>, IComponent<ITimebox>, IDateTimeFormatInputElement<ITimebox>, IFormatInputElement<ITimebox,​java.util.Date>, IHtmlBasedComponent<ITimebox>, IInputElement<ITimebox,​java.util.Date>, IReadonly<ITimebox>, IXulElement<ITimebox>

    public interface ITimebox
    extends IDateTimeFormatInputElement<ITimebox>, IAnyGroup<ITimebox>
    Immutable Timebox component.

    An input box for holding a time (a java.util.Date Object), but only Hour & Minute are used.

    Constraint

    You could specify what value to accept for input controls by use of the constraint attribute. It could be no empty.

    Format

    Use a to signify it is am or pm. The input string follows the formatting of the SimpleDateFormat.

    Below is an example of using a within the format.

     
     ITimebox.ofCols(20).withFormat("a hh:mm:ss");
     
     

    24 hours mode:

     
     ITimebox.ofCols(8).withFormat("HH:mm:ss");
     
     

    In addition to specifying the format explicitly, you could specify the styling. There are four different types of styling: short, medium, long and full (representing the styling of DateFormat).

    For example, you could specify the styling rather than the real format as follows.

     
     ITimebox.ofFormat("short");
     ITimebox.ofFormat("long");
     
     

    Locale

    By default, the real format depends on the current locale (i.e., Locales.getCurrent(). However, you could specify the locale for an individual instance such as:

     
     ITimebox.ofFormat("medium").withLocale("de_DE");
     ITimebox.ofFormat("long").withLocale("fr");
     
     
    Author:
    katherine
    See Also:
    Timebox
    • Field Detail

      • DEFAULT

        static final ITimebox DEFAULT
        Constant for default attributes of this immutable component.
      • DEFAULT_COLS_VALUE

        static final int DEFAULT_COLS_VALUE
        Constant for default cols for timebox auto sizing
        See Also:
        Constant Field Values
    • Method Detail

      • getWidgetClass

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

        Default: "zul.db.Timebox"

        Specified by:
        getWidgetClass in interface IComponent<ITimebox>
      • isButtonVisible

        default boolean isButtonVisible()
        Returns whether the button (on the right of the timebox) is visible.

        Default: true.

      • withButtonVisible

        ITimebox withButtonVisible​(boolean buttonVisible)
        Returns a copy of this immutable component with the specified buttonVisible.

        Sets whether the button (on the right of the timebox) is visible.

        Parameters:
        buttonVisible - false to disable the button visibility.

        Default: true.

        Returns:
        A modified copy of the this object
      • getCols

        default int getCols()
        Returns the cols which determines the visible width, in characters.

        Default: DEFAULT_COLS_VALUE (it means that if cols is not set by user, it will match the formatted value at the beginning)

        Specified by:
        getCols in interface IInputElement<ITimebox,​java.util.Date>
      • getFormat

        default java.lang.String getFormat()
        Returns the format of the timebox.

        Default: "" (empty string).

        Specified by:
        getFormat in interface IFormatInputElement<ITimebox,​java.util.Date>
      • of

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

        static ITimebox of​(java.time.temporal.Temporal date)
        Return the instance of the given date.
        Parameters:
        date - The date to indicate the time for the timebox.
      • ofCols

        static ITimebox ofCols​(int cols)
        Returns the instance with the given cols.
        Parameters:
        cols - The cols which determines the visible width
      • ofConstraint

        static ITimebox ofConstraint​(java.lang.String constraint)
        Returns the instance with the given constraint.
        Parameters:
        constraint - The timebox constraint
      • ofFormat

        static ITimebox ofFormat​(java.lang.String format)
        Returns the instance with the given format.
        Parameters:
        format - The timebox format
      • ofLocale

        static ITimebox ofLocale​(java.lang.String locale)
        Returns the instance with the given locale.
        Parameters:
        locale - The timebox locale
      • ofLocale

        static ITimebox ofLocale​(java.util.Locale locale)
        Returns the instance with the given locale.
        Parameters:
        locale - The timebox locale
      • ofId

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