Class AutoCompleteSettings
- java.lang.Object
-
- org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings
-
- All Implemented Interfaces:
Serializable,org.apache.wicket.util.io.IClusterable
public final class AutoCompleteSettings extends Object implements org.apache.wicket.util.io.IClusterable
This class encapsulates various settings forAbstractAutoCompleteBehavior. See the documentation for the property accessors of this class for further information.Default settings:
Default settings setting default value preselect false maxHeightInPx -1 showListOnEmptyInput false - Author:
- Gerolf Seitz
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAutoCompleteSettings.KeyTabBehaviorA behavior that can be used to control how the Tab key should be handled when having an item in the autocomplete list is marked.
-
Constructor Summary
Constructors Constructor Description AutoCompleteSettings()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetCssClassName()Get CSS class name to add to the autocompleter markup containerbooleangetIgnoreBordersWhenPositioning()Indicates whether the popup positioning will take into account the borders of the input element and its ancestors.AutoCompleteSettings.KeyTabBehaviorgetKeyTabBehavior()Indicates how the Tab key should be handled when having an item in the autocomplete list selected,AutoCompleteSettings.KeyTabBehavior.SELECT_FOCUS_NEXT_ELEMENTis the default behavior.intgetMaxHeightInPx()Gets the maximum height of the autocomplete list in pixels.intgetMinInputLength()StringgetParameterName()booleangetPreselect()Indicates whether the first item in the list is automatically selected when the autocomplete list is shown.booleangetShowCompleteListOnFocusGain()Indicates whether the autocomplete list will be shown when the input field receives focus.booleangetShowListOnEmptyInput()Indicates whether the autocomplete list will be shown if the input is empty.booleangetShowListOnFocusGain()Indicates whether the autocomplete list will be shown when the input field receives focus.intgetThrottleDelay()get the throttle delay how long the browser will wait before sending a request to the browser after the user released a key.booleangetUseSmartPositioning()Indicates whether the popup positioning will take into account browser window visible area or not.booleanisAdjustInputWidth()Tells if wicket should adjust the width of the autocompleter selection window to the width of the related input field.AutoCompleteSettingssetAdjustInputWidth(boolean adjustInputWidth)Adjust the width of the autocompleter selection window to the width of the related input field.AutoCompleteSettingssetCssClassName(String cssClassName)Sets an CSS class name to add to the autocompleter markup containerAutoCompleteSettingssetIgnoreBordersWhenPositioning(boolean ignoreBordersWhenPositioning)Sets whether the popup positioning will take into account the borders of the input element and its ancestors (by including theclientLeftandclientTopDOM properties in the computation).AutoCompleteSettingssetKeyTabBehavior(AutoCompleteSettings.KeyTabBehavior keyTabBehavior)Set how the Tab key should be handled when having an item in the autocomplete list selected.AutoCompleteSettingssetMaxHeightInPx(int maxHeightInPx)Sets the maximum height in pixels of the autocomplete list.AutoCompleteSettingssetMinInputLength(int minInputLength)Set the minimum input length required to display the autocomplete listAutoCompleteSettingssetParameterName(String parameterName)Sets the name of the request parameter that will bring the value of the user inputAutoCompleteSettingssetPreselect(boolean preselect)Sets whether the first item in the autocomplete list should be selected when the autocomplete list is shown.AutoCompleteSettingssetShowCompleteListOnFocusGain(boolean showCompleteListOnFocusGain)Sets whether the list should be shown when the input field receives focus.AutoCompleteSettingssetShowListOnEmptyInput(boolean showListOnEmptyInput)Sets whether the list should be shown when the input is empty.AutoCompleteSettingssetShowListOnFocusGain(boolean showListOnFocusGain)Sets whether the list should be shown when the input field receives focus.AutoCompleteSettingssetThrottleDelay(int throttleDelay)set the throttle delay how long the browser will wait before sending a request to the browser after the user released a key.AutoCompleteSettingssetUseSmartPositioning(boolean useSmartPositioning)Sets whether the popup positioning will take into account browser window visible area or not.
-
-
-
Constructor Detail
-
AutoCompleteSettings
public AutoCompleteSettings()
-
-
Method Detail
-
getPreselect
public boolean getPreselect()
Indicates whether the first item in the list is automatically selected when the autocomplete list is shown.- Returns:
- true if the first item of the autocomplete list should be preselected, false (default) otherwise
-
setPreselect
public AutoCompleteSettings setPreselect(boolean preselect)
Sets whether the first item in the autocomplete list should be selected when the autocomplete list is shown.- Parameters:
preselect- the flag- Returns:
- this
AutoCompleteSettings
-
setThrottleDelay
public AutoCompleteSettings setThrottleDelay(int throttleDelay)
set the throttle delay how long the browser will wait before sending a request to the browser after the user released a key.- Parameters:
throttleDelay- The delay in milliseconds.- Returns:
- this
AutoCompleteSettings
-
getThrottleDelay
public int getThrottleDelay()
get the throttle delay how long the browser will wait before sending a request to the browser after the user released a key.- Returns:
- the throttle delay in milliseconds (default 300)
-
getMaxHeightInPx
public int getMaxHeightInPx()
Gets the maximum height of the autocomplete list in pixels.-1indicates that the autocomplete list should have no maximum height.- Returns:
- the maximum height in pixels
-
setMaxHeightInPx
public AutoCompleteSettings setMaxHeightInPx(int maxHeightInPx)
Sets the maximum height in pixels of the autocomplete list.The maximum height can also be specified via css (and by setting maxHeightInPx to -1):
div.wicket-aa-container { maxHeight: 100px; }Note that this does not work in IE6.- Parameters:
maxHeightInPx- the maximum height in pixels- Returns:
- this
AutoCompleteSettings
-
getIgnoreBordersWhenPositioning
public boolean getIgnoreBordersWhenPositioning()
Indicates whether the popup positioning will take into account the borders of the input element and its ancestors.- Returns:
- true if borders are ignored, false otherwise.
-
setIgnoreBordersWhenPositioning
public AutoCompleteSettings setIgnoreBordersWhenPositioning(boolean ignoreBordersWhenPositioning)
Sets whether the popup positioning will take into account the borders of the input element and its ancestors (by including theclientLeftandclientTopDOM properties in the computation).- Parameters:
ignoreBordersWhenPositioning- the flag- Returns:
- this
AutoCompleteSettings.
-
getUseSmartPositioning
public boolean getUseSmartPositioning()
Indicates whether the popup positioning will take into account browser window visible area or not. (so always show popup bottom-right or not)- Returns:
- true if popup smart positioning is used, false otherwise.
-
getShowListOnEmptyInput
public boolean getShowListOnEmptyInput()
Indicates whether the autocomplete list will be shown if the input is empty.- Returns:
- true if the autocomlete list will be shown if the input string is empty, false otherwise
-
setShowListOnEmptyInput
public AutoCompleteSettings setShowListOnEmptyInput(boolean showListOnEmptyInput)
Sets whether the list should be shown when the input is empty.- Parameters:
showListOnEmptyInput- the flag- Returns:
- this
AutoCompleteSettings
-
getCssClassName
public String getCssClassName()
Get CSS class name to add to the autocompleter markup container- Returns:
- CSS class name, or
nullif not used
-
setCssClassName
public AutoCompleteSettings setCssClassName(String cssClassName)
Sets an CSS class name to add to the autocompleter markup container This makes it easier to have multiple autocompleters in your application with different style and layout.- Parameters:
cssClassName- valid CSS class name- Returns:
- this
AutoCompleteSettings.
-
isAdjustInputWidth
public boolean isAdjustInputWidth()
Tells if wicket should adjust the width of the autocompleter selection window to the width of the related input field.- Returns:
trueif the autocompleter should have the same size as the input field,falsefor default browser behavior
-
setAdjustInputWidth
public AutoCompleteSettings setAdjustInputWidth(boolean adjustInputWidth)
Adjust the width of the autocompleter selection window to the width of the related input field. Otherwise the size will depend on the default browser behavior and CSS.- Parameters:
adjustInputWidth-trueif the autocompleter should have the same size as the input field,falsefor default browser behavior- Returns:
- this
AutoCompleteSettings.
-
getShowListOnFocusGain
public boolean getShowListOnFocusGain()
Indicates whether the autocomplete list will be shown when the input field receives focus.- Returns:
- true if the autocomplete list will be shown when the input field receives focus, false otherwise
-
setShowCompleteListOnFocusGain
public AutoCompleteSettings setShowCompleteListOnFocusGain(boolean showCompleteListOnFocusGain)
Sets whether the list should be shown when the input field receives focus.- Parameters:
showCompleteListOnFocusGain- the flag- Returns:
- this
AutoCompleteSettings.
-
getShowCompleteListOnFocusGain
public boolean getShowCompleteListOnFocusGain()
Indicates whether the autocomplete list will be shown when the input field receives focus.- Returns:
- true if the autocomplete list will be shown when the input field receives focus, false otherwise
-
setShowListOnFocusGain
public AutoCompleteSettings setShowListOnFocusGain(boolean showListOnFocusGain)
Sets whether the list should be shown when the input field receives focus.- Parameters:
showListOnFocusGain- the flag- Returns:
- this
AutoCompleteSettings.
-
setUseSmartPositioning
public AutoCompleteSettings setUseSmartPositioning(boolean useSmartPositioning)
Sets whether the popup positioning will take into account browser window visible area or not. (so always show popup bottom-right or not)- Parameters:
useSmartPositioning- the flag- Returns:
- this
AutoCompleteSettings.
-
setParameterName
public AutoCompleteSettings setParameterName(String parameterName)
Sets the name of the request parameter that will bring the value of the user input- Parameters:
parameterName- the name of the request parameter that will bring the value of the user input- Returns:
- this
AutoCompleteSettings
-
getParameterName
public String getParameterName()
- Returns:
- the name of the request parameter that will bring the value of the user input
-
getMinInputLength
public int getMinInputLength()
- Returns:
- the minimum input length required to display the autocomplete list
-
setMinInputLength
public AutoCompleteSettings setMinInputLength(int minInputLength)
Set the minimum input length required to display the autocomplete list- Parameters:
minInputLength- the minimum input length required to display the autocomplete list- Returns:
- this
AutoCompleteSettings
-
getKeyTabBehavior
public AutoCompleteSettings.KeyTabBehavior getKeyTabBehavior()
Indicates how the Tab key should be handled when having an item in the autocomplete list selected,AutoCompleteSettings.KeyTabBehavior.SELECT_FOCUS_NEXT_ELEMENTis the default behavior.- Returns:
- the behavior that should be used when the Tab key is pressed
-
setKeyTabBehavior
public AutoCompleteSettings setKeyTabBehavior(AutoCompleteSettings.KeyTabBehavior keyTabBehavior)
Set how the Tab key should be handled when having an item in the autocomplete list selected.- Parameters:
keyTabBehavior- the behavior that should be used when the Tab key is pressed,AutoCompleteSettings.KeyTabBehavior.SELECT_FOCUS_NEXT_ELEMENTis the default behavior- Returns:
- this
AutoCompleteSettings
-
-