Project Wonder 5.0

er.ajax
Class AjaxAutoComplete

java.lang.Object
  extended by com.webobjects.appserver.WOElement
      extended by com.webobjects.appserver.WOComponent
          extended by er.ajax.AjaxComponent
              extended by er.ajax.AjaxAutoComplete
All Implemented Interfaces:
com.webobjects.appserver.WOActionResults, com.webobjects.foundation.NSKeyValueCoding, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCodingAdditions, com.webobjects.foundation.NSValidation, IAjaxElement, java.io.Serializable, java.lang.Cloneable

public class AjaxAutoComplete
extends AjaxComponent

Autocompleting combo-box similar to Google suggest.
This is a component that look like a text field, where when you start entering value, it start giving you a menu of options related to what you type. Think about the auto-completion feature of many IDE (XCode / Eclipse) inside a textField.

The scriptaculous library has 2 version of the autocompleter combo-box : a local version and an ajax version.

Local

The local version hold the list of values all in memory (client-side), there is no interaction. If the number of elements is big enough to be in a WOPopUP, then this variant is well suited for you. If the list of element to show is too big, then you might prefer the 'ajax' version.
You have to tell the component that it is local (by default it is 'ajax' type) using the isLocal binding. Then the list binding will need to provide all the objects needed to be found. Filtering of the list as you type will be done client-side, all javascript.

Ajax

Autocomplete field similar to what google has. You bind a value and a method that returns a list and it hits the server on each keystroke and displays the results.

See Also:
Serialized Form
Author:
ak
Bindings
list bound to a method that should return the whole list of object to be displayed. When used in an Ajax context, the component will push first to the value binding, giving you the chance to narrow the list of elements displayed. When used in a Local context, the list should contain all possible objects. the list will be filtered by the scriptaculous engine.
           
value string that will hold the text entered in the field. It is continiously updated.
           
item pushed and pulled the current element of the list. This can be used to customized the string representation (in conjuction with the displayString binding) of the object.
           
displayString optional custom string representation of the current element.
           
isLocal boolean indicating if you want the list to be completely client-side. Binding a true value, would mean that the list will filtered on the client.
           
isLocalSharedList boolean indicating if the list needs to be shared.
           
localSharedVarName the name of the javascript variable to use to store the list in. The list is stored in the userInfo dictionary on the server side to allow for shared use by multiple auto complete components.
           
tokentoken
           
frequency Look at the scriptaculous documentation.
           
minChars Look at the scriptaculous documentation.
           
indicator Look at the scriptaculous documentation.
           
updateElement Look at the scriptaculous documentation.
           
afterUpdateElement Look at the scriptaculous documentation.
           
select Look at the scriptaculous documentation.
           
onShow Look at the scriptaculous documentation.
           
fullSearch Look at the scriptaculous documentation.
           
partialSearch Look at the scriptaculous documentation.
           
choices Look at the scriptaculous documentation (Local only)
           
partialChars Look at the scriptaculous documentation (Local only)
           
ignoreCase Look at the scriptaculous documentation (Local only)
           
accesskey hot key that should activate the text field (optional)
           
tabindex tab index of the text field (optional)
           
default hint for the text field, when used together with {@link AjaxTextHinter}.
           
selection if set, if the text field's string matches the displayString of one of the objects in the provided list, that object will be bound back as the selection. currently this only supports displayString renderers and not child templates
           
class class attribute of the text field
           
style class attribute of the text field
           
onblur onblur attribute of the text field
           
onfocus onfocus attribute of the text field
           
onchange onchange attribute of the text field
           
activateOnFocus activate when text field gets focus
           
containerId tag id for the container of the popup div (default is body)
           

Nested Class Summary
 
Nested classes/interfaces inherited from class com.webobjects.appserver.WOComponent
com.webobjects.appserver.WOComponent._EventLoggingEnabler, com.webobjects.appserver.WOComponent.Event
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
com.webobjects.foundation.NSKeyValueCodingAdditions.DefaultImplementation, com.webobjects.foundation.NSKeyValueCodingAdditions.Utility
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCoding
com.webobjects.foundation.NSKeyValueCoding._BooleanFieldBinding, com.webobjects.foundation.NSKeyValueCoding._BooleanMethodBinding, com.webobjects.foundation.NSKeyValueCoding._FieldBinding, com.webobjects.foundation.NSKeyValueCoding._ForwardingBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding._MethodBinding, com.webobjects.foundation.NSKeyValueCoding._NumberFieldBinding, com.webobjects.foundation.NSKeyValueCoding._NumberMethodBinding, com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCoding.Null, com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException, com.webobjects.foundation.NSKeyValueCoding.ValueAccessor
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSValidation
com.webobjects.foundation.NSValidation._MethodBinding, com.webobjects.foundation.NSValidation._ValidationBinding, com.webobjects.foundation.NSValidation.DefaultImplementation, com.webobjects.foundation.NSValidation.Utility, com.webobjects.foundation.NSValidation.ValidationException
 
Field Summary
 java.lang.String divName
           
 java.lang.String fieldName
           
 java.lang.String indicatorName
           
 
Fields inherited from class com.webobjects.appserver.WOComponent
_Extension, _IsEventLoggingEnabled, _keyAssociations
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding.ErrorHandling
_CLASS
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
_CLASS, _KeyPathSeparatorChar, KeyPathSeparator
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
NullValue
 
Fields inherited from interface com.webobjects.foundation.NSValidation
_CLASS
 
Constructor Summary
AjaxAutoComplete(com.webobjects.appserver.WOContext context)
           
 
Method Summary
protected  void addRequiredWebResources(com.webobjects.appserver.WOResponse res)
          Adds all required resources.
protected  void appendItemToResponse(java.lang.Object value, com.webobjects.appserver.WOElement child, boolean hasItem, com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context)
           
 void appendToResponse(com.webobjects.appserver.WOResponse res, com.webobjects.appserver.WOContext ctx)
          Overridden to add the initialization javascript for the auto completer.
 void awake()
          Overridden to set the IDs for the field and the div tag.
protected  com.webobjects.foundation.NSDictionary createAjaxOptions()
           
protected  java.lang.String displayStringForValue(java.lang.Object value)
           
 com.webobjects.appserver.WOActionResults handleRequest(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
          Handles the Ajax request.
 java.lang.String indicator()
           
 boolean isStateless()
          Overridden because the component is stateless
protected  int maxItems()
           
 void setStringValue(java.lang.String strValue)
           
 void sleep()
           
 java.lang.String stringValue()
           
 boolean synchronizesVariablesWithBindings()
          Overridden because the component does not synch with the bindings.
 void takeValuesFromRequest(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
           
 java.lang.String zcontainerName()
           
 
Methods inherited from class er.ajax.AjaxComponent
_containerID, addScriptResourceInHead, addScriptResourceInHead, addStylesheetResourceInHead, addStylesheetResourceInHead, appendTagAttributeToResponse, booleanValueForBinding, invokeAction, safeElementID, shouldHandleRequest, valueForBinding, valueForBinding, valueForBinding
 
Methods inherited from class com.webobjects.appserver.WOComponent
_associationWithName, _awakeInContext, _childTemplate, _componentDefinition, _componentUnroll, _isPage, _setContext, _setIsPage, _setParent, _setSubcomponent, _sleepInContext, _subcomponentForElementWithID, _templateNameForClass, _unroll, application, baseURL, bindingKeys, canAccessFieldsDirectly, canGetValueForBinding, canSetValueForBinding, clone, context, debugString, descriptionForResponse, ensureAwakeInContext, frameworkName, generateResponse, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hasBinding, hasSession, isCachingEnabled, isEventLoggingEnabled, logString, name, pageWithName, parent, path, pathURL, performParentAction, pullValuesFromParent, pushValuesToParent, reset, session, set_componentUnroll, set_unroll, setCachingEnabled, setValueForBinding, takeValueForKey, takeValueForKeyPath, template, templateWithHTMLString, templateWithName, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, validationFailedWithException, valueForBinding, valueForKey, valueForKeyPath
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

divName

public java.lang.String divName

fieldName

public java.lang.String fieldName

indicatorName

public java.lang.String indicatorName
Constructor Detail

AjaxAutoComplete

public AjaxAutoComplete(com.webobjects.appserver.WOContext context)
Method Detail

awake

public void awake()
Overridden to set the IDs for the field and the div tag.

Overrides:
awake in class com.webobjects.appserver.WOComponent

sleep

public void sleep()
Overrides:
sleep in class com.webobjects.appserver.WOComponent

isStateless

public boolean isStateless()
Overridden because the component is stateless

Overrides:
isStateless in class com.webobjects.appserver.WOComponent

synchronizesVariablesWithBindings

public boolean synchronizesVariablesWithBindings()
Overridden because the component does not synch with the bindings.

Overrides:
synchronizesVariablesWithBindings in class com.webobjects.appserver.WOComponent

indicator

public java.lang.String indicator()

createAjaxOptions

protected com.webobjects.foundation.NSDictionary createAjaxOptions()

appendToResponse

public void appendToResponse(com.webobjects.appserver.WOResponse res,
                             com.webobjects.appserver.WOContext ctx)
Overridden to add the initialization javascript for the auto completer.

Overrides:
appendToResponse in class AjaxComponent

addRequiredWebResources

protected void addRequiredWebResources(com.webobjects.appserver.WOResponse res)
Adds all required resources.

Specified by:
addRequiredWebResources in class AjaxComponent

stringValue

public java.lang.String stringValue()

displayStringForValue

protected java.lang.String displayStringForValue(java.lang.Object value)

maxItems

protected int maxItems()

setStringValue

public void setStringValue(java.lang.String strValue)

takeValuesFromRequest

public void takeValuesFromRequest(com.webobjects.appserver.WORequest request,
                                  com.webobjects.appserver.WOContext context)
Overrides:
takeValuesFromRequest in class com.webobjects.appserver.WOComponent

appendItemToResponse

protected void appendItemToResponse(java.lang.Object value,
                                    com.webobjects.appserver.WOElement child,
                                    boolean hasItem,
                                    com.webobjects.appserver.WOResponse response,
                                    com.webobjects.appserver.WOContext context)

handleRequest

public com.webobjects.appserver.WOActionResults handleRequest(com.webobjects.appserver.WORequest request,
                                                              com.webobjects.appserver.WOContext context)
Handles the Ajax request. Checks for the form value in the edit field, pushes it up to the parent and pulls the "list" binding. The parent is responsible for returning a list with some items that match the current value.

Specified by:
handleRequest in interface IAjaxElement
Specified by:
handleRequest in class AjaxComponent

zcontainerName

public java.lang.String zcontainerName()

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.