net.sf.tacos.ajax.components
Class AjaxEventSubmit

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 net.sf.tacos.ajax.components.AbstractSubmit
                  extended by net.sf.tacos.ajax.components.AjaxEventSubmit
All Implemented Interfaces:
AjaxInvocation, AjaxSubmitInvocation, DeferredScriptProducer, Locatable, LocationHolder, org.apache.tapestry.form.IFormComponent, org.apache.tapestry.IComponent, org.apache.tapestry.IRender

public abstract class AjaxEventSubmit
extends AbstractSubmit
implements DeferredScriptProducer

Generates a javascript function that submits the containing form using an AJAX request.

This component is generally used when implementing javascript events on form components, such as 'onchange' handlers in a PropertySelection component. Check the demo for an example.

Author:
Leonardo Quijano

Constructor Summary
AjaxEventSubmit()
           
 
Method Summary
protected  boolean getCanTakeFocus()
          This component shouldn't take focus.
 String getComponentId()
          The component Id used by script
abstract  org.apache.tapestry.IScript getDeferredScript()
          Deferred script
 String getHiddenId()
          The hidden form field id
abstract  org.apache.tapestry.IScript getScript()
          Injected IScript.
abstract  Collection getUpdateComponents()
          Components to update in request
protected  boolean isClicked(org.apache.tapestry.IRequestCycle cycle, String name)
          Returns true if the specified elemento has been activated (similar to a button being clicked).
 boolean isDeferred()
          Causes initial event connection to be deferred
protected  void renderFormComponent(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle)
           
abstract  void setFunctionName(String value)
           
 
Methods inherited from class net.sf.tacos.ajax.components.AbstractSubmit
constructScriptParameter, getAction, getAjaxLink, getDefer, getEncodingType, getFocusElement, getListener, getListenerInvoker, getParameters, getTag, handleClick, rewindFormComponent, setSelected
 
Methods inherited from class org.apache.tapestry.form.AbstractFormComponent
getAlwaysRenderBodyOnRewind, getForm, getIdParameter, getName, isRequired, renderComponent, renderDelegateAttributes, renderDelegatePrefix, renderDelegateSuffix, renderIdAttribute, setClientId, setForm, setName, setName
 
Methods inherited from class org.apache.tapestry.AbstractComponent
addAsset, addBody, addComponent, checkActiveLock, cleanupAfterRender, enterActiveState, finishLoad, finishLoad, format, format, format, format, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getComponent, getComponents, getContainedComponent, getContainer, getExtendedId, getId, getIdPath, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, isInActiveState, isParameterBound, isRendering, pageEndRender, prepareForRender, render, renderBody, renderInformalParameters, setBinding, setContainedComponent, setContainer, setId, setNamespace, setPage, setProperty, toString
 
Methods inherited from class org.apache.hivemind.impl.BaseLocatable
getLocation, setLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.tacos.ajax.AjaxSubmitInvocation
getFunctionName, isClientSideValidationEnabled, isSubmitNormal
 
Methods inherited from interface net.sf.tacos.ajax.AjaxInvocation
getAjaxEngine, getBackLink, getEffects, getForwardLink, getPopup, getPreEffects, getStatusElement, getUpdateObject
 
Methods inherited from interface org.apache.tapestry.form.IFormComponent
getClientId, getDisplayName, isDisabled
 
Methods inherited from interface org.apache.tapestry.IComponent
addAsset, addBody, addComponent, enterActiveState, finishLoad, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainedComponent, getContainer, getExtendedId, getId, getIdPath, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, isRendering, renderBody, setBinding, setContainedComponent, setContainer, setId, setNamespace, setPage, setProperty
 
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
 

Constructor Detail

AjaxEventSubmit

public AjaxEventSubmit()
Method Detail

getUpdateComponents

public abstract Collection getUpdateComponents()
Components to update in request

Specified by:
getUpdateComponents in interface AjaxInvocation

getScript

public abstract org.apache.tapestry.IScript getScript()
Injected IScript.

Returns:
javascript template

getDeferredScript

public abstract org.apache.tapestry.IScript getDeferredScript()
Deferred script


setFunctionName

public abstract void setFunctionName(String value)
Parameters:
value - the function name.

getCanTakeFocus

protected boolean getCanTakeFocus()
This component shouldn't take focus.

Overrides:
getCanTakeFocus in class org.apache.tapestry.form.AbstractFormComponent

isClicked

protected boolean isClicked(org.apache.tapestry.IRequestCycle cycle,
                            String name)
Returns true if the specified elemento has been activated (similar to a button being clicked).

Specified by:
isClicked in class AbstractSubmit
Parameters:
cycle - Tapestry request cycle.
name - the element name.
Returns:
True if the element has been clicked.

renderFormComponent

protected void renderFormComponent(org.apache.tapestry.IMarkupWriter writer,
                                   org.apache.tapestry.IRequestCycle cycle)
Specified by:
renderFormComponent in class org.apache.tapestry.form.AbstractFormComponent
See Also:
AbstractFormComponent.renderFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)

getComponentId

public String getComponentId()
The component Id used by script

Specified by:
getComponentId in interface AjaxSubmitInvocation
Returns:
component Id

getHiddenId

public String getHiddenId()
The hidden form field id

Specified by:
getHiddenId in interface AjaxSubmitInvocation
Returns:
hidden id

isDeferred

public boolean isDeferred()
Causes initial event connection to be deferred

Specified by:
isDeferred in interface AjaxSubmitInvocation
Returns:
deferred