Interface IUIDateTime
- All Known Implementing Classes:
EUIDateTime,MLDateTime,UIDateTime
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptionReturns the date-time datatype for this component.default GDateTimeGets the default value of the component as a GDateTime.default GDateTimegetDefaultValue(LocaleInfo localeInfo) Gets the default value of the component as a GDateTime.intGets the format used.Returns the GDateTime datatype for this component.default LocalDateGets the local date part of the value.default LocalTimeGets the local time part of the value.intGets the maximum year for the mobile spinner.intGets the minimum year for the mobile spinner.Returns the date-time type for this component.getValue()Gets the current date-time value.default ZoneIdGets the zone of the value.booleanReturns whether a button to show calendar should be present for date input (mobile only).booleanReturns whether a calendar should be used for date input (mobile only).booleanReturns if the enforcement of the datatype is set.default booleanReturns if the implementation requires a date in the value component.default booleanReturns if the implementation supports date.booleanReturns whether to combine day and month in a single spinner (mobile).booleanReturns whether the time value should use milliseconds in time formats using seconds.booleanReturns if a null value is allowed, i.e.default booleanReturns if the implementation requires a time in the value component.default booleanReturns if the implementation supports time.booleanReturns whether the zone should be used for a ZonedTimeDate type.booleansetCombineDayMonth(boolean on) Sets whether to combine day and month in a single spinner (mobile).default booleanSets 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 booleansetDate(LocalDate localDate, LocaleInfo localeInfo) Sets the value as a local date.booleansetFormat(int format) Sets the format.booleansetNullAllowed(boolean isNullAllowed) Sets the null value allowed flag, i.e.default booleanSets 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 booleansetTime(LocalTime localTime, LocaleInfo localeInfo) Sets the value as a local time.booleansetType(UIDateTimeType type, UIDateTimeDataType dataType, boolean doEnforceDataType) Sets the date-time type, its datatype and the enforcement flag of the datatype.booleansetUseCalendar(boolean on) Sets whether a calendar should be used for date input (mobile only).booleansetUseCalendarButton(boolean on) Sets whether a calendar button should be shown for date input (mobile only).booleansetUseMilliseconds(boolean on) Sets whether the time value should use milliseconds in time formats using seconds.booleansetUseZone(boolean on) Sets whether the zone should be used for a ZonedTimeDate type.default booleanSets the date-time value with the locale information of the current user session (or system default) in case value conversion is required.booleansetValue(GDateTime value, LocaleInfo localeInfo) Sets the date-time value.booleanSets the value to null.booleansetYearRange(int min, int max) Sets the minimum and maximum year for the mobile spinner.default booleanSets 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
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
doEnforceDataTypeis 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
isNullAllowedto false when the value already isnullwill 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 flagisisNullAllowed()false.
setValue
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
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
nullif the value is null and the flagis set. The value may still be null if the "null-allowed" flag has been toggled recently programmatically toisNullAllowed()falsebut the value has not been assigned yet.
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 typeDate), the combination of the two above for typeDateTime, and the current Zone ID of the user's session (or system default) forZoneId.
getDefaultValue
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 typeDATEand the combination of the two above for typeDATE_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
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
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, useorsetValue(GDateTime).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 isUIDateTimeType.Date.NullPointerException- IflocalTimeis null or in case the CURRENT value is null and the datatype isUIDateTimeType.DateTime.
setTime
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, useorsetValue(GDateTime).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 isUIDateTimeType.DateorUIDateTimeType.ZoneId.NullPointerException- IflocalTimeis null or in case the CURRENT value is null and the datatype isUIDateTimeType.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
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
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, useorsetValue(GDateTime).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 isUIDateTimeType.Time.NullPointerException- IflocalDateis null or in case the CURRENT value is null and the datatype isUIDateTimeType.DateTime.
setDate
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, useorsetValue(GDateTime).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 isUIDateTimeType.TimeorUIDateTimeType.ZoneId.NullPointerException- IflocalDateis null or in case the CURRENT value is null and the datatype isUIDateTimeType.DateTime.
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
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 isUIDateTimeType.ZoneId.NullPointerException- Ifzoneis null or in case the CURRENT value is null and the datatype isUIDateTimeType.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.