Class DateTimeFormElementConfiguration
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<String,Object>
com.foreach.across.modules.bootstrapui.elements.DateTimeFormElementConfiguration
- All Implemented Interfaces:
Serializable,Cloneable,Map<String,Object>
Configuration class for a
DateTimeFormElement based on
Tempus Dominus datepicker.- Author:
- Arne Vandamme
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumFormat will automatically set the patterns to be used.Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Localestatic final ZoneIdstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final DateTimeFormatterstatic final org.apache.commons.lang3.time.FastDateFormat -
Constructor Summary
ConstructorsConstructorDescriptionCreate a copy of an existing configuration. -
Method Summary
Modifier and TypeMethodDescriptiondateToLocalDateTime(Date date) Get the format that this configuration is primarily meant for.Get the id of the zone this configuration primarily uses to convert between date types.booleanstatic LocalDateTimeConverts aLocalDateto aLocalDateTimewith time equal to the start of the day.Create a localized copy of the current configuration.static LocalDateTimeConverts aLocalTimeto aLocalDateTimewith the day equal to today.voidsetDateAttribute(String attributeName, boolean keepConfigurationAsArray, LocalDate... dates) Set any date attribute on the configuration.voidsetDateAttribute(String attributeName, boolean keepConfigurationAsArray, LocalDateTime... dates) Set any date attribute on the configuration.voidsetDateAttribute(String attributeName, boolean keepConfigurationAsArray, Date... dates) Set any date attribute on the configuration.voidsetDateAttribute(String attributeName, LocalDate... dates) Set any date attribute on the configuration.voidsetDateAttribute(String attributeName, LocalDateTime... dates) Set any date attribute on the configuration.voidsetDateAttribute(String attributeName, LocalTime... dates) Set any date attribute on the configuration.voidsetDateAttribute(String attributeName, Date... dates) Set any date attribute on the configuration.voidsetDaysOfWeekDisabled(int... daysOfWeek) Disables the section of days of the week, e.g. weekends.voidsetDefaultDate(LocalDate date) Sets the picker default date/time.voidsetDefaultDate(LocalDateTime date) Sets the picker default date/time.voidsetDefaultDate(LocalTime date) Sets the picker default date/time.voidsetDefaultDate(Date date) Sets the picker default date/time.voidsetDisabledDates(LocalDate... dates) Disables selection of dates in the array, e.g. holidays Matched with day granularity.voidsetDisabledDates(LocalDateTime... dates) Disables selection of dates in the array, e.g. holidays Matched with day granularity.voidsetDisabledDates(Date... dates) Disables selection of dates in the array, e.g. holidays.voidsetEnabledDates(LocalDate... dates) Disables selection of dates NOT in the array, e.g. holidays Matched with day granularity.voidsetEnabledDates(LocalDateTime... dates) Disables selection of dates NOT in the array, e.g. holidays Matched with day granularity.voidsetEnabledDates(Date... dates) Disables selection of dates NOT in the array, e.g. holidays Matched with day granularity.voidsetExportPattern(String pattern) Set the serialization format that should be used.voidsetExtraPatterns(String... patterns) Set extra input patterns that should be supported (in moment js format).voidsetFormat(@NonNull DateTimeFormElementConfiguration.Format format) This will automatically set the different attributes and patterns to be used.voidsetKeepInvalid(boolean keepInvalid) Will cause the date picker to not revert or overwrite invalid dates.voidsetKeepOpen(boolean keepOpen) Will cause the date picker to stay open after selecting a date if no time components are being used.voidvoidsetLocalizePatterns(boolean localizePatterns) Set totrueif calls tolocalize(Locale)will create a version of the current configuration adapted to the locale specified.voidsetMaxDate(LocalDate date) Prevents date/time selections after this datevoidsetMaxDate(LocalDateTime date) Prevents date/time selections after this datevoidsetMaxDate(LocalTime date) Prevents date/time selections after this datevoidsetMaxDate(Date date) Prevents date/time selections after this datevoidsetMinDate(LocalDate date) Prevents date/time selections before this datevoidsetMinDate(LocalDateTime date) Prevents date/time selections before this datevoidsetMinDate(LocalTime date) Prevents date/time selections before this datevoidsetMinDate(Date date) Prevents date/time selections before this datevoidsetPattern(String pattern) Set the primary input/output pattern in moment js format.voidsetShowCalendarWeeks(boolean showCalendarWeeks) Shows the week of the year to the left of first day of the week.voidsetShowClearButton(boolean showClearButton) Show the "Clear" button in the icon toolbar.voidsetShowCloseButton(boolean showCloseButton) Show the "Close" button in the icon toolbar.voidsetShowInline(boolean showInline) Will display the picker inline without the need of a input field.voidsetShowTodayButton(boolean showTodayButton) Show the "Today" button in the icon toolbar.voidsetSideBySide(boolean sideBySide) Shows the picker side by side when using the time and date together.voidsetStepping(int minutes) Number of minutes the up/down arrow's will move the minutes value in the time pickervoidsetUseCurrentDate(boolean useCurrent) On show, will set the picker to the current date/timevoidsetViewDate(LocalDate date) This will change the viewDate without changing or setting the selected date.voidsetViewDate(LocalDateTime date) This will change the viewDate without changing or setting the selected date.voidsetViewDate(LocalTime date) This will change the viewDate without changing or setting the selected date.voidsetViewDate(Date date) This will change the viewDate without changing or setting the selected date.voidThis will ensure that conversion betweenDateandLocalDateTime,LocalDate,LocalTimeuse the same time zone.Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Field Details
-
FMT_EXPORT_JAVA
- See Also:
-
FMT_EXPORT_MOMENT_DATE
- See Also:
-
FMT_EXPORT_MOMENT_TIME
- See Also:
-
FMT_EXPORT_MOMENT_DATETIME
- See Also:
-
FMT_PATTERN_DATE
- See Also:
-
FMT_PATTERN_DATE_FULL
- See Also:
-
FMT_PATTERN_TIME
- See Also:
-
FMT_PATTERN_DATETIME
- See Also:
-
FMT_PATTERN_DATETIME_FULL
- See Also:
-
FMT_EXTRA_PATTERN_DATE
- See Also:
-
DEFAULT_LOCALE
-
DEFAULT_ZONE_ID
-
JAVA_FORMATTER
public static final org.apache.commons.lang3.time.FastDateFormat JAVA_FORMATTER -
JAVA_DATE_TIME_FORMATTER
-
-
Constructor Details
-
DateTimeFormElementConfiguration
public DateTimeFormElementConfiguration() -
DateTimeFormElementConfiguration
-
DateTimeFormElementConfiguration
-
DateTimeFormElementConfiguration
public DateTimeFormElementConfiguration(DateTimeFormElementConfiguration.Format format, ZoneId zoneId) -
DateTimeFormElementConfiguration
Create a copy of an existing configuration.- Parameters:
existing- configuration to copy
-
-
Method Details
-
getFormat
Get the format that this configuration is primarily meant for. This can be used for hints on icons to show etc.- Returns:
- format instance
-
setFormat
This will automatically set the different attributes and patterns to be used. If you want to use custom patterns, you should manually set the attributes *after* a call to format.- Parameters:
format- to use
-
getZoneId
Get the id of the zone this configuration primarily uses to convert between date types.- Returns:
- ZoneId instance
-
setZoneId
This will ensure that conversion betweenDateandLocalDateTime,LocalDate,LocalTimeuse the same time zone.- Parameters:
zoneId- to use.
-
setPattern
Set the primary input/output pattern in moment js format. Only use this method if you manually want to change the patterns, usuallysetFormat(Format)would suffice.- Parameters:
pattern- in moment js format
-
setExtraPatterns
Set extra input patterns that should be supported (in moment js format). Only use this method if you manually want to change the patterns, usuallysetFormat(Format)would suffice. Note that you should always add thesetExportPattern(String)to the list of extra patterns as well.- Parameters:
patterns- in moment js format
-
setExportPattern
Set the serialization format that should be used. The value posted back will be in this format. Only use this method if you manually want to change the patterns, usuallysetFormat(Format)would suffice.- Parameters:
pattern- in moment js format
-
setLocale
-
setStepping
public void setStepping(int minutes) Number of minutes the up/down arrow's will move the minutes value in the time picker- Parameters:
minutes- per step
-
setMinDate
Prevents date/time selections before this date -
setMinDate
Prevents date/time selections before this date -
setMinDate
Prevents date/time selections before this date -
setMinDate
Prevents date/time selections before this date -
setMaxDate
Prevents date/time selections after this date -
setMaxDate
Prevents date/time selections after this date -
setMaxDate
Prevents date/time selections after this date -
setMaxDate
Prevents date/time selections after this date -
setUseCurrentDate
public void setUseCurrentDate(boolean useCurrent) On show, will set the picker to the current date/time -
setDefaultDate
Sets the picker default date/time. Overrides useCurrent -
setDefaultDate
Sets the picker default date/time. Overrides useCurrent -
setDefaultDate
Sets the picker default date/time. Overrides useCurrent -
setDefaultDate
Sets the picker default date/time. Overrides useCurrent -
setViewDate
This will change the viewDate without changing or setting the selected date. -
setViewDate
This will change the viewDate without changing or setting the selected date. -
setViewDate
This will change the viewDate without changing or setting the selected date. -
setViewDate
This will change the viewDate without changing or setting the selected date. -
setDisabledDates
Disables selection of dates in the array, e.g. holidays. Matched with day granularity. -
setDisabledDates
Disables selection of dates in the array, e.g. holidays Matched with day granularity. -
setDisabledDates
Disables selection of dates in the array, e.g. holidays Matched with day granularity. -
setEnabledDates
Disables selection of dates NOT in the array, e.g. holidays Matched with day granularity. -
setEnabledDates
Disables selection of dates NOT in the array, e.g. holidays Matched with day granularity. -
setEnabledDates
Disables selection of dates NOT in the array, e.g. holidays Matched with day granularity. -
setSideBySide
public void setSideBySide(boolean sideBySide) Shows the picker side by side when using the time and date together. -
setDaysOfWeekDisabled
public void setDaysOfWeekDisabled(int... daysOfWeek) Disables the section of days of the week, e.g. weekends. -
setShowCalendarWeeks
public void setShowCalendarWeeks(boolean showCalendarWeeks) Shows the week of the year to the left of first day of the week. -
setShowTodayButton
public void setShowTodayButton(boolean showTodayButton) Show the "Today" button in the icon toolbar. Clicking the "Today" button will set the calendar view and set the date to now. -
setShowClearButton
public void setShowClearButton(boolean showClearButton) Show the "Clear" button in the icon toolbar. Clicking the "Clear" button will set the calendar to null. -
setShowCloseButton
public void setShowCloseButton(boolean showCloseButton) Show the "Close" button in the icon toolbar. -
setKeepOpen
public void setKeepOpen(boolean keepOpen) Will cause the date picker to stay open after selecting a date if no time components are being used. -
setShowInline
public void setShowInline(boolean showInline) Will display the picker inline without the need of a input field. -
setKeepInvalid
public void setKeepInvalid(boolean keepInvalid) Will cause the date picker to not revert or overwrite invalid dates. -
setDateAttribute
Set any date attribute on the configuration. Dates will be converted to the generic export format. -
setDateAttribute
Set any date attribute on the configuration. Dates will be converted to the generic export format. -
dateToLocalDateTime
-
localDateTimeToDate
-
setDateAttribute
Set any date attribute on the configuration. Dates will be converted to the generic export format. -
setDateAttribute
public void setDateAttribute(String attributeName, boolean keepConfigurationAsArray, LocalDate... dates) Set any date attribute on the configuration. Dates will be converted to the generic export format. -
localDateToLocalDateTime
Converts aLocalDateto aLocalDateTimewith time equal to the start of the day. -
setDateAttribute
Set any date attribute on the configuration. Dates will be converted to the generic export format. -
localTimeToLocalDateTime
Converts aLocalTimeto aLocalDateTimewith the day equal to today. -
setDateAttribute
Set any date attribute on the configuration. Dates will be converted to the generic export format. -
setDateAttribute
public void setDateAttribute(String attributeName, boolean keepConfigurationAsArray, LocalDateTime... dates) Set any date attribute on the configuration. Dates will be converted to the generic export format. -
isLocalizePatterns
public boolean isLocalizePatterns() -
setLocalizePatterns
public void setLocalizePatterns(boolean localizePatterns) Set totrueif calls tolocalize(Locale)will create a version of the current configuration adapted to the locale specified. Iffalselocalize calls will create an exact duplicate of the configuration, no matter the output locale. Default value istrue.- Parameters:
localizePatterns- true if output locale should be taken into account
-
localize
Create a localized copy of the current configuration.- Parameters:
locale- for which to create a localized instance- Returns:
- clone
-
createDateFormat
- Returns:
- A
DateFormatrepresenting the current configuration.
-
createDateTimeFormatter
- Returns:
- A
DateTimeFormatterrepresenting the current configuration.
-