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>
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:
-
Nested Class Summary
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> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreates a default bootstrap-select configuration with live search enabled.localize
(@NonNull Locale locale, com.foreach.across.modules.web.support.LocalizedTextResolver localizedTextResolver) Create a localized copy of the current configuration.setActionsBox
(boolean actionsBox) When set to true, adds two buttons to the top of the dropdown menu (Select All & Deselect All).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
(String deselectAllText) The text on the button that deselects all options when actionsBox is enabled.setDropupAuto
(boolean dropupAuto) Checks to see which has more room, above or below.Adds a header to the top of the menu; includes a close button by default.setHideDisabled
(boolean hideDisabled) Removes disabled options and optgroups from the menu.setIconBase
(String iconBase) Set the base to use a different icon font instead of Glyphicons.setLiveSearch
(boolean liveSearch) When set to true, adds a search box to the top of the selectpicker dropdown.setLiveSearchNormalize
(boolean liveSearchNormalize) Setting liveSearchNormalize to true allows for accent-insensitive searching.setLiveSearchStyle
(SelectFormElementConfiguration.LiveSearchStyle liveSearchStyle) When set to 'contains', searching will reveal options that contain the searched text.setMaxOptions
(int maxOptions) When set to an integer and in a multi-select, the number of selected options cannot exceed the given value.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
(boolean mobile) When set to true, enables the device's native menu for select menus.setMultipleSeparator
(String separator) Set the character displayed in the button that separates selected options.setNoneSelectedText
(String noneSelectedText) The text that is displayed when a multiple select has no selected options.setSelectAllText
(String selectAllText) The text on the button that selects all options when actionsBox is enabled.setSelectedTextFormat
(String selectedTextFormat) Specifies how the selection is displayed with a multiple select.setSelectOnTab
(boolean selectOnTab) When set to true, treats the tab character like the enter or space characters within the selectpicker dropdown.setShowContent
(boolean showContent) When set to true, display custom HTML associated with selected option(s) in the button.setShowIcon
(boolean showIcon) When set to true, display icon(s) associated with selected option(s) in the button.setShowSubText
(boolean showSubText) When set to true, display subtext associated with a selected option in the button.setShowTick
(boolean showTick) Show checkmark on selected option (for items without multiple attribute).setSize
(int size) Set the items to show in the drop-down: 0: corresponds with 'auto' x: number of items to show -1: corresponds withfalse
When set to a string, add the value to the button's style.setTickIcon
(String tickIcon) Set which icon to use to display as the "tick" next to selected options.simple()
Create a new simple bootstrap-select configuration.Methods inherited from class java.util.TreeMap
ceilingEntry, ceilingKey, clear, clone, comparator, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, forEach, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, merge, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, putIfAbsent, remove, replace, replace, replaceAll, size, subMap, subMap, tailMap, tailMap, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
-
Constructor Details
-
SelectFormElementConfiguration
public SelectFormElementConfiguration()
-
-
Method Details
-
setActionsBox
When set to true, adds two buttons to the top of the dropdown menu (Select All & Deselect All). -
setDropupAuto
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
Adds a header to the top of the menu; includes a close button by default. -
setHideDisabled
Removes disabled options and optgroups from the menu. -
setIconBase
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
When set to true, adds a search box to the top of the selectpicker dropdown. -
setLiveSearchNormalize
Setting liveSearchNormalize to true allows for accent-insensitive searching. -
setLiveSearchStyle
public SelectFormElementConfiguration setLiveSearchStyle(SelectFormElementConfiguration.LiveSearchStyle liveSearchStyle) 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
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
The text that is displayed when maxOptions is enabled and the maximum number of options for the given scenario have been selected. -
setMobile
When set to true, enables the device's native menu for select menus. -
setMultipleSeparator
Set the character displayed in the button that separates selected options. -
setSelectedTextFormat
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
When set to true, treats the tab character like the enter or space characters within the selectpicker dropdown. -
setShowContent
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
When set to true, display icon(s) associated with selected option(s) in the button. -
setShowSubText
When set to true, display subtext associated with a selected option in the button. -
setShowTick
Show checkmark on selected option (for items without multiple attribute). -
setSize
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
When set to a string, add the value to the button's style. -
setTickIcon
Set which icon to use to display as the "tick" next to selected options. -
setCountSelectedText
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
The text on the button that deselects all options when actionsBox is enabled. -
setNoneSelectedText
The text that is displayed when a multiple select has no selected options. -
setSelectAllText
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 instancelocalizedTextResolver
- to use for localizing the text variables- Returns:
- clone
-
liveSearch
Creates a default bootstrap-select configuration with live search enabled.- Returns:
- configuration
-
simple
Create a new simple bootstrap-select configuration.- Returns:
- configuration
-