org.apache.tapestry.dojo.form
Class Autocompleter

java.lang.Object
  extended by org.apache.hivemind.impl.BaseLocatable
      extended by org.apache.tapestry.AbstractComponent
          extended by org.apache.tapestry.form.AbstractFormComponent
              extended by org.apache.tapestry.dojo.form.AbstractFormWidget
                  extended by org.apache.tapestry.dojo.form.Autocompleter
All Implemented Interfaces:
org.apache.hivemind.Locatable, org.apache.hivemind.LocationHolder, IFormWidget, IWidget, IFormComponent, ValidatableField, IComponent, IDirect, IDirectEvent, IDynamicInvoker, IJSONRender, Component, IRender

public abstract class Autocompleter
extends AbstractFormWidget
implements ValidatableField, IJSONRender, IDirect

An html field similar to a select input field that is wrapped by a dojo ComboBox widget. This component uses the IAutocompleteModel to retrieve and match against selected values.

Author:
jkuhnert

Field Summary
 
Fields inherited from class org.apache.tapestry.AbstractComponent
_body, _bodyCount
 
Constructor Summary
Autocompleter()
           
 
Method Summary
abstract  boolean getAutoCompleteField()
           
abstract  DataSqueezer getDataSqueezer()
          Injected.
abstract  IEngineService getDirectService()
          Injected.
abstract  int getFadeTime()
          The duration(in ms) of the fade effect of list going away.
abstract  String getFilter()
           
abstract  int getMaxListLength()
          The maximum number of items displayed in select list before the scrollbar is activated.
abstract  IAutocompleteModel getModel()
           
abstract  IScript getScript()
          Injected.
abstract  int getSearchDelay()
          How long to wait(in ms) before searching after input is received.
 List getUpdateComponents()
          If set, will be used to update/refresh portions of a response during XHR requests.
abstract  ValidatableFieldSupport getValidatableFieldSupport()
          Injected.
abstract  Object getValue()
           
 boolean isAsync()
          Used to specify whether or not the result of this invocation should be returned asynchronously or use normal browser page reload semantics.
abstract  boolean isForceValidOption()
          Forces select to only allow valid option strings.
 boolean isJson()
          Used to specify that the return invocation of the response created should be in the "http://json.org" format.
abstract  boolean isLocal()
          Forces select to work in local mode (no xhr).
 boolean isRequired()
          Returns false.
 boolean isStateful()
          Invoked by the event service to query the component as to whether it is stateful.
 void renderComponent(IJSONWriter writer, IRequestCycle cycle)
          Renders a JSON object response back to the client.
protected  void renderFormWidget(IMarkupWriter writer, IRequestCycle cycle)
          Called when rendering a form widget.
protected  void rewindFormWidget(IMarkupWriter writer, IRequestCycle cycle)
          Called during form submission to retrieve submitted input values.
abstract  void setFilter(String value)
           
abstract  void setValue(Object value)
           
 void trigger(IRequestCycle cycle)
          Triggerd by using filterOnChange logic.
 
Methods inherited from class org.apache.tapestry.dojo.form.AbstractFormWidget
getDestroy, renderFormComponent, renderWidget, rewindFormComponent, setDestroy
 
Methods inherited from class org.apache.tapestry.form.AbstractFormComponent
generateClientId, getCanTakeFocus, getForm, getIdParameter, getName, getRenderBodyOnRewind, peekClientId, renderComponent, renderDelegateAttributes, renderDelegatePrefix, renderDelegateSuffix, setForm, setName, setName
 
Methods inherited from class org.apache.tapestry.AbstractComponent
addAsset, addBody, addComponent, checkActiveLock, cleanupAfterRender, enterActiveState, equals, finishLoad, finishLoad, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getBoundId, getClientId, getComponent, getComponents, getContainedComponent, getContainedRenderers, getContainer, getEventInvoker, getExtendedId, getId, getIdPath, getInnerRenderers, getListeners, getMessages, getNamespace, getPage, getRenderWorker, getSpecification, getSpecifiedId, getTemplateTagName, hasEvents, hashCode, isInActiveState, isParameterBound, isRendering, pageEndRender, prepareForRender, render, renderBody, renderIdAttribute, renderInformalParameters, setBinding, setClientId, setContainedComponent, setContainer, setHasEvents, setId, setNamespace, setPage, setTemplateTagName, toString, triggerEvent
 
Methods inherited from class org.apache.hivemind.impl.BaseLocatable
getLocation, setLocation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.tapestry.form.ValidatableField
getValidators
 
Methods inherited from interface org.apache.tapestry.form.IFormComponent
getClientId, getDisplayName, getForm, getName, isDisabled, setName
 
Methods inherited from interface org.apache.tapestry.IComponent
addAsset, addBody, addComponent, enterActiveState, finishLoad, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainedComponent, getContainer, getEventInvoker, getExtendedId, getId, getIdPath, getListeners, getMessages, getNamespace, getPage, getSpecification, getSpecifiedId, getTemplateTagName, isRendering, peekClientId, renderBody, setBinding, setClientId, setContainedComponent, setContainer, setId, setNamespace, setPage, setTemplateTagName
 
Methods inherited from interface org.apache.tapestry.IRender
render
 
Methods inherited from interface org.apache.hivemind.LocationHolder
setLocation
 
Methods inherited from interface org.apache.hivemind.Locatable
getLocation
 
Methods inherited from interface org.apache.tapestry.IDirectEvent
triggerEvent
 

Constructor Detail

Autocompleter

public Autocompleter()
Method Detail

renderFormWidget

protected void renderFormWidget(IMarkupWriter writer,
                                IRequestCycle cycle)
Called when rendering a form widget.

Specified by:
renderFormWidget in class AbstractFormWidget
Parameters:
writer - The markup writer to render with.
cycle - The cycle associated with request.

renderComponent

public void renderComponent(IJSONWriter writer,
                            IRequestCycle cycle)
Renders a JSON object response back to the client. It should be assumed that if this method is called on a component it or one of the components it contains has been requested explicitly for rendering.

Specified by:
renderComponent in interface IJSONRender
Parameters:
writer - The json object writer used to write valid JSON responses.
cycle - Contextual request object.

rewindFormWidget

protected void rewindFormWidget(IMarkupWriter writer,
                                IRequestCycle cycle)
Description copied from class: AbstractFormWidget
Called during form submission to retrieve submitted input values. Components should do any validation/retrieval of values in this method.

Specified by:
rewindFormWidget in class AbstractFormWidget
Parameters:
writer - The passed in IMarkupWriter will be a NullWriter, making any content written ignored.
cycle - Typically used to retrieve submitted value via cycle.getParameter(getName()).
See Also:
AbstractFormComponent.rewindFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)

isStateful

public boolean isStateful()
Invoked by the event service to query the component as to whether it is stateful. If stateful and no HttpSession is active, then a StaleSessionException is thrown by the service.

Specified by:
isStateful in interface IDirect
Specified by:
isStateful in interface IDirectEvent
Overrides:
isStateful in class AbstractComponent
Returns:
Whether or not invocation should include state information and validate that a valid session exists when triggered.

trigger

public void trigger(IRequestCycle cycle)
Triggerd by using filterOnChange logic. Invoked by the direct service to have the component perform the appropriate action. The DirectLink component will notify its listener.

Specified by:
trigger in interface IDirect
Parameters:
cycle - The current request.

getModel

public abstract IAutocompleteModel getModel()

getSearchDelay

public abstract int getSearchDelay()
How long to wait(in ms) before searching after input is received.


getFadeTime

public abstract int getFadeTime()
The duration(in ms) of the fade effect of list going away.


getMaxListLength

public abstract int getMaxListLength()
The maximum number of items displayed in select list before the scrollbar is activated.


isForceValidOption

public abstract boolean isForceValidOption()
Forces select to only allow valid option strings.


isLocal

public abstract boolean isLocal()
Forces select to work in local mode (no xhr).


getValue

public abstract Object getValue()
Since:
2.2 *

setValue

public abstract void setValue(Object value)
Since:
2.2 *

setFilter

public abstract void setFilter(String value)
Since:
4.1

getFilter

public abstract String getFilter()
Since:
4.1

getAutoCompleteField

public abstract boolean getAutoCompleteField()
Since:
4.1.4

getDataSqueezer

public abstract DataSqueezer getDataSqueezer()
Injected.


getValidatableFieldSupport

public abstract ValidatableFieldSupport getValidatableFieldSupport()
Injected.


getDirectService

public abstract IEngineService getDirectService()
Injected.


getScript

public abstract IScript getScript()
Injected.


isRequired

public boolean isRequired()
Description copied from class: AbstractFormComponent
Returns false. Subclasses that might be required must override this method. Typically, this involves checking against the component's validators.

Specified by:
isRequired in interface IFormComponent
Overrides:
isRequired in class AbstractFormComponent
See Also:
AbstractFormComponent.isRequired()

getUpdateComponents

public List getUpdateComponents()
If set, will be used to update/refresh portions of a response during XHR requests.

For instance, if you have a page listing projects and you wanted to update an Any components contents whenever one of the project links was clicked you would use a DirectLink with the parameters:

      updateComponents="{'projectDetails'}"
      async="true"
 

Specified by:
getUpdateComponents in interface IDynamicInvoker
Returns:
The list of components to update, if any.

isAsync

public boolean isAsync()
Used to specify whether or not the result of this invocation should be returned asynchronously or use normal browser page reload semantics.

Async being true means responses will be encoded as XML using XmlHttpRequests. If you would like your request/response to be in another format - like JSON - you must also specify the additional parameter IDynamicInvoker.isJson(). Without setting the IDynamicInvoker.getUpdateComponents() parameter this parameter is pretty useless.

Specified by:
isAsync in interface IDynamicInvoker
Returns:
True if invocation should be processed asynchronously.
See Also:
IDynamicInvoker.isJson()

isJson

public boolean isJson()
Used to specify that the return invocation of the response created should be in the "http://json.org" format. Without setting the IDynamicInvoker.getUpdateComponents() parameter this parameter is pretty useless.

Specified by:
isJson in interface IDynamicInvoker
Returns:
True if response should be encoded using JSON semantics.
See Also:
org.apache.tapestry.IJSONRender}


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.