Interface IUIDateTime

All Known Implementing Classes:
EUIDateTime, MLDateTime, UIDateTime

public interface IUIDateTime
Date time interface for common routines in UIDateTime and MLDateTime.
Author:
Christopher Mindus
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the date-time datatype for this component.
    default GDateTime
    Gets the default value of the component as a GDateTime.
    default GDateTime
    Gets the default value of the component as a GDateTime.
    int
    Gets the format used.
    Returns the GDateTime datatype for this component.
    default LocalDate
    Gets the local date part of the value.
    default LocalTime
    Gets the local time part of the value.
    int
    Gets the maximum year for the mobile spinner.
    int
    Gets the minimum year for the mobile spinner.
    Returns the date-time type for this component.
    Gets the current date-time value.
    default ZoneId
    Gets the zone of the value.
    boolean
    Returns whether a button to show calendar should be present for date input (mobile only).
    boolean
    Returns whether a calendar should be used for date input (mobile only).
    boolean
    Returns if the enforcement of the datatype is set.
    default boolean
    Returns if the implementation requires a date in the value component.
    default boolean
    Returns if the implementation supports date.
    boolean
    Returns whether to combine day and month in a single spinner (mobile).
    boolean
    Returns whether the time value should use milliseconds in time formats using seconds.
    boolean
    Returns if a null value is allowed, i.e.
    default boolean
    Returns if the implementation requires a time in the value component.
    default boolean
    Returns if the implementation supports time.
    boolean
    Returns whether the zone should be used for a ZonedTimeDate type.
    boolean
    setCombineDayMonth(boolean on)
    Sets whether to combine day and month in a single spinner (mobile).
    default boolean
    setDate(LocalDate localDate)
    Sets the value as a local date with the locale information of the current user session (or system default) in case value conversion is required.
    default boolean
    setDate(LocalDate localDate, LocaleInfo localeInfo)
    Sets the value as a local date.
    boolean
    setFormat(int format)
    Sets the format.
    boolean
    setNullAllowed(boolean isNullAllowed)
    Sets the null value allowed flag, i.e.
    default boolean
    setTime(LocalTime localTime)
    Sets the value as a local time with the locale information of the current user session (or system default) in case value conversion is required.
    default boolean
    setTime(LocalTime localTime, LocaleInfo localeInfo)
    Sets the value as a local time.
    boolean
    setType(UIDateTimeType type, UIDateTimeDataType dataType, boolean doEnforceDataType)
    Sets the date-time type, its datatype and the enforcement flag of the datatype.
    boolean
    setUseCalendar(boolean on)
    Sets whether a calendar should be used for date input (mobile only).
    boolean
    Sets whether a calendar button should be shown for date input (mobile only).
    boolean
    setUseMilliseconds(boolean on)
    Sets whether the time value should use milliseconds in time formats using seconds.
    boolean
    setUseZone(boolean on)
    Sets whether the zone should be used for a ZonedTimeDate type.
    default boolean
    Sets the date-time value with the locale information of the current user session (or system default) in case value conversion is required.
    boolean
    setValue(GDateTime value, LocaleInfo localeInfo)
    Sets the date-time value.
    boolean
    Sets the value to null.
    boolean
    setYearRange(int min, int max)
    Sets the minimum and maximum year for the mobile spinner.
    default boolean
    Sets the zone value.
  • Method Details

    • getUIDateTimeType

      UIDateTimeType getUIDateTimeType()
      Returns the date-time type for this component.
      Returns:
      Enum value as Time, Date, DateTime or ZoneId.
    • getDataType

      UIDateTimeDataType getDataType()
      Returns the date-time datatype for this component.
      Returns:
      Enum value as Time, Date, DateTime or ZoneId.
    • getGDateTimeType

      GDateTime.Type getGDateTimeType()
      Returns the GDateTime datatype for this component.
      Returns:
      Enum value as LocalTime, OffsetTime, LocalDate, LocalDateTime, OffsetDateTime or ZonedDateTime.
    • isDataTypeEnforced

      boolean isDataTypeEnforced()
      Returns if the enforcement of the datatype is set.
      Returns:
      true if the datatype when setting the value MUST be exactly the same datatype, or false (default) to allow conversion to the internal configured datatype. In the Designer, this value is called "Allow data conversion", and is default true.
    • setType

      boolean setType(UIDateTimeType type, UIDateTimeDataType dataType, boolean doEnforceDataType)
      Sets the date-time type, its datatype and the enforcement flag of the datatype.

      Note 1: This method DOES NOT change the value, so the value may end up in the wrong datatype, and you should ensure that this does not occur.

      Note 2: The doEnforceDataType is always true for ZoneId type.

      Parameters:
      type - The type.
      dataType - The datatype.
      Returns:
      true if a change of type, datatype or enforcement occurred, false for no change.
      Throws:
      IllegalArgumentException - If the type does not support the dataType.
    • isNullAllowed

      boolean isNullAllowed()
      Returns if a null value is allowed, i.e. no date/time value is set and the UI component is blank.
      Returns:
      true if null is allowed, or false (default) if not allowed.
    • setNullAllowed

      boolean setNullAllowed(boolean isNullAllowed)
      Sets the null value allowed flag, i.e. allows no date/time value to be set and the UI component is blank.

      Setting this parameter isNullAllowed to false when the value already is null will not affect the value.

      Parameters:
      isNullAllowed - Flag for null allowed.
      Returns:
      true if the setting changed, false for no change.
    • setValueToNull

      boolean setValueToNull()
      Sets the value to null.
      Returns:
      true for value changed, false for no change.
      Throws:
      IllegalStateException - If the flag isNullAllowed() is false.
    • setValue

      default boolean setValue(GDateTime value)
      Sets the date-time value with the locale information of the current user session (or system default) in case value conversion is required.
      Parameters:
      value - The value to set, null may be allowed depending on the flag returned by isNullAllowed().
      Returns:
      true for value changed, false for no change to the value.
      Throws:
      IllegalArgumentException - If the date/time type is enforced and not matching.
      IllegalStateException - If the date/time conversion cannot possibly take place due to type mismatch.
      NullPointerException - If the value is null and allow null is not enabled.
    • setValue

      boolean setValue(GDateTime value, LocaleInfo localeInfo)
      Sets the date-time value.
      Parameters:
      value - The value to set, null may be allowed depending on the flag returned by isNullAllowed().
      localeInfo - The locale information to use, or null to use the current user's or system default.
      Returns:
      true for value changed, false for no change to the value.
      Throws:
      IllegalArgumentException - If the date/time type is enforced and not matching.
      IllegalStateException - If the date/time conversion cannot possibly take place due to type mismatch.
      NullPointerException - If the value is null and allow null is not enabled.
    • getValue

      GDateTime getValue()
      Gets the current date-time value.
      Returns:
      The current value as configured with its datatype's corresponding GDateTime value, or null if the value is null and the flag isNullAllowed() is set. The value may still be null if the "null-allowed" flag has been toggled recently programmatically to false but the value has not been assigned yet.
    • getDefaultValue

      default GDateTime getDefaultValue()
      Gets the default value of the component as a GDateTime.
      Returns:
      The default value depends on the date/time type, i.e. the time as midnight as a LocalTime (00:00:00 for type Time), the epoch date as a LocalDate (1st of January 1970 for type Date), the combination of the two above for type DateTime, and the current Zone ID of the user's session (or system default) for ZoneId.
    • getDefaultValue

      default GDateTime getDefaultValue(LocaleInfo localeInfo)
      Gets the default value of the component as a GDateTime.
      Parameters:
      localeInfo - The locale information to use when retrieving the Zone ID, null for current user's locale or system default.
      Returns:
      The time as midnight as a LocalTime, i.e. 00:00:00 for type TIME, the epoch date as a LocalDate, i.e. 1st of January 1970 for type DATE and the combination of the two above for type DATE_TIME.
    • isTimeValueSupported

      default boolean isTimeValueSupported()
      Returns if the implementation supports time.
      Returns:
      false when time is not supported, true when setting a value requires a time part.
    • isTimeValueRequired

      default boolean isTimeValueRequired()
      Returns if the implementation requires a time in the value component.
      Returns:
      true when time is required in the component, and null is not allowed.
    • getLocalTime

      default LocalTime getLocalTime()
      Gets the local time part of the value.
      Returns:
      Only the time part of the value, or null if the value is null.
      Throws:
      IllegalStateException - If the value doesn't contain a time part, i.e. it's the wrong datatype.
    • setTime

      default boolean setTime(LocalTime localTime)
      Sets the value as a local time with the locale information of the current user session (or system default) in case value conversion is required.

      If the component is configured for the UIDateTimeType.DateTime, this will change only the time part of the value and keep offset, zone and/or date parts. To set the entire value, use setValue(GDateTime) or setValue(GDateTime, LocaleInfo).

      Parameters:
      localTime - The local time to set, null is not allowed.
      Throws:
      IllegalArgumentException - If the date/time type is enforced and not matching, or in case the datatype is UIDateTimeType.Date.
      NullPointerException - If localTime is null or in case the CURRENT value is null and the datatype is UIDateTimeType.DateTime.
    • setTime

      default boolean setTime(LocalTime localTime, LocaleInfo localeInfo)
      Sets the value as a local time.

      If the component is configured for the UIDateTimeType.DateTime, this will change only the time part of the value and keep offset, zone and/or date parts. To set the entire value, use setValue(GDateTime) or setValue(GDateTime, LocaleInfo).

      Parameters:
      localTime - The local time to set, null is not allowed.
      localeInfo - The locale information to use, or null to use the current user's or system default.
      Throws:
      IllegalArgumentException - If the date/time type is enforced and not matching, or in case the datatype is UIDateTimeType.Date or UIDateTimeType.ZoneId.
      NullPointerException - If localTime is null or in case the CURRENT value is null and the datatype is UIDateTimeType.DateTime.
    • isDateValueSupported

      default boolean isDateValueSupported()
      Returns if the implementation supports date.
      Returns:
      false when date is not supported, true when setting a value requires a date part.
    • isDateValueRequired

      default boolean isDateValueRequired()
      Returns if the implementation requires a date in the value component.
      Returns:
      true when date is required in the component, and null is not allowed.
    • getLocalDate

      default LocalDate getLocalDate()
      Gets the local date part of the value.
      Returns:
      Only the date part of the value, or null if the value is null.
      Throws:
      IllegalStateException - If the value doesn't contain a date part, i.e. it's the wrong datatype.
    • setDate

      default boolean setDate(LocalDate localDate)
      Sets the value as a local date with the locale information of the current user session (or system default) in case value conversion is required.

      If the component is configured for the UIDateTimeType.DateTime, this will change only the date part of the value and keep offset, zone and/or date parts. To set the entire value, use setValue(GDateTime) or setValue(GDateTime, LocaleInfo).

      Parameters:
      localDate - The local date to set, null is not allowed.
      Throws:
      IllegalArgumentException - If the date/time type is enforced and not matching, or in case the datatype is UIDateTimeType.Time.
      NullPointerException - If localDate is null or in case the CURRENT value is null and the datatype is UIDateTimeType.DateTime.
    • setDate

      default boolean setDate(LocalDate localDate, LocaleInfo localeInfo)
      Sets the value as a local date.

      If the component is configured for the UIDateTimeType.DateTime, this will change only the date part of the value and keep offset, zone and/or date parts. To set the entire value, use setValue(GDateTime) or setValue(GDateTime, LocaleInfo).

      Parameters:
      localDate - The local date to set, null is not allowed.
      localeInfo - The locale information to use, or null to use the current user's or system default.
      Throws:
      IllegalArgumentException - If the date/time type is enforced and not matching, or in case the datatype is UIDateTimeType.Time or UIDateTimeType.ZoneId.
      NullPointerException - If localDate is null or in case the CURRENT value is null and the datatype is UIDateTimeType.DateTime.
    • getZoneId

      default ZoneId getZoneId()
      Gets the zone of the value.
      Returns:
      Only the zone part of the value, or null if the value is null or doesn't have a zone. It is non-null only when the value is non-null and datatype is one of OffsetTime, OffsetDateTime, ZonedDateTime or ZoneId.
    • setZoneId

      default boolean setZoneId(ZoneId zone)
      Sets the zone value.

      If the component is configured for the UIDateTimeType.DateTime, this will change only the zone part of the value.

      Parameters:
      zone - The local date to set, null is not allowed.
      Throws:
      IllegalArgumentException - If the date/time type is enforced and not matching, or in case the datatype is UIDateTimeType.ZoneId.
      NullPointerException - If zone is null or in case the CURRENT value is null and the datatype is UIDateTimeType.DateTime.
    • getFormat

      int getFormat()
      Gets the format used.
      Returns:
      The format as 0=short, 1=normal, 2=long or 3=full (default).
    • setFormat

      boolean setFormat(int format)
      Sets the format.
      Parameters:
      format - The format as 0=short, 1=normal, 2=long or 3=full (default).
      Returns:
      true for changes, false for no change.
      Throws:
      IllegalArgumentException - If the format is not 0-3.
    • getMinimumYear

      int getMinimumYear()
      Gets the minimum year for the mobile spinner.
      Returns:
      The minimum year, or -1 if undefined.
    • getMaximumYear

      int getMaximumYear()
      Gets the maximum year for the mobile spinner.
      Returns:
      The minimum year, or -1 if undefined.
    • setYearRange

      boolean setYearRange(int min, int max)
      Sets the minimum and maximum year for the mobile spinner.
      Parameters:
      min - The minimum year, or -1 for no minimum, i.e. current year minus 20.
      max - The maximum year, or -1 for no maximum, i.e. current year plus 20.
      Returns:
      true for changed, false for no change.
      Throws:
      IllegalArgumentException - If the min is larger than max or if either min or max is not in the range of 0-10000.
    • isZoneUsed

      boolean isZoneUsed()
      Returns whether the zone should be used for a ZonedTimeDate type.
      Returns:
      true to use the zone or false (default) not to use the zone.
    • setUseZone

      boolean setUseZone(boolean on)
      Sets whether the zone should be used for a ZonedTimeDate type.
      Parameters:
      on - The flag.
      Returns:
      true for changes, false for no change.
    • isCalendarUsed

      boolean isCalendarUsed()
      Returns whether a calendar should be used for date input (mobile only).
      Returns:
      true to use the calendar or false (default) to use spinners.
    • setUseCalendar

      boolean setUseCalendar(boolean on)
      Sets whether a calendar should be used for date input (mobile only).
      Parameters:
      on - The flag.
      Returns:
      true for changes, false for no change.
    • hasCalendarButton

      boolean hasCalendarButton()
      Returns whether a button to show calendar should be present for date input (mobile only).
      Returns:
      true to use the calendar or false (default) to use spinners.
    • setUseCalendarButton

      boolean setUseCalendarButton(boolean on)
      Sets whether a calendar button should be shown for date input (mobile only).
      Parameters:
      on - The flag.
      Returns:
      true for changes, false for no change.
    • isMillisecondsUsed

      boolean isMillisecondsUsed()
      Returns whether the time value should use milliseconds in time formats using seconds.
      Returns:
      true to use the zone or false (default) not to use the zone.
    • setUseMilliseconds

      boolean setUseMilliseconds(boolean on)
      Sets whether the time value should use milliseconds in time formats using seconds.
      Parameters:
      on - The flag.
      Returns:
      true for changes, false for no change.
    • isDayMonthCombined

      boolean isDayMonthCombined()
      Returns whether to combine day and month in a single spinner (mobile).
      Returns:
      The flag, default false.
    • setCombineDayMonth

      boolean setCombineDayMonth(boolean on)
      Sets whether to combine day and month in a single spinner (mobile).
      Parameters:
      on - The flag.
      Returns:
      true for changes, false for no change.