org.apache.wicket.extensions.ajax.markup.html.autocomplete
Class AutoCompleteSettings

java.lang.Object
  extended by org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings
All Implemented Interfaces:
java.io.Serializable, IClusterable

public final class AutoCompleteSettings
extends java.lang.Object
implements IClusterable

This class encapsulates various settings for AbstractAutoCompleteBehavior. See the documentation for the property accessors of this class for further information.

Default settings:

setting default value
preselect false
maxHeightInPx -1
showListOnEmptyInput false

Author:
Gerolf Seitz
See Also:
Serialized Form

Constructor Summary
AutoCompleteSettings()
           
 
Method Summary
 java.lang.String getCssClassName()
          Get CSS class name to add to the autocompleter markup container
 int getMaxHeightInPx()
          Gets the maximum height of the autocomplete list in pixels.
 boolean getPreselect()
          Indicates whether the first item in the list is automatically selected when the autocomplete list is shown.
 boolean getShowCompleteListOnFocusGain()
          Indicates whether the autocomplete list will be shown when the input field receives focus.
 boolean getShowListOnEmptyInput()
          Indicates whether the autocomplete list will be shown if the input is empty.
 boolean getShowListOnFocusGain()
          Indicates whether the autocomplete list will be shown when the input field receives focus.
 boolean isAdjustInputWidth()
          Tells if wicket should adjust the width of the autocompleter selection window to the width of the related input field.
 void setAdjustInputWidth(boolean adjustInputWidth)
          Adjust the width of the autocompleter selection window to the width of the related input field.
 void setCssClassName(java.lang.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.

 AutoCompleteSettings setMaxHeightInPx(int maxHeightInPx)
          Sets the maximum height in pixels of the autocomplete list.
 AutoCompleteSettings setPreselect(boolean preselect)
          Sets whether the first item in the autocomplete list should be selected when the autocomplete list is shown.
 void setShowCompleteListOnFocusGain(boolean showCompleteListOnFocusGain)
          Sets whether the list should be shown when the input field receives focus.
 AutoCompleteSettings setShowListOnEmptyInput(boolean showListOnEmptyInput)
          Sets whether the list should be shown when the input is empty.
 void setShowListOnFocusGain(boolean showListOnFocusGain)
          Sets whether the list should be shown when the input field receives focus.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

getMaxHeightInPx

public int getMaxHeightInPx()
Gets the maximum height of the autocomplete list in pixels. -1 indicates 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

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 java.lang.String getCssClassName()
Get CSS class name to add to the autocompleter markup container

Returns:
CSS class name, or null if not used

setCssClassName

public void setCssClassName(java.lang.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

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:
true if the autocompleter should have the same size as the input field, false for default browser behavior

setAdjustInputWidth

public void 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 - true if the autocompleter should have the same size as the input field, false for default browser behavior

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 void setShowCompleteListOnFocusGain(boolean showCompleteListOnFocusGain)
Sets whether the list should be shown when the input field receives focus.

Parameters:
showListOnEmptyInput - the flag

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 void setShowListOnFocusGain(boolean showListOnFocusGain)
Sets whether the list should be shown when the input field receives focus.

Parameters:
showListOnEmptyInput - the flag


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.