Class MLDateTime

    • Field Detail

      • PN_DT_HINT

        public static final java.lang.String PN_DT_HINT
        Property name: entry field hint "hint".
        See Also:
        Constant Field Values
      • PN_DT_MAXIMUM_LENGTH

        public static final java.lang.String PN_DT_MAXIMUM_LENGTH
        Property name: maximum entry field input length "maxlen".
        See Also:
        Constant Field Values
      • PN_ARROW

        public static final java.lang.String PN_ARROW
        Property name: display trailing arrow "arrow".
        See Also:
        Constant Field Values
      • PN_DT_TYPE

        public static final java.lang.String PN_DT_TYPE
        Property name: dateTimeType.
        See Also:
        Constant Field Values
      • PN_DT_VALUE

        public static final java.lang.String PN_DT_VALUE
        Property name: date/time value.
        See Also:
        Constant Field Values
      • PN_DT_NULL

        public static final java.lang.String PN_DT_NULL
        Property name: nullable.
        See Also:
        Constant Field Values
      • PN_DT_FORMAT

        public static final java.lang.String PN_DT_FORMAT
        Property name: formatType.
        See Also:
        Constant Field Values
      • PN_DT_DAYMONTH

        public static final java.lang.String PN_DT_DAYMONTH
        Property name: dayMonth.
        See Also:
        Constant Field Values
      • PN_DT_CALENDAR

        public static final java.lang.String PN_DT_CALENDAR
        Property name: useCalendar.
        See Also:
        Constant Field Values
      • PN_DT_SELCAL

        public static final java.lang.String PN_DT_SELCAL
        Property name: selectCalendar.
        See Also:
        Constant Field Values
      • PN_DT_MS

        public static final java.lang.String PN_DT_MS
        Property name: useMilliseconds.
        See Also:
        Constant Field Values
      • PN_DT_ZONE

        public static final java.lang.String PN_DT_ZONE
        Property name: useZone.
        See Also:
        Constant Field Values
      • PN_DT_MAX

        public static final java.lang.String PN_DT_MAX
        Property name: maxYear.
        See Also:
        Constant Field Values
      • PN_DT_MIN

        public static final java.lang.String PN_DT_MIN
        Property name: minYear.
        See Also:
        Constant Field Values
      • PN_DT_CHAR_UPDATE

        public static final java.lang.String PN_DT_CHAR_UPDATE
        Property name: entry field character update "$charUpdate".
        See Also:
        Constant Field Values
      • PN_NULLABLE

        public static final java.lang.String PN_NULLABLE
        The property name: nullable.
        See Also:
        Constant Field Values
      • TABLE_COLUMN_NAME_OR_ATOMS

        public static java.lang.Object[] TABLE_COLUMN_NAME_OR_ATOMS
        The table column atoms or property names used.
      • TABLE_COLUMN_VALUE_TYPES

        public static Value.Type[] TABLE_COLUMN_VALUE_TYPES
        Best value types for the columns.
    • Constructor Detail

      • MLDateTime

        public MLDateTime​(java.lang.String text,
                          boolean isArrowDisplayed)
        Constructor for a simple item without trailing text that is to be added into a list.
        Parameters:
        text - The leading text, null for none.
        isArrowDisplayed - Flag for arrow display.
      • MLDateTime

        public MLDateTime​(KString text,
                          KString trailing,
                          boolean isArrowDisplayed)
        Constructor for a simple item that is to be added into a list.
        Parameters:
        text - The leading text, null for none.
        trailing - The trailing text, null for none.
        isArrowDisplayed - Flag for arrow display.
    • Method Detail

      • getType

        public MLItemType getType()
        Returns the type.
        Specified by:
        getType in class MLItem
        Returns:
        MLItemType.DATE_TIME.
      • getLeadingTextColumn

        protected int getLeadingTextColumn()
        Returns the column index for the leading text. Types supporting description text must override this method.
        Specified by:
        getLeadingTextColumn in class MLItem
        Returns:
        The column index, or -1 for none.
      • getDescriptionColumn

        protected int getDescriptionColumn()
        Returns the column index for the description. Types supporting description text must override this method.
        Specified by:
        getDescriptionColumn in class MLItem
        Returns:
        The column index = 2.
      • refreshFromVS

        public void refreshFromVS​(int[] columns)
        Refreshes contents from VirtualSpace.
        Specified by:
        refreshFromVS in interface IContentData<MLItemProp>
        Specified by:
        refreshFromVS in class MLItem
        Parameters:
        columns - The connected table columns indicies, -1 for none.
      • getUIDateTimeType

        public UIDateTimeType getUIDateTimeType()
        Returns the date-time datatype for this component.
        Specified by:
        getUIDateTimeType in interface IUIDateTime
        Returns:
        Enum value as Time, Date, DateTime or ZoneId.
      • getDataType

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

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

        public boolean isDataTypeEnforced()
        Returns if the enforcement of the datatype is set.
        Specified by:
        isDataTypeEnforced in interface IUIDateTime
        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

        public 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.

        Specified by:
        setType in interface IUIDateTime
        Parameters:
        type - The type.
        dataType - The datatype.
        doEnforceDataType - The enforcement flag: when true the datatype must match precisely, when false, data conversion is done internally to retrieve the datatype based on the current user's (or system) locale information.
        Returns:
        true if a change of type, datatype or enforcement occurred, false for no change.
        Throws:
        java.lang.IllegalArgumentException - If the type does not support the dataType.
      • getHint

        public KString getHint()
        Gets the entry field hint for the list item. It defines a hint to help users fill out the input field (also called place holder in HTML).
        Returns:
        The text as a PLAIN KString, or null if none is set.
      • setHint

        public boolean setHint​(java.lang.String text)
        Sets the entry field hint for the list item. It defines a hint to help users fill out the input field (also called place holder in HTML).
        Parameters:
        text - The new text, or null for none.
        Returns:
        true for changed, false for no change.
      • setHint

        public boolean setHint​(KString text)
        Sets the entry field hint for the list item. It defines a hint to help users fill out the input field (also called place holder in HTML).
        Parameters:
        text - The new text, or null for none.
        Returns:
        true for changed, false for no change.
        Throws:
        java.lang.IllegalArgumentException - If the KString is not in PLAIN text format.
      • getMaximumLength

        public int getMaximumLength()
        Gets the entry field text for the list item.
        Returns:
        The maximum character input length, zero for no limit.
      • setMaximumLength

        public boolean setMaximumLength​(int length)
        Sets the maximum length of the number of input characters in entry field.
        Parameters:
        length - The new length, or zero for no limit.
        Returns:
        true for changed, false for no change.
        Throws:
        java.lang.IllegalArgumentException - If length is negative.
      • getFormat

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

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

        public int getMinimumYear()
        Gets the minimum year for the mobile spinner.
        Specified by:
        getMinimumYear in interface IUIDateTime
        Returns:
        The minimum year, or -1 if undefined.
      • getMaximumYear

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

        public boolean setYearRange​(int min,
                                    int max)
        Sets the minimum and maximum year for the mobile spinner.
        Specified by:
        setYearRange in interface IUIDateTime
        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:
        java.lang.IllegalArgumentException - If the min is larger than max or if either min or max is not in the range of 0-10000.
      • isZoneUsed

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

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

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

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

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

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

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

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

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

        public boolean setCombineDayMonth​(boolean on)
        Sets whether to combine day and month in a single spinner (mobile).
        Specified by:
        setCombineDayMonth in interface IUIDateTime
        Parameters:
        on - The flag.
        Returns:
        true for changes, false for no change.
      • isNullAllowed

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

        public 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.

        Specified by:
        setNullAllowed in interface IUIDateTime
        Parameters:
        isNullAllowed - Flag for null allowed.
        Returns:
        true if the setting changed, false for no change.
      • setValueToNull

        public boolean setValueToNull()
        Sets the value to null.
        Specified by:
        setValueToNull in interface IUIDateTime
        Returns:
        true for value changed, false for no change.
        Throws:
        java.lang.IllegalStateException - If the flag isNullAllowed() is false.
      • getValue

        public GDateTime getValue()
        Gets the date/time for the list item.
        Specified by:
        getValue in interface IUIDateTime
        Returns:
        The date/time, or null if none is set.
      • setValue

        public boolean setValue​(GDateTime value,
                                LocaleInfo localeInfo)
        Sets the date-time value.
        Specified by:
        setValue in interface IUIDateTime
        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:
        java.lang.IllegalArgumentException - If the date/time type is enforced and not matching.
        java.lang.IllegalStateException - If the date/time conversion cannot possibly take place due to type mismatch.
        java.lang.NullPointerException - If the value is null and allow null is not enabled.
      • isArrowDisplayed

        public boolean isArrowDisplayed()
        Returns if the trailing arrow is displayed or not.
        Returns:
        true to display arrow, false not to display arrow.
      • setArrowDisplayed

        public boolean setArrowDisplayed​(boolean on)
        Sets if the trailing arrow should be displayed or not.
        Parameters:
        on - The display flag: true to display arrow, false not to display arrow.
        Returns:
        true for changed, false for no change.
      • addListener

        public boolean addListener​(IMLActionButtonListener listener)
        Adds an action button listener. Calling this method multiple times with the same listener will have no effect (but to return false).
        Parameters:
        listener - The listener to add.
        Returns:
        true if the listener was added, false otherwise.
        Throws:
        java.lang.NullPointerException - If the listener is null.
      • removeListener

        public boolean removeListener​(IMLActionButtonListener listener)
        Removes an action button listener.
        Parameters:
        listener - The listener to remove.
        Returns:
        true if listener is successfully removed, false otherwise.
      • onActionButtonInvoked

        public void onActionButtonInvoked​(MLItem item)
        Called when the action button is invoked by the user. By default, this method will invoke all potential action listeners. A subclass might override this method instead of adding a listener. This subclass should then call the super.onActionButtonInvoked(item) method in case listeners are added by others.
        Specified by:
        onActionButtonInvoked in interface IMLActionButtonListener
        Parameters:
        item - "this" item.
      • addListener

        public boolean addListener​(IMLArrowActionListener listener)
        Adds an action listener for the arrow. Calling this method multiple times with the same listener will have no effect (but to return false).
        Parameters:
        listener - The listener to add.
        Returns:
        true if the listener was added, false otherwise.
        Throws:
        java.lang.NullPointerException - If the listener is null.
      • removeListener

        public boolean removeListener​(IMLArrowActionListener listener)
        Removes an action listener for the arrow.
        Parameters:
        listener - The listener to remove.
        Returns:
        true if listener is successfully removed, false otherwise.
      • onArrowInvoked

        public void onArrowInvoked​(MLItem item)
        Called when the arrow action is invoked. By default, this method will invoke all potential arrow action listeners. A subclass might override this method instead of adding a listener. This subclass should then call the super.onArrowInvoked(item) method in case listeners are added by others.
        Specified by:
        onArrowInvoked in interface IMLArrowActionListener
        Parameters:
        item - "this" item.