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
Modifier and TypeClassDescriptionstatic enum
Format 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
Modifier and TypeFieldDescriptionstatic final Locale
static final ZoneId
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final DateTimeFormatter
static final org.apache.commons.lang3.time.FastDateFormat
-
Constructor Summary
ConstructorDescriptionCreate 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.boolean
static LocalDateTime
Converts aLocalDate
to aLocalDateTime
with time equal to the start of the day.Create a localized copy of the current configuration.static LocalDateTime
Converts aLocalTime
to aLocalDateTime
with the day equal to today.void
setDateAttribute
(String attributeName, boolean keepConfigurationAsArray, LocalDate... dates) Set any date attribute on the configuration.void
setDateAttribute
(String attributeName, boolean keepConfigurationAsArray, LocalDateTime... dates) Set any date attribute on the configuration.void
setDateAttribute
(String attributeName, boolean keepConfigurationAsArray, Date... dates) Set any date attribute on the configuration.void
setDateAttribute
(String attributeName, LocalDate... dates) Set any date attribute on the configuration.void
setDateAttribute
(String attributeName, LocalDateTime... dates) Set any date attribute on the configuration.void
setDateAttribute
(String attributeName, LocalTime... dates) Set any date attribute on the configuration.void
setDateAttribute
(String attributeName, Date... dates) Set any date attribute on the configuration.void
setDaysOfWeekDisabled
(int... daysOfWeek) Disables the section of days of the week, e.g. weekends.void
setDefaultDate
(LocalDate date) Sets the picker default date/time.void
setDefaultDate
(LocalDateTime date) Sets the picker default date/time.void
setDefaultDate
(LocalTime date) Sets the picker default date/time.void
setDefaultDate
(Date date) Sets the picker default date/time.void
setDisabledDates
(LocalDate... dates) Disables selection of dates in the array, e.g. holidays Matched with day granularity.void
setDisabledDates
(LocalDateTime... dates) Disables selection of dates in the array, e.g. holidays Matched with day granularity.void
setDisabledDates
(Date... dates) Disables selection of dates in the array, e.g. holidays.void
setEnabledDates
(LocalDate... dates) Disables selection of dates NOT in the array, e.g. holidays Matched with day granularity.void
setEnabledDates
(LocalDateTime... dates) Disables selection of dates NOT in the array, e.g. holidays Matched with day granularity.void
setEnabledDates
(Date... dates) Disables selection of dates NOT in the array, e.g. holidays Matched with day granularity.void
setExportPattern
(String pattern) Set the serialization format that should be used.void
setExtraPatterns
(String... patterns) Set extra input patterns that should be supported (in moment js format).void
setFormat
(@NonNull DateTimeFormElementConfiguration.Format format) This will automatically set the different attributes and patterns to be used.void
setKeepInvalid
(boolean keepInvalid) Will cause the date picker to not revert or overwrite invalid dates.void
setKeepOpen
(boolean keepOpen) Will cause the date picker to stay open after selecting a date if no time components are being used.void
void
setLocalizePatterns
(boolean localizePatterns) Set totrue
if calls tolocalize(Locale)
will create a version of the current configuration adapted to the locale specified.void
setMaxDate
(LocalDate date) Prevents date/time selections after this datevoid
setMaxDate
(LocalDateTime date) Prevents date/time selections after this datevoid
setMaxDate
(LocalTime date) Prevents date/time selections after this datevoid
setMaxDate
(Date date) Prevents date/time selections after this datevoid
setMinDate
(LocalDate date) Prevents date/time selections before this datevoid
setMinDate
(LocalDateTime date) Prevents date/time selections before this datevoid
setMinDate
(LocalTime date) Prevents date/time selections before this datevoid
setMinDate
(Date date) Prevents date/time selections before this datevoid
setPattern
(String pattern) Set the primary input/output pattern in moment js format.void
setShowCalendarWeeks
(boolean showCalendarWeeks) Shows the week of the year to the left of first day of the week.void
setShowClearButton
(boolean showClearButton) Show the "Clear" button in the icon toolbar.void
setShowCloseButton
(boolean showCloseButton) Show the "Close" button in the icon toolbar.void
setShowInline
(boolean showInline) Will display the picker inline without the need of a input field.void
setShowTodayButton
(boolean showTodayButton) Show the "Today" button in the icon toolbar.void
setSideBySide
(boolean sideBySide) Shows the picker side by side when using the time and date together.void
setStepping
(int minutes) Number of minutes the up/down arrow's will move the minutes value in the time pickervoid
setUseCurrentDate
(boolean useCurrent) On show, will set the picker to the current date/timevoid
setViewDate
(LocalDate date) This will change the viewDate without changing or setting the selected date.void
setViewDate
(LocalDateTime date) This will change the viewDate without changing or setting the selected date.void
setViewDate
(LocalTime date) This will change the viewDate without changing or setting the selected date.void
setViewDate
(Date date) This will change the viewDate without changing or setting the selected date.void
This will ensure that conversion betweenDate
andLocalDateTime
,LocalDate
,LocalTime
use 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, values
Methods 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 betweenDate
andLocalDateTime
,LocalDate
,LocalTime
use 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 aLocalDate
to aLocalDateTime
with 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 aLocalTime
to aLocalDateTime
with 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 totrue
if calls tolocalize(Locale)
will create a version of the current configuration adapted to the locale specified. Iffalse
localize 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
DateFormat
representing the current configuration.
-
createDateTimeFormatter
- Returns:
- A
DateTimeFormatter
representing the current configuration.
-