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>

public class DateTimeFormElementConfiguration extends HashMap<String,Object>
Configuration class for a DateTimeFormElement based on Tempus Dominus datepicker.
Author:
Arne Vandamme
See Also:
  • Field Details

  • Constructor Details

    • DateTimeFormElementConfiguration

      public DateTimeFormElementConfiguration()
    • DateTimeFormElementConfiguration

      public DateTimeFormElementConfiguration(DateTimeFormElementConfiguration.Format format)
    • DateTimeFormElementConfiguration

      public DateTimeFormElementConfiguration(ZoneId zoneId)
    • DateTimeFormElementConfiguration

      public DateTimeFormElementConfiguration(DateTimeFormElementConfiguration.Format format, ZoneId zoneId)
    • DateTimeFormElementConfiguration

      public DateTimeFormElementConfiguration(DateTimeFormElementConfiguration existing)
      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

      public void setFormat(@NonNull @NonNull DateTimeFormElementConfiguration.Format format)
      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

      public ZoneId getZoneId()
      Get the id of the zone this configuration primarily uses to convert between date types.
      Returns:
      ZoneId instance
    • setZoneId

      public void setZoneId(ZoneId zoneId)
      This will ensure that conversion between Date and LocalDateTime, LocalDate, LocalTime use the same time zone.
      Parameters:
      zoneId - to use.
    • setPattern

      public void setPattern(String pattern)
      Set the primary input/output pattern in moment js format. Only use this method if you manually want to change the patterns, usually setFormat(Format) would suffice.
      Parameters:
      pattern - in moment js format
    • setExtraPatterns

      public void setExtraPatterns(String... patterns)
      Set extra input patterns that should be supported (in moment js format). Only use this method if you manually want to change the patterns, usually setFormat(Format) would suffice. Note that you should always add the setExportPattern(String) to the list of extra patterns as well.
      Parameters:
      patterns - in moment js format
    • setExportPattern

      public void setExportPattern(String pattern)
      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, usually setFormat(Format) would suffice.
      Parameters:
      pattern - in moment js format
    • setLocale

      public void setLocale(Locale locale)
    • 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

      public void setMinDate(Date date)
      Prevents date/time selections before this date
    • setMinDate

      public void setMinDate(LocalDate date)
      Prevents date/time selections before this date
    • setMinDate

      public void setMinDate(LocalTime date)
      Prevents date/time selections before this date
    • setMinDate

      public void setMinDate(LocalDateTime date)
      Prevents date/time selections before this date
    • setMaxDate

      public void setMaxDate(Date date)
      Prevents date/time selections after this date
    • setMaxDate

      public void setMaxDate(LocalDate date)
      Prevents date/time selections after this date
    • setMaxDate

      public void setMaxDate(LocalTime date)
      Prevents date/time selections after this date
    • setMaxDate

      public void setMaxDate(LocalDateTime date)
      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

      public void setDefaultDate(Date date)
      Sets the picker default date/time. Overrides useCurrent
    • setDefaultDate

      public void setDefaultDate(LocalDate date)
      Sets the picker default date/time. Overrides useCurrent
    • setDefaultDate

      public void setDefaultDate(LocalTime date)
      Sets the picker default date/time. Overrides useCurrent
    • setDefaultDate

      public void setDefaultDate(LocalDateTime date)
      Sets the picker default date/time. Overrides useCurrent
    • setViewDate

      public void setViewDate(Date date)
      This will change the viewDate without changing or setting the selected date.
    • setViewDate

      public void setViewDate(LocalDate date)
      This will change the viewDate without changing or setting the selected date.
    • setViewDate

      public void setViewDate(LocalTime date)
      This will change the viewDate without changing or setting the selected date.
    • setViewDate

      public void setViewDate(LocalDateTime date)
      This will change the viewDate without changing or setting the selected date.
    • setDisabledDates

      public void setDisabledDates(Date... dates)
      Disables selection of dates in the array, e.g. holidays. Matched with day granularity.
    • setDisabledDates

      public void setDisabledDates(LocalDate... dates)
      Disables selection of dates in the array, e.g. holidays Matched with day granularity.
    • setDisabledDates

      public void setDisabledDates(LocalDateTime... dates)
      Disables selection of dates in the array, e.g. holidays Matched with day granularity.
    • setEnabledDates

      public void setEnabledDates(Date... dates)
      Disables selection of dates NOT in the array, e.g. holidays Matched with day granularity.
    • setEnabledDates

      public void setEnabledDates(LocalDate... dates)
      Disables selection of dates NOT in the array, e.g. holidays Matched with day granularity.
    • setEnabledDates

      public void setEnabledDates(LocalDateTime... dates)
      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

      public void setDateAttribute(String attributeName, Date... dates)
      Set any date attribute on the configuration. Dates will be converted to the generic export format.
    • setDateAttribute

      public void setDateAttribute(String attributeName, boolean keepConfigurationAsArray, Date... dates)
      Set any date attribute on the configuration. Dates will be converted to the generic export format.
    • dateToLocalDateTime

      public LocalDateTime dateToLocalDateTime(Date date)
      Converts a Date to a LocalDateTime using the configured ZoneId
    • localDateTimeToDate

      public Date localDateTimeToDate(LocalDateTime date)
      Converts a LocalDateTime to a Date using the configured ZoneId
    • setDateAttribute

      public void setDateAttribute(String attributeName, LocalDate... dates)
      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

      public static LocalDateTime localDateToLocalDateTime(LocalDate date)
      Converts a LocalDate to a LocalDateTime with time equal to the start of the day.
    • setDateAttribute

      public void setDateAttribute(String attributeName, LocalTime... dates)
      Set any date attribute on the configuration. Dates will be converted to the generic export format.
    • localTimeToLocalDateTime

      public static LocalDateTime localTimeToLocalDateTime(LocalTime time)
      Converts a LocalTime to a LocalDateTime with the day equal to today.
    • setDateAttribute

      public void setDateAttribute(String attributeName, LocalDateTime... dates)
      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 to true if calls to localize(Locale) will create a version of the current configuration adapted to the locale specified. If false localize calls will create an exact duplicate of the configuration, no matter the output locale. Default value is true.
      Parameters:
      localizePatterns - true if output locale should be taken into account
    • localize

      public DateTimeFormElementConfiguration localize(Locale locale)
      Create a localized copy of the current configuration.
      Parameters:
      locale - for which to create a localized instance
      Returns:
      clone
    • createDateFormat

      public DateFormat createDateFormat()
      Returns:
      A DateFormat representing the current configuration.
    • createDateTimeFormatter

      public DateTimeFormatter createDateTimeFormatter()
      Returns:
      A DateTimeFormatter representing the current configuration.