org.richfaces.component

## Class AbstractAutocomplete

- java.lang.Object
- - javax.faces.component.UIComponent
  - - javax.faces.component.UIComponentBase
    - - javax.faces.component.UIOutput
      - - javax.faces.component.UIInput
        - - org.richfaces.component.AbstractAutocomplete

- All Implemented Interfaces:
    EventListener, javax.faces.component.EditableValueHolder, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, javax.faces.component.TransientStateHolder, javax.faces.component.ValueHolder, javax.faces.event.ComponentSystemEventListener, javax.faces.event.FacesListener, javax.faces.event.SystemEventListenerHolder, org.richfaces.component.MetaComponentEncoder, org.richfaces.component.MetaComponentResolver
  Direct Known Subclasses:
    UIAutocomplete

      public abstract class AbstractAutocomplete
      extends javax.faces.component.UIInput
      implements org.richfaces.component.MetaComponentResolver, org.richfaces.component.MetaComponentEncoder

  The <rich:autocomplete> component is an auto-completing input-box with built-in Ajax capabilities. It supports client-side suggestions, browser-like selection, and customization of the look and feel.

  Author:
    Nick Belaevski

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `COMPONENT_FAMILY`
    `static String` | `COMPONENT_TYPE`
    `static String` | `ITEMS_META_COMPONENT_ID`

    - ### Fields inherited from class javax.faces.component.UIInput

      `CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID, UPDATE_MESSAGE_ID, VALIDATE_EMPTY_FIELDS_PARAM_NAME`

    - ### Fields inherited from class javax.faces.component.UIComponent

      `ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, VIEW_LOCATION_KEY`

    - ### Fields inherited from interface org.richfaces.component.MetaComponentResolver

      `META_COMPONENT_SEPARATOR_CHAR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractAutocomplete()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `encodeMetaComponent(javax.faces.context.FacesContext context, String metaComponentId)`
    `abstract Object` | `getAutocompleteList()` A collection of suggestions that will be resented to the user
    `abstract javax.el.MethodExpression` | `getAutocompleteMethod()` A method which returns a list of suggestions according to a supplied prefix
    `abstract String` | `getClientFilterFunction()` A javascript function used to filter the result list returned from the ajax call to the server.
    `abstract Object` | `getFetchValue()` A value to set in the target input element on a choice suggestion that isn't shown in the suggestion table.
    `abstract String` | `getInputClass()` Assigns one or more space-separated CSS class names to the input element
    `abstract String` | `getLayout()` Type of the layout encoded using nested components should be defined using layout attribute.
    `abstract int` | `getMinChars()` Minimal number of chars in input to activate suggestion popup
    `abstract org.richfaces.component.AutocompleteMode` | `getMode()` Determine how the suggestion list is requested:
    `abstract String` | `getOnbeforedomupdate()` The client-side script method to be called after the ajax response comes back, but before the DOM is updated
    `abstract String` | `getOnbegin()` The client-side script method to be called before an ajax request.
    `abstract String` | `getOnblur()`
    `abstract String` | `getOnchange()` Javascript code executed when this element loses focus and its value has been modified since gaining focus.
    `abstract String` | `getOnclick()`
    `abstract String` | `getOncomplete()` The client-side script method to be called after the DOM is updated
    `abstract String` | `getOndblclick()`
    `abstract String` | `getOnerror()` The client-side script method to be called when an error has occurred during Ajax communications
    `abstract String` | `getOnfocus()`
    `abstract String` | `getOnkeydown()`
    `abstract String` | `getOnkeypress()`
    `abstract String` | `getOnkeyup()`
    `abstract String` | `getOnlistclick()` Javascript code executed when a pointer button is clicked over the popup list element.
    `abstract String` | `getOnlistdblclick()` Javascript code executed when a pointer button is double clicked over this element.
    `abstract String` | `getOnlistkeydown()` Javascript code executed when a key is pressed down over this element.
    `abstract String` | `getOnlistkeypress()` Javascript code executed when a key is pressed and released over this element.
    `abstract String` | `getOnlistkeyup()` Javascript code executed when a key is released over this element.
    `abstract String` | `getOnlistmousedown()` Javascript code executed when a pointer button is pressed down over this element.
    `abstract String` | `getOnlistmousemove()` Javascript code executed when a pointer button is moved within this element.
    `abstract String` | `getOnlistmouseout()` Javascript code executed when a pointer button is moved away from this element.
    `abstract String` | `getOnlistmouseover()` Javascript code executed when a pointer button is moved onto this element.
    `abstract String` | `getOnlistmouseup()` Javascript code executed when a pointer button is released over this element.
    `abstract String` | `getOnmousedown()`
    `abstract String` | `getOnmousemove()`
    `abstract String` | `getOnmouseout()`
    `abstract String` | `getOnmouseover()`
    `abstract String` | `getOnmouseup()`
    `abstract String` | `getOnselectitem()` Javascript code executed when an item is selected
    `abstract String` | `getPopupClass()` Assigns one or more space-separated CSS class names to the content of the popup suggestion element
    `abstract String` | `getSelectedItemClass()` Assigns one or more space-separated CSS class names to the selected suggestion entry
    `abstract String` | `getStyle()` CSS style(s) to be applied when this component is rendered.
    `abstract String` | `getStyleClass()` Space-separated list of CSS style class(es) to be applied when this element is rendered.
    `abstract String` | `getTabindex()`
    `abstract String` | `getTokens()` Allow a user to enter multiple values separated by specific characters.
    `abstract String` | `getVar()` A request-scope attribute via which the data object for the current row will be used when iterating
    `abstract boolean` | `isAutofill()` Causes the combo-box to fill the text field box with a matching suggestion as the user types
    `abstract boolean` | `isDisabled()` Boolean value indicating whether this component is disabled
    `abstract boolean` | `isSelectFirst()` Boolean value indicating whether the first suggestion item is selected as the user types
    `abstract boolean` | `isShowButton()` Boolean value indicating whether to display a button to expand the popup suggestion element
    `String` | `resolveClientId(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent contextComponent, String metaComponentId)`
    `abstract void` | `setAutocompleteMethod(javax.el.MethodExpression expression)`
    `String` | `substituteUnresolvedClientId(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent contextComponent, String metaComponentId)`
    `boolean` | `visitTree(javax.faces.component.visit.VisitContext context, javax.faces.component.visit.VisitCallback callback)`

    - ### Methods inherited from class javax.faces.component.UIInput

      `addValidator, addValueChangeListener, clearInitialState, compareValues, decode, getConvertedValue, getConverterMessage, getFamily, getRequiredMessage, getSubmittedValue, getValidator, getValidatorMessage, getValidators, getValueChangeListener, getValueChangeListeners, isEmpty, isImmediate, isLocalValueSet, isRequired, isValid, markInitialState, processDecodes, processUpdates, processValidators, removeValidator, removeValueChangeListener, resetValue, restoreState, saveState, setConverterMessage, setImmediate, setLocalValueSet, setRequired, setRequiredMessage, setSubmittedValue, setValid, setValidator, setValidatorMessage, setValue, setValueChangeListener, updateModel, validate, validateValue`

    - ### Methods inherited from class javax.faces.component.UIOutput

      `getConverter, getLocalValue, getValue, setConverter`

    - ### Methods inherited from class javax.faces.component.UIComponentBase

      `addClientBehavior, addFacesListener, broadcast, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent`

    - ### Methods inherited from class javax.faces.component.UIComponent

      `encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface javax.faces.component.ValueHolder

      `getConverter, getLocalValue, getValue, setConverter`

- - ### Field Detail

    - #### ITEMS_META_COMPONENT_ID

          public static final String ITEMS_META_COMPONENT_ID

      See Also:
        Constant Field Values

    - #### COMPONENT_TYPE

          public static final String COMPONENT_TYPE

      See Also:
        Constant Field Values

    - #### COMPONENT_FAMILY

          public static final String COMPONENT_FAMILY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AbstractAutocomplete

          public AbstractAutocomplete()

  - ### Method Detail

    - #### getAutocompleteList

          public abstract Object getAutocompleteList()

      A collection of suggestions that will be resented to the user

    - #### getAutocompleteMethod

          public abstract javax.el.MethodExpression getAutocompleteMethod()

      A method which returns a list of suggestions according to a supplied prefix

    - #### setAutocompleteMethod

          public abstract void setAutocompleteMethod(javax.el.MethodExpression expression)

    - #### getVar

          public abstract String getVar()

      A request-scope attribute via which the data object for the current row will be used when iterating

    - #### getFetchValue

          public abstract Object getFetchValue()

      A value to set in the target input element on a choice suggestion that isn't shown in the suggestion table. It can be used for descriptive output comments or suggestions. If not set, all text in the suggestion row is set as a value

    - #### getMinChars

          public abstract int getMinChars()

      Minimal number of chars in input to activate suggestion popup

    - #### getSelectedItemClass

          public abstract String getSelectedItemClass()

      Assigns one or more space-separated CSS class names to the selected suggestion entry

    - #### getPopupClass

          public abstract String getPopupClass()

      Assigns one or more space-separated CSS class names to the content of the popup suggestion element

    - #### getInputClass

          public abstract String getInputClass()

      Assigns one or more space-separated CSS class names to the input element

    - #### getMode

          public abstract org.richfaces.component.AutocompleteMode getMode()

      Determine how the suggestion list is requested:

      client
        pre-loads data to the client and uses the input to filter the possible suggestions
      ajax
        fetches suggestions with every input change using Ajax requests
      lazyClient
        pre-loads data to the client and uses the input to filter the possible suggestions. The filtering does not start until the input length matches a minimum value. Set the minimum value with the minChars attribute.
      cachedAjax
        pre-loads data via Ajax requests when the input length matches a minimum value. Set the minimum value with the minChars attribute. All suggestions are handled on the client until the input prefix is changed, at which point a new request is made based on the new input prefix

      Default: cachedAjax

    - #### getLayout

          public abstract String getLayout()

      Type of the layout encoded using nested components should be defined using layout attribute. Possible values are:

      list
        suggestions wrapped to HTML unordered list
      div
        suggestions wrapped with just div element
      table
        suggestions are encoded as table rows, column definitions are required in this case

      Default: div

    - #### getTokens

          public abstract String getTokens()

      Allow a user to enter multiple values separated by specific characters. As the user types, a suggestion will present as normal. When they enter the specified token character, this begins a new suggestion process, and the component will then only use text entered after the token character for suggestions.

      Make sure that no character defined in tokens is part of any suggestion value. E.g. do not use space as a token if you expect to allow spaces in suggestion values.

      When tokens defined, they can be naturally separated by space character - input separated by tokens ', ' or ' ,' will be considered as it would be ',' token without any space.

    - #### isAutofill

          public abstract boolean isAutofill()

      Causes the combo-box to fill the text field box with a matching suggestion as the user types

    - #### isDisabled

          public abstract boolean isDisabled()

      Boolean value indicating whether this component is disabled

      Default: false

    - #### isShowButton

          public abstract boolean isShowButton()

      Boolean value indicating whether to display a button to expand the popup suggestion element

      Default: false

    - #### isSelectFirst

          public abstract boolean isSelectFirst()

      Boolean value indicating whether the first suggestion item is selected as the user types

      Default: true

    - #### getClientFilterFunction

          public abstract String getClientFilterFunction()

      A javascript function used to filter the result list returned from the ajax call to the server. This function should have two parameters; subString(current input value considering tokens) and value (currently iterated item value) and return boolean flag which means if the value satisfies the substring passed. The function will be called for every available suggestion in order to construct a new list of suggestions.

      Default: A javascript method called startsWith

    - #### getStyle

          public abstract String getStyle()

      CSS style(s) to be applied when this component is rendered.

    - #### getStyleClass

          public abstract String getStyleClass()

      Space-separated list of CSS style class(es) to be applied when this element is rendered. This value must be passed through as the "class" attribute on generated markup.

    - #### getTabindex

          public abstract String getTabindex()

    - #### getOnselectitem

          public abstract String getOnselectitem()

      Javascript code executed when an item is selected

    - #### getOnchange

          public abstract String getOnchange()

      Javascript code executed when this element loses focus and its value has been modified since gaining focus.

    - #### getOnlistclick

          public abstract String getOnlistclick()

      Javascript code executed when a pointer button is clicked over the popup list element.

    - #### getOnlistdblclick

          public abstract String getOnlistdblclick()

      Javascript code executed when a pointer button is double clicked over this element.

    - #### getOnlistmousedown

          public abstract String getOnlistmousedown()

      Javascript code executed when a pointer button is pressed down over this element.

    - #### getOnlistmouseup

          public abstract String getOnlistmouseup()

      Javascript code executed when a pointer button is released over this element.

    - #### getOnlistmouseover

          public abstract String getOnlistmouseover()

      Javascript code executed when a pointer button is moved onto this element.

    - #### getOnlistmousemove

          public abstract String getOnlistmousemove()

      Javascript code executed when a pointer button is moved within this element.

    - #### getOnlistmouseout

          public abstract String getOnlistmouseout()

      Javascript code executed when a pointer button is moved away from this element.

    - #### getOnlistkeypress

          public abstract String getOnlistkeypress()

      Javascript code executed when a key is pressed and released over this element.

    - #### getOnlistkeydown

          public abstract String getOnlistkeydown()

      Javascript code executed when a key is pressed down over this element.

    - #### getOnlistkeyup

          public abstract String getOnlistkeyup()

      Javascript code executed when a key is released over this element.

    - #### getOnclick

          public abstract String getOnclick()

    - #### getOndblclick

          public abstract String getOndblclick()

    - #### getOnmousedown

          public abstract String getOnmousedown()

    - #### getOnmouseup

          public abstract String getOnmouseup()

    - #### getOnmouseover

          public abstract String getOnmouseover()

    - #### getOnmousemove

          public abstract String getOnmousemove()

    - #### getOnmouseout

          public abstract String getOnmouseout()

    - #### getOnkeypress

          public abstract String getOnkeypress()

    - #### getOnkeydown

          public abstract String getOnkeydown()

    - #### getOnkeyup

          public abstract String getOnkeyup()

    - #### getOnblur

          public abstract String getOnblur()

    - #### getOnfocus

          public abstract String getOnfocus()

    - #### getOnbegin

          public abstract String getOnbegin()

      The client-side script method to be called before an ajax request.

    - #### getOnerror

          public abstract String getOnerror()

      The client-side script method to be called when an error has occurred during Ajax communications

    - #### getOncomplete

          public abstract String getOncomplete()

      The client-side script method to be called after the DOM is updated

    - #### getOnbeforedomupdate

          public abstract String getOnbeforedomupdate()

      The client-side script method to be called after the ajax response comes back, but before the DOM is updated

    - #### resolveClientId

          public String resolveClientId(javax.faces.context.FacesContext facesContext,
                               javax.faces.component.UIComponent contextComponent,
                               String metaComponentId)

      Specified by:
        `resolveClientId` in interface `org.richfaces.component.MetaComponentResolver`

    - #### substituteUnresolvedClientId

          public String substituteUnresolvedClientId(javax.faces.context.FacesContext facesContext,
                                            javax.faces.component.UIComponent contextComponent,
                                            String metaComponentId)

      Specified by:
        `substituteUnresolvedClientId` in interface `org.richfaces.component.MetaComponentResolver`

    - #### visitTree

          public boolean visitTree(javax.faces.component.visit.VisitContext context,
                          javax.faces.component.visit.VisitCallback callback)

      Overrides:
        `visitTree` in class `javax.faces.component.UIComponent`

    - #### encodeMetaComponent

          public void encodeMetaComponent(javax.faces.context.FacesContext context,
                                 String metaComponentId)
                                   throws IOException

      Specified by:
        `encodeMetaComponent` in interface `org.richfaces.component.MetaComponentEncoder`
      Throws:
        `IOException`

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.