Class SelectFormElementConfiguration

java.lang.Object
java.util.AbstractMap<K,V>
java.util.TreeMap<String,Object>
com.foreach.across.modules.bootstrapui.elements.SelectFormElementConfiguration
All Implemented Interfaces:
Serializable, Cloneable, Map<String,Object>, NavigableMap<String,Object>, SortedMap<String,Object>

public class SelectFormElementConfiguration extends TreeMap<String,Object>
Configuration class for bootstrap-select. Instances of this class can be set on a SelectFormElement, in which case it will be converted to a bootstrap-select if the BootstrapUiFormElementsWebResources are registered.

See bootstrap-select Options for the different properties that this class exposes.

Since:
1.1.0
Author:
Arne Vandamme
See Also:
  • Constructor Details

    • SelectFormElementConfiguration

      public SelectFormElementConfiguration()
  • Method Details

    • setActionsBox

      public SelectFormElementConfiguration setActionsBox(boolean actionsBox)
      When set to true, adds two buttons to the top of the dropdown menu (Select All & Deselect All).
    • setDropupAuto

      public SelectFormElementConfiguration setDropupAuto(boolean dropupAuto)
      Checks to see which has more room, above or below. If the dropup has enough room to fully open normally, but there is more room above, the dropup still opens normally. Otherwise, it becomes a dropup. If dropupAuto is set to false, dropups must be called manually.
    • setHeader

      public SelectFormElementConfiguration setHeader(String header)
      Adds a header to the top of the menu; includes a close button by default.
    • setHideDisabled

      public SelectFormElementConfiguration setHideDisabled(boolean hideDisabled)
      Removes disabled options and optgroups from the menu.
    • setIconBase

      public SelectFormElementConfiguration setIconBase(String iconBase)
      Set the base to use a different icon font instead of Glyphicons. If changing iconBase, you might also want to change tickIcon, in case the new icon font uses a different naming scheme.
    • setLiveSearch

      public SelectFormElementConfiguration setLiveSearch(boolean liveSearch)
      When set to true, adds a search box to the top of the selectpicker dropdown.
    • setLiveSearchNormalize

      public SelectFormElementConfiguration setLiveSearchNormalize(boolean liveSearchNormalize)
      Setting liveSearchNormalize to true allows for accent-insensitive searching.
    • setLiveSearchStyle

      When set to 'contains', searching will reveal options that contain the searched text. For example, searching for pl with return both Apple, Plum, and Plantain. When set to 'startsWith', searching for pl will return only Plum and Plantain.
    • setMaxOptions

      public SelectFormElementConfiguration setMaxOptions(int maxOptions)
      When set to an integer and in a multi-select, the number of selected options cannot exceed the given value. If the value if 0 or negative, there is no maximum.
    • setMaxOptionsText

      public SelectFormElementConfiguration setMaxOptionsText(String maxOptionsText)
      The text that is displayed when maxOptions is enabled and the maximum number of options for the given scenario have been selected.
    • setMobile

      public SelectFormElementConfiguration setMobile(boolean mobile)
      When set to true, enables the device's native menu for select menus.
    • setMultipleSeparator

      public SelectFormElementConfiguration setMultipleSeparator(String separator)
      Set the character displayed in the button that separates selected options.
    • setSelectedTextFormat

      public SelectFormElementConfiguration setSelectedTextFormat(String selectedTextFormat)
      Specifies how the selection is displayed with a multiple select.

      • values displays a list of the selected options (separated by multipleSeparator).
      • static
      • simply displays the select element's title.
      • count displays the total number of selected options.
      • count > x behaves like values until the number of selected options is greater than x; after that, it behaves like count.
    • setSelectOnTab

      public SelectFormElementConfiguration setSelectOnTab(boolean selectOnTab)
      When set to true, treats the tab character like the enter or space characters within the selectpicker dropdown.
    • setShowContent

      public SelectFormElementConfiguration setShowContent(boolean showContent)
      When set to true, display custom HTML associated with selected option(s) in the button. When set to false, the option value will be displayed instead.
    • setShowIcon

      public SelectFormElementConfiguration setShowIcon(boolean showIcon)
      When set to true, display icon(s) associated with selected option(s) in the button.
    • setShowSubText

      public SelectFormElementConfiguration setShowSubText(boolean showSubText)
      When set to true, display subtext associated with a selected option in the button.
    • setShowTick

      public SelectFormElementConfiguration setShowTick(boolean showTick)
      Show checkmark on selected option (for items without multiple attribute).
    • setSize

      public SelectFormElementConfiguration setSize(int size)
      Set the items to show in the drop-down:
      • 0: corresponds with 'auto'
      • x: number of items to show
      • -1: corresponds with false
      Parameters:
      size - number
    • setStyle

      public SelectFormElementConfiguration setStyle(String style)
      When set to a string, add the value to the button's style.
    • setTickIcon

      public SelectFormElementConfiguration setTickIcon(String tickIcon)
      Set which icon to use to display as the "tick" next to selected options.
    • setCountSelectedText

      public SelectFormElementConfiguration setCountSelectedText(String countSelectedText)
      Sets the format for the text displayed when selectedTextFormat is count or count > #. {0} is the selected amount. {1} is total available for selection.
    • setDeselectAllText

      public SelectFormElementConfiguration setDeselectAllText(String deselectAllText)
      The text on the button that deselects all options when actionsBox is enabled.
    • setNoneSelectedText

      public SelectFormElementConfiguration setNoneSelectedText(String noneSelectedText)
      The text that is displayed when a multiple select has no selected options.
    • setSelectAllText

      public SelectFormElementConfiguration setSelectAllText(String selectAllText)
      The text on the button that selects all options when actionsBox is enabled.
    • localize

      public SelectFormElementConfiguration localize(@NonNull @NonNull Locale locale, com.foreach.across.modules.web.support.LocalizedTextResolver localizedTextResolver)
      Create a localized copy of the current configuration. Will add default messages for the text properties if there are none set.
      Parameters:
      locale - for which to create a localized instance
      localizedTextResolver - to use for localizing the text variables
      Returns:
      clone
    • liveSearch

      public static SelectFormElementConfiguration liveSearch()
      Creates a default bootstrap-select configuration with live search enabled.
      Returns:
      configuration
    • simple

      public static SelectFormElementConfiguration simple()
      Create a new simple bootstrap-select configuration.
      Returns:
      configuration