Package com.iizix.prop.ui.mlist
Class MLDateTime
java.lang.Object
com.iizix.prop.ui.mlist.MLItem
com.iizix.prop.ui.mlist.MLDateTime
- All Implemented Interfaces:
- IContentData<MLItemProp>,- ICustomDataProvider,- IUIDateTime,- IMLActionButtonListener,- IMLArrowActionListener
public class MLDateTime extends MLItem implements IUIDateTime, IMLArrowActionListener, IMLActionButtonListener
Date/time input in form of a pop-up to input a date and/or time in various forms.
The date/time input can be preceded with a leading text with an optional fixed width, and the text entry will take up the remaining space in the list item.
An action button can be added to the trailing side.
An optional description text can be added to the bottom of the list item.
- Author:
- Mikael Andersson, Christopher Mindus
- Field SummaryFieldsModifier and TypeFieldDescription- static final StringProperty name: display trailing arrow "arrow".- static final StringProperty name: useCalendar.- static final StringProperty name: entry field character update "$charUpdate".- static final StringProperty name: dayMonth.- static final StringProperty name: formatType.- static final StringProperty name: entry field hint "hint".- static final StringProperty name: maxYear.- static final StringProperty name: maximum entry field input length "maxlen".- static final StringProperty name: minYear.- static final StringProperty name: useMilliseconds.- static final StringProperty name: nullable.- static final StringProperty name: selectCalendar.- static final StringProperty name: dateTimeType.- static final StringProperty name: date/time value.- static final StringProperty name: useZone.- static final StringThe property name: nullable.- static Object[]The table column atoms or property names used.- static Value.Type[]Best value types for the columns.- Fields inherited from class com.iizix.prop.ui.mlist.MLItem- FIRST_COLUMN_INDEX, PN_ACTION, PN_ANIMATION, PN_DESCRIPTION, PN_ICON, PN_ICON_MARGINS, PN_LEADING_TEXT, PN_LEADING_WIDTH, PN_LEADING_WRAP, PN_V_DESCRIPTION, PN_V_LEADING_TEXT, PN_VS_FOCUS
- Constructor SummaryConstructorsConstructorDescription- MLDateTime- (KString text, KString trailing, boolean isArrowDisplayed) Constructor for a simple item that is to be added into a list.- MLDateTime- (String text, boolean isArrowDisplayed) Constructor for a simple item without trailing text that is to be added into a list.
- Method SummaryModifier and TypeMethodDescription- boolean- addListener- (IMLActionButtonListener listener) Adds an action button listener.- boolean- addListener- (IMLArrowActionListener listener) Adds an action listener for the arrow.Returns the date-time datatype for this component.- protected intReturns the column index for the description.- intGets the format used.Returns the GDateTime datatype for this component.- getHint()Gets the entry field hint for the list item.- protected intReturns the column index for the leading text.- intGets the entry field text for the list item.- intGets the maximum year for the mobile spinner.- intGets the minimum year for the mobile spinner.- getType()Returns the type.Returns the date-time datatype for this component.- getValue()Gets the date/time for the list item.- booleanReturns whether a button to show calendar should be present for date input (mobile only).- void- initialize- (MLItemProp item) Initializes the item property from the content data.- booleanReturns if the trailing arrow is displayed or not.- booleanReturns whether a calendar should be used for date input (mobile only).- booleanReturns if the enforcement of the datatype is set.- 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.- booleanReturns whether the zone should be used for a ZonedTimeDate type.- void- onActionButtonInvoked- (MLItem item) Called when the action button is invoked by the user.- void- onArrowInvoked- (MLItem item) Called when the arrow action is invoked.- void- refreshFromVS- (int[] columns) Refreshes contents from VirtualSpace.- boolean- removeListener- (IMLActionButtonListener listener) Removes an action button listener.- boolean- removeListener- (IMLArrowActionListener listener) Removes an action listener for the arrow.- boolean- setArrowDisplayed- (boolean on) Sets if the trailing arrow should be displayed or not.- boolean- setCombineDayMonth- (boolean on) Sets whether to combine day and month in a single spinner (mobile).- boolean- setFormat- (int format) Sets the format.- booleanSets the entry field hint for the list item.- booleanSets the entry field hint for the list item.- boolean- setMaximumLength- (int length) Sets the maximum length of the number of input characters in entry field.- boolean- setNullAllowed- (boolean isNullAllowed) Sets the null value allowed flag, i.e.- 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- setUseCalendarButton- (boolean on) 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.- boolean- setValue- (GDateTime value, LocaleInfo localeInfo) Sets the date-time value.- booleanSets the value to null.- boolean- setYearRange- (int min, int max) Sets the minimum and maximum year for the mobile spinner.- Methods inherited from class com.iizix.prop.ui.mlist.MLItem- addMappings, doBooleanSelectionOnly, forbiddenGetCustomDataMap, getContextMenu, getGroup, getIcon, getIconMargins, getItemProp, getLeadingText, getLeadingTextWrap, getLeadingWidth, getSelectionPropName, getSelectionState, getVSRow, hasActionSupport, isEnabled, isReadOnly, isSelected, isVisible, setActionSupport, setContextMenu, setDescription, setEnabled, setIcon, setIconMargins, setIconPadding, setLeadingText, setLeadingTextEllipsis, setLeadingTextSingleLine, setLeadingTextWrap, setLeadingTextWrap, setLeadingWidth, setReadOnly, setSelected, setSelection, setSelectionInternal, setVisible- Methods inherited from class java.lang.Object- clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait- Methods inherited from interface com.iizix.prop.ICustomDataProvider- getCustomData, putCustomData, putCustomDataIfAbsent- Methods inherited from interface com.iizix.prop.ui.datetime.IUIDateTime- getDefaultValue, getDefaultValue, getLocalDate, getLocalTime, getZoneId, isDateValueRequired, isDateValueSupported, isTimeValueRequired, isTimeValueSupported, setDate, setDate, setTime, setTime, setValue, setZoneId
- Field Details- PN_DT_HINTProperty name: entry field hint "hint".- See Also:
 
- PN_DT_MAXIMUM_LENGTHProperty name: maximum entry field input length "maxlen".- See Also:
 
- PN_ARROWProperty name: display trailing arrow "arrow".- See Also:
 
- PN_DT_TYPEProperty name: dateTimeType.- See Also:
 
- PN_DT_VALUEProperty name: date/time value.- See Also:
 
- PN_DT_NULLProperty name: nullable.- See Also:
 
- PN_DT_FORMATProperty name: formatType.- See Also:
 
- PN_DT_DAYMONTHProperty name: dayMonth.- See Also:
 
- PN_DT_CALENDARProperty name: useCalendar.- See Also:
 
- PN_DT_SELCALProperty name: selectCalendar.- See Also:
 
- PN_DT_MSProperty name: useMilliseconds.- See Also:
 
- PN_DT_ZONEProperty name: useZone.- See Also:
 
- PN_DT_MAXProperty name: maxYear.- See Also:
 
- PN_DT_MINProperty name: minYear.- See Also:
 
- PN_DT_CHAR_UPDATEProperty name: entry field character update "$charUpdate".- See Also:
 
- PN_NULLABLEThe property name: nullable.- See Also:
 
- TABLE_COLUMN_NAME_OR_ATOMSThe table column atoms or property names used.
- TABLE_COLUMN_VALUE_TYPESBest value types for the columns.
 
- Constructor Details- MLDateTimeConstructor 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.
 
- MLDateTimeConstructor 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 Details- getTypeReturns the type.
- getLeadingTextColumnprotected int getLeadingTextColumn()Returns the column index for the leading text. Types supporting description text must override this method.- Specified by:
- getLeadingTextColumnin class- MLItem
- Returns:
- The column index, or -1 for none.
 
- getDescriptionColumnprotected int getDescriptionColumn()Returns the column index for the description. Types supporting description text must override this method.- Specified by:
- getDescriptionColumnin class- MLItem
- Returns:
- The column index = 2.
 
- refreshFromVSpublic void refreshFromVS- (int[] columns) Refreshes contents from VirtualSpace.- Specified by:
- refreshFromVSin interface- IContentData<MLItemProp>
- Specified by:
- refreshFromVSin class- MLItem
- Parameters:
- columns- The connected table columns indicies, -1 for none.
 
- initializeInitializes the item property from the content data. Each list item must implement this method to provider initialization of its own and call- initialize(MLItemProp)- Specified by:
- initializein interface- IContentData<MLItemProp>
- Parameters:
- item- The item.
 
- getUIDateTimeTypeReturns the date-time datatype for this component.- Specified by:
- getUIDateTimeTypein interface- IUIDateTime
- Returns:
- Enum value as Time, Date, DateTime or ZoneId.
 
- getDataTypeReturns the date-time datatype for this component.- Specified by:
- getDataTypein interface- IUIDateTime
- Returns:
- Enum value as Time, Date, DateTime or ZoneId.
 
- getGDateTimeTypeReturns the GDateTime datatype for this component.- Specified by:
- getGDateTimeTypein interface- IUIDateTime
- Returns:
- Enum value as LocalTime, OffsetTime, LocalDate, LocalDateTime, OffsetDateTime or ZonedDateTime.
 
- isDataTypeEnforcedpublic boolean isDataTypeEnforced()Returns if the enforcement of the datatype is set.- Specified by:
- isDataTypeEnforcedin 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.
 
- setTypeSets 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.- Specified by:
- setTypein 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:
- IllegalArgumentException- If the type does not support the dataType.
 
- getHintGets 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.
 
- setHintSets 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.
 
- setHintSets 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:
- IllegalArgumentException- If the KString is not in PLAIN text format.
 
- getMaximumLengthpublic int getMaximumLength()Gets the entry field text for the list item.- Returns:
- The maximum character input length, zero for no limit.
 
- setMaximumLengthpublic 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:
- IllegalArgumentException- If length is negative.
 
- getFormatpublic int getFormat()Gets the format used.- Specified by:
- getFormatin interface- IUIDateTime
- Returns:
- The format as 0=short, 1=normal, 2=long or 3=full (default).
 
- setFormatpublic boolean setFormat- (int format) Sets the format.- Specified by:
- setFormatin 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:
- IllegalArgumentException- If the format is not 0-3.
 
- getMinimumYearpublic int getMinimumYear()Gets the minimum year for the mobile spinner.- Specified by:
- getMinimumYearin interface- IUIDateTime
- Returns:
- The minimum year, or -1 if undefined.
 
- getMaximumYearpublic int getMaximumYear()Gets the maximum year for the mobile spinner.- Specified by:
- getMaximumYearin interface- IUIDateTime
- Returns:
- The minimum year, or -1 if undefined.
 
- setYearRangepublic boolean setYearRange- (int min, int max) Sets the minimum and maximum year for the mobile spinner.- Specified by:
- setYearRangein 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:
- IllegalArgumentException- If the min is larger than max or if either min or max is not in the range of 0-10000.
 
- isZoneUsedpublic boolean isZoneUsed()Returns whether the zone should be used for a ZonedTimeDate type.- Specified by:
- isZoneUsedin interface- IUIDateTime
- Returns:
- true to use the zone or false (default) not to use the zone.
 
- setUseZonepublic boolean setUseZone- (boolean on) Sets whether the zone should be used for a ZonedTimeDate type.- Specified by:
- setUseZonein interface- IUIDateTime
- Parameters:
- on- The flag.
- Returns:
- true for changes, false for no change.
 
- isCalendarUsedpublic boolean isCalendarUsed()Returns whether a calendar should be used for date input (mobile only).- Specified by:
- isCalendarUsedin interface- IUIDateTime
- Returns:
- true to use the calendar or false (default) to use spinners.
 
- setUseCalendarpublic boolean setUseCalendar- (boolean on) Sets whether a calendar should be used for date input (mobile only).- Specified by:
- setUseCalendarin interface- IUIDateTime
- Parameters:
- on- The flag.
- Returns:
- true for changes, false for no change.
 
- hasCalendarButtonpublic boolean hasCalendarButton()Returns whether a button to show calendar should be present for date input (mobile only).- Specified by:
- hasCalendarButtonin interface- IUIDateTime
- Returns:
- true to use the calendar or false (default) to use spinners.
 
- setUseCalendarButtonpublic boolean setUseCalendarButton- (boolean on) Sets whether a calendar button should be shown for date input (mobile only).- Specified by:
- setUseCalendarButtonin interface- IUIDateTime
- Parameters:
- on- The flag.
- Returns:
- true for changes, false for no change.
 
- isMillisecondsUsedpublic boolean isMillisecondsUsed()Returns whether the time value should use milliseconds in time formats using seconds.- Specified by:
- isMillisecondsUsedin interface- IUIDateTime
- Returns:
- true to use the zone or false (default) not to use the zone.
 
- setUseMillisecondspublic boolean setUseMilliseconds- (boolean on) Sets whether the time value should use milliseconds in time formats using seconds.- Specified by:
- setUseMillisecondsin interface- IUIDateTime
- Parameters:
- on- The flag.
- Returns:
- true for changes, false for no change.
 
- isDayMonthCombinedpublic boolean isDayMonthCombined()Returns whether to combine day and month in a single spinner (mobile).- Specified by:
- isDayMonthCombinedin interface- IUIDateTime
- Returns:
- The flag, default false.
 
- setCombineDayMonthpublic boolean setCombineDayMonth- (boolean on) Sets whether to combine day and month in a single spinner (mobile).- Specified by:
- setCombineDayMonthin interface- IUIDateTime
- Parameters:
- on- The flag.
- Returns:
- true for changes, false for no change.
 
- isNullAllowedpublic 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:
- isNullAllowedin interface- IUIDateTime
- Returns:
- true if null is allowed, or false (default) if not allowed.
 
- setNullAllowedpublic 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 is- nullwill not affect the value.- Specified by:
- setNullAllowedin interface- IUIDateTime
- Parameters:
- isNullAllowed- Flag for null allowed.
- Returns:
- true if the setting changed, false for no change.
 
- setValueToNullpublic boolean setValueToNull()Sets the value to null.- Specified by:
- setValueToNullin interface- IUIDateTime
- Returns:
- true for value changed, false for no change.
- Throws:
- IllegalStateException- If the flag- isNullAllowed()- false.
 
- getValueGets the date/time for the list item.- Specified by:
- getValuein interface- IUIDateTime
- Returns:
- The date/time, or null if none is set.
 
- setValueSets the date-time value.- Specified by:
- setValuein 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:
- 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.
 
- isArrowDisplayedpublic boolean isArrowDisplayed()Returns if the trailing arrow is displayed or not.- Returns:
- true to display arrow, false not to display arrow.
 
- setArrowDisplayedpublic 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.
 
- addListenerAdds 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:
- NullPointerException- If the listener is- null.
 
- removeListenerRemoves an action button listener.- Parameters:
- listener- The listener to remove.
- Returns:
- true if listener is successfully removed, false otherwise.
 
- onActionButtonInvokedCalled 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:
- onActionButtonInvokedin interface- IMLActionButtonListener
- Parameters:
- item- "this" item.
 
- addListenerAdds 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:
- NullPointerException- If the listener is- null.
 
- removeListenerRemoves an action listener for the arrow.- Parameters:
- listener- The listener to remove.
- Returns:
- true if listener is successfully removed, false otherwise.
 
- onArrowInvokedCalled 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:
- onArrowInvokedin interface- IMLArrowActionListener
- Parameters:
- item- "this" item.