net.sf.tacos.ajax.impl
Class FormComponentEventWorker

java.lang.Object
  extended by net.sf.tacos.ajax.impl.FormComponentEventWorker
All Implemented Interfaces:
org.apache.tapestry.enhance.EnhancementWorker

public class FormComponentEventWorker
extends Object
implements org.apache.tapestry.enhance.EnhancementWorker

Looks for the existance of any "eventListener" parameters to IFormComponent and adds render contributions to the component for linking javascript events to ajax actions.

Author:
jkuhnert

Field Summary
protected  AjaxWebRequest ajaxRequest
          injected ajex request reference
static String EVENT_PARAMETER
          event listener parameter name
protected  org.apache.tapestry.services.ExpressionEvaluator expressionEvaluator
          injected ognl parser
static String FORMATTER_PARAMETER
          formatting parameter name
protected static String RENDER_METHOD
          render method of IRender
protected static Class[] RENDER_PARAMS
          parameters to render method in IRender
protected  org.apache.tapestry.engine.IScriptSource scriptSource
          injected script source.
 
Constructor Summary
FormComponentEventWorker()
           
 
Method Summary
protected  String buildMethodCallBack(org.apache.tapestry.spec.IComponentSpecification spec, MethodSignature method, MethodSignature accessor, MethodSignature exprAccessor, MethodSignature scriptSourceAccessor)
          Enhances the AbstractFormComponent.renderFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle) method of all form fields to handle any possible defferred script actions.
protected  MethodSignature createExpressionAccessor(org.apache.tapestry.enhance.EnhancementOperation op, org.apache.tapestry.spec.IComponentSpecification spec)
          Creates an injected ExpressionEvaluator field into the component which will be used by enhanced methods to generate ajax request links.
protected  MethodSignature createRequestAccessor(org.apache.tapestry.enhance.EnhancementOperation op, org.apache.tapestry.spec.IComponentSpecification spec)
          Creates an injected AjaxWebRequest field into the component which will be used by enhanced methods to use ajax resources.
protected  MethodSignature createScriptSourceAccessor(org.apache.tapestry.enhance.EnhancementOperation op, org.apache.tapestry.spec.IComponentSpecification spec)
          Creates an injected IScriptSource field into the component which will be used by enhanced methods to use Tapestry script sources.
 void performEnhancement(org.apache.tapestry.enhance.EnhancementOperation op, org.apache.tapestry.spec.IComponentSpecification spec)
          
 void setAjaxRequest(AjaxWebRequest ajaxRequest)
          Injected ajax request
 void setExpressionEvaluator(org.apache.tapestry.services.ExpressionEvaluator expressionEvaluator)
          Injected ognl parser
 void setScriptSource(org.apache.tapestry.engine.IScriptSource scriptSource)
          Injected script source
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ajaxRequest

protected AjaxWebRequest ajaxRequest
injected ajex request reference


expressionEvaluator

protected org.apache.tapestry.services.ExpressionEvaluator expressionEvaluator
injected ognl parser


scriptSource

protected org.apache.tapestry.engine.IScriptSource scriptSource
injected script source.


EVENT_PARAMETER

public static final String EVENT_PARAMETER
event listener parameter name

See Also:
Constant Field Values

FORMATTER_PARAMETER

public static final String FORMATTER_PARAMETER
formatting parameter name

See Also:
Constant Field Values

RENDER_METHOD

protected static final String RENDER_METHOD
render method of IRender

See Also:
Constant Field Values

RENDER_PARAMS

protected static final Class[] RENDER_PARAMS
parameters to render method in IRender

Constructor Detail

FormComponentEventWorker

public FormComponentEventWorker()
Method Detail

performEnhancement

public void performEnhancement(org.apache.tapestry.enhance.EnhancementOperation op,
                               org.apache.tapestry.spec.IComponentSpecification spec)

Specified by:
performEnhancement in interface org.apache.tapestry.enhance.EnhancementWorker

createRequestAccessor

protected MethodSignature createRequestAccessor(org.apache.tapestry.enhance.EnhancementOperation op,
                                                org.apache.tapestry.spec.IComponentSpecification spec)
Creates an injected AjaxWebRequest field into the component which will be used by enhanced methods to use ajax resources.

Parameters:
op -
spec -
Returns:

createScriptSourceAccessor

protected MethodSignature createScriptSourceAccessor(org.apache.tapestry.enhance.EnhancementOperation op,
                                                     org.apache.tapestry.spec.IComponentSpecification spec)
Creates an injected IScriptSource field into the component which will be used by enhanced methods to use Tapestry script sources.

Parameters:
op -
spec -
Returns:

createExpressionAccessor

protected MethodSignature createExpressionAccessor(org.apache.tapestry.enhance.EnhancementOperation op,
                                                   org.apache.tapestry.spec.IComponentSpecification spec)
Creates an injected ExpressionEvaluator field into the component which will be used by enhanced methods to generate ajax request links.

Parameters:
op -
spec -
Returns:

buildMethodCallBack

protected String buildMethodCallBack(org.apache.tapestry.spec.IComponentSpecification spec,
                                     MethodSignature method,
                                     MethodSignature accessor,
                                     MethodSignature exprAccessor,
                                     MethodSignature scriptSourceAccessor)
Enhances the AbstractFormComponent.renderFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle) method of all form fields to handle any possible defferred script actions.

Parameters:
spec -
method -
accessor - Getter for ajax request
exprAccessor - Expression evaluator
scriptSourceAccessor - getter for script source.
Returns:
The javassist method body

setAjaxRequest

public void setAjaxRequest(AjaxWebRequest ajaxRequest)
Injected ajax request

Parameters:
ajaxRequest -

setExpressionEvaluator

public void setExpressionEvaluator(org.apache.tapestry.services.ExpressionEvaluator expressionEvaluator)
Injected ognl parser

Parameters:
expressionEvaluator -

setScriptSource

public void setScriptSource(org.apache.tapestry.engine.IScriptSource scriptSource)
Injected script source

Parameters:
scriptSource -