Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts2.components
Class Autocompleter

    java.lang.Object
      org.apache.struts2.components.Component
          org.apache.struts2.components.UIBean
              org.apache.struts2.components.TextField
                  org.apache.struts2.components.ComboBox
                      org.apache.struts2.components.Autocompleter

    public class Autocompleter

extends ComboBox

The autocomplete tag is a combobox that can autocomplete text entered on the input box. When used on the "simple" theme, the autocompleter can be used like the ComboBox. When used on the "ajax" theme, the list can be retieved from an action. This action must return a JSON list in the format:

     [
       ["Text 1","Value1"],
       ["Text 2","Value2"],
       ["Text 3","Value3"]
     ]

THE FOLLOWING IS ONLY VALID WHEN AJAX IS CONFIGURED

- href
- errorText
- listenTopics
- notifyTopics
- listenTopics
- formId
- formFilter
- indicator
- loadOnTextChange
- loadMinimumCount
- showDownArrow
- searchType

'dropdownWidth' width in pixels of the drodpdown, same as autocompleter's width by default

'dropdownHeight' height in pixels of the drodown, 120 px by default

'forceValidOption' if invalid option is selected, clear autocompleter's text when focus is lost

'autoComplete', if true, make suggestions on the textbox

'formId' is the id of the html form whose fields will be seralized and passed as parameters in the request.

'formFilter' is the name of a function which will be used to filter the fields that will be seralized. This function takes as a parameter the element and returns true if the element should be included.

'listenTopics' comma separated list of topics names, that will trigger a request 'indicator' element to be shown while the request executing 'showErrorTransportText': whether errors should be displayed (on 'targets')

'loadOnTextChange' options will be reloaded everytime a character is typed on the textbox

'loadMinimumCount' minimum number of characters that will force the content to be loaded

'showDownError' show or hide the down arrow button 'searchType' how the search must be performed, options are: "startstring", "startword" and "substring"

'keyName' name of the field to which the selected key will be assigned

'iconPath' path of icon used for the dropdown 'templateCssPath' path to css file used to customize Dojo's widget 'notifyTopics' comma separated list of topics names, that will be published. Three parameters are passed:

- data: selected value when type='valuechanged'
- type: 'before' before the request is made, 'valuechanged' when selection changes, 'load' when the request succeeds, or 'error' when it fails
- request: request javascript object, when type='load' or type='error'

Field Summary
`protected String` | `autoComplete`
`private static String` | `COMPONENT_NAME`
`protected String` | `delay`
`protected String` | `disabled`
`protected String` | `dropdownHeight`
`protected String` | `dropdownWidth`
`protected String` | `forceValidOption`
`protected String` | `formFilter`
`protected String` | `formId`
`protected String` | `href`
`protected String` | `iconPath`
`protected String` | `indicator`
`protected String` | `keyName`
`protected String` | `listenTopics`
`protected String` | `loadMinimumCount`
`protected String` | `loadOnTextChange`
`protected String` | `notifyTopics`
`protected String` | `searchType`
`protected String` | `showDownArrow`
`static String` | `TEMPLATE`
`protected String` | `templateCssPath`

Fields inherited from class org.apache.struts2.components.ComboBox
`emptyOption, headerKey, headerValue, list, listKey, listValue`

Fields inherited from class org.apache.struts2.components.TextField
`maxlength, readonly, size`

Fields inherited from class org.apache.struts2.components.UIBean
`accesskey, cssClass, cssStyle, defaultTemplateDir, defaultUITheme, key, label, labelPosition, name, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, request, required, requiredposition, response, tabindex, template, templateDir, templateEngineManager, templateSuffix, theme, title, tooltip, tooltipConfig, value`

Fields inherited from class org.apache.struts2.components.Component
`actionMapper, COMPONENT_STACK, id, parameters, stack`

Constructor Summary
`Autocompleter(ValueStack stack, HttpServletRequest request, HttpServletResponse response)`

Method Summary
`void` | `evaluateExtraParams()`
`protected Object` | `findListValue()`
`String` | `getComponentName()`
`protected String` | `getDefaultTemplate()` A contract that requires each concrete UI Tag to specify which template should be used as a default.
`void` | `setAutoComplete(String autoComplete)`
`void` | `setDelay(String searchDelay)`
`void` | `setDisabled(String disabled)`
`void` | `setDropdownHeight(String height)`
`void` | `setDropdownWidth(String width)`
`void` | `setForceValidOption(String forceValidOption)`
`void` | `setFormFilter(String formFilter)`
`void` | `setFormId(String formId)`
`void` | `setHref(String href)`
`void` | `setIconPath(String iconPath)`
`void` | `setIndicator(String indicator)`
`void` | `setKeyName(String keyName)`
`void` | `setList(String list)`
`void` | `setListenTopics(String listenTopics)`
`void` | `setLoadMinimumCount(String loadMinimumCount)`
`void` | `setLoadOnTextChange(String loadOnType)`
`void` | `setNotifyTopics(String onValueChangedPublishTopic)`
`void` | `setSearchType(String searchType)`
`void` | `setShowDownArrow(String showDownArrow)`
`void` | `setTemplateCssPath(String templateCssPath)`

Methods inherited from class org.apache.struts2.components.ComboBox
`setEmptyOption, setHeaderKey, setHeaderValue, setListKey, setListValue`

Methods inherited from class org.apache.struts2.components.TextField
`setMaxlength, setMaxLength, setReadonly, setSize`

Methods inherited from class org.apache.struts2.components.UIBean
`addFormParameter, buildTemplateName, enableAncestorFormCustomOnsubmit, end, escape, evaluateNameValue, evaluateParams, getTemplate, getTemplateDir, getTheme, getTooltipConfig, getValueClassType, mergeTemplate, populateComponentHtmlId, setAccesskey, setCssClass, setCssStyle, setDefaultTemplateDir, setDefaultUITheme, setKey, setLabel, setLabelposition, setName, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setRequired, setRequiredposition, setTabindex, setTemplate, setTemplateDir, setTemplateEngineManager, setTheme, setTitle, setTooltip, setTooltipConfig, setValue`

Methods inherited from class org.apache.struts2.components.Component
`addAllParameters, addParameter, altSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findValue, findValue, findValue, getComponentStack, getId, getParameters, getStack, popComponentStack, setActionMapper, setId, start, toString, usesBody`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TEMPLATE

    public static final String TEMPLATE

See Also:
  Constant Field Values

### COMPONENT_NAME

    private static final String COMPONENT_NAME

### forceValidOption

    protected String forceValidOption

### searchType

    protected String searchType

### autoComplete

    protected String autoComplete

### delay

    protected String delay

### disabled

    protected String disabled

### href

    protected String href

### dropdownWidth

    protected String dropdownWidth

### dropdownHeight

    protected String dropdownHeight

### formId

    protected String formId

### formFilter

    protected String formFilter

### listenTopics

    protected String listenTopics

### notifyTopics

    protected String notifyTopics

### indicator

    protected String indicator

### loadOnTextChange

    protected String loadOnTextChange

### loadMinimumCount

    protected String loadMinimumCount

### showDownArrow

    protected String showDownArrow

### templateCssPath

    protected String templateCssPath

### iconPath

    protected String iconPath

### keyName

    protected String keyName

Constructor Detail

### Autocompleter

    public Autocompleter(ValueStack stack,
                         HttpServletRequest request,
                         HttpServletResponse response)

Method Detail

### getDefaultTemplate

    protected String getDefaultTemplate()

  Description copied from class: `UIBean`
  A contract that requires each concrete UI Tag to specify which template should be used as a default. For example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm". This value not begin with a '/' unless you intend to make the path absolute rather than relative to the current theme.

  Overrides:
    `getDefaultTemplate` in class `ComboBox`
  Returns:
    The name of the template to be used as the default.

### getComponentName

    public String getComponentName()

### evaluateExtraParams

    public void evaluateExtraParams()

  Overrides:
    `evaluateExtraParams` in class `ComboBox`

### findListValue

    protected Object findListValue()

  Overrides:
    `findListValue` in class `ComboBox`

### setAutoComplete

    public void setAutoComplete(String autoComplete)

### setDisabled

    public void setDisabled(String disabled)

  Overrides:
    `setDisabled` in class `UIBean`

### setForceValidOption

    public void setForceValidOption(String forceValidOption)

### setHref

    public void setHref(String href)

### setDelay

    public void setDelay(String searchDelay)

### setSearchType

    public void setSearchType(String searchType)

### setDropdownHeight

    public void setDropdownHeight(String height)

### setDropdownWidth

    public void setDropdownWidth(String width)

### setFormFilter

    public void setFormFilter(String formFilter)

### setFormId

    public void setFormId(String formId)

### setListenTopics

    public void setListenTopics(String listenTopics)

### setNotifyTopics

    public void setNotifyTopics(String onValueChangedPublishTopic)

### setIndicator

    public void setIndicator(String indicator)

### setLoadMinimumCount

    public void setLoadMinimumCount(String loadMinimumCount)

### setLoadOnTextChange

    public void setLoadOnTextChange(String loadOnType)

### setShowDownArrow

    public void setShowDownArrow(String showDownArrow)

### setList

    public void setList(String list)

  Overrides:
    `setList` in class `ComboBox`

### setTemplateCssPath

    public void setTemplateCssPath(String templateCssPath)

### setIconPath

    public void setIconPath(String iconPath)

### setKeyName

    public void setKeyName(String keyName)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.