org.apache.tapestry.script
Class ParsedScript

java.lang.Object
  extended by org.apache.tapestry.script.ParsedScript
All Implemented Interfaces:
org.apache.hivemind.Locatable, IScript, IScriptToken

public class ParsedScript
extends Object
implements IScript

A top level container for a number of script tokens.

Since:
0.2.9
Author:
Howard Lewis Ship

Constructor Summary
ParsedScript(ExpressionEvaluator evaluator, ValueConverter valueConverter, org.apache.hivemind.Location location)
           
 
Method Summary
 void addToken(IScriptToken token)
          Invoked during parsing to add the token parameter as a child of this token.
protected  Object evaluate(String expression, ScriptSession session)
          Evaluates the expression against the session's symbols, using ExpressionEvaluator.read(Object, String) and returns the result.
protected  boolean evaluateBoolean(String expression, ScriptSession session)
          Evaluates an expression and coerces the result to a boolean.
 void execute(IComponent target, IRequestCycle cycle, IScriptProcessor processor, Map symbols)
          Executes the script, which will read and modify the symbols Map.
 void execute(IRequestCycle cycle, IScriptProcessor processor, Map symbols)
          Creates the ScriptSessionImpland invokes AbstractToken.writeChildren(java.lang.StringBuffer, org.apache.tapestry.script.ScriptSession).
 org.apache.hivemind.Location getLocation()
           
 org.apache.hivemind.Resource getScriptResource()
          Returns the location from which the script was loaded.
 void write(StringBuffer buffer, ScriptSession session)
          Does nothing; never invoked.
protected  void writeChildren(StringBuffer buffer, ScriptSession session)
          Invokes IScriptToken.write(StringBuffer,ScriptSession)on each child token (if there are any).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParsedScript

public ParsedScript(ExpressionEvaluator evaluator,
                    ValueConverter valueConverter,
                    org.apache.hivemind.Location location)
Method Detail

getScriptResource

public org.apache.hivemind.Resource getScriptResource()
Description copied from interface: IScript
Returns the location from which the script was loaded.

Specified by:
getScriptResource in interface IScript

execute

public void execute(IRequestCycle cycle,
                    IScriptProcessor processor,
                    Map symbols)
Creates the ScriptSessionImpland invokes AbstractToken.writeChildren(java.lang.StringBuffer, org.apache.tapestry.script.ScriptSession).

Specified by:
execute in interface IScript
Parameters:
cycle - the current request cycle
processor - an object that processes the results of the script, typically an instance of Body
symbols - Map of input symbols; execution of the script may modify the map, creating new output symbols
See Also:
TapestryUtils.getPageRenderSupport(IRequestCycle, IComponent)

execute

public void execute(IComponent target,
                    IRequestCycle cycle,
                    IScriptProcessor processor,
                    Map symbols)
Executes the script, which will read and modify the symbols Map. The script works with the IScriptProcessor to get the generated JavaScript included on the page.

Specified by:
execute in interface IScript
Parameters:
target - The component this script is being executed by/for
cycle - the current request cycle
processor - an object that processes the results of the script, typically an instance of Body
symbols - Map of input symbols; execution of the script may modify the map, creating new output symbols
See Also:
TapestryUtils.getPageRenderSupport(IRequestCycle, IComponent)

write

public void write(StringBuffer buffer,
                  ScriptSession session)
Does nothing; never invoked.

Specified by:
write in interface IScriptToken

getLocation

public org.apache.hivemind.Location getLocation()
Specified by:
getLocation in interface org.apache.hivemind.Locatable

addToken

public void addToken(IScriptToken token)
Description copied from interface: IScriptToken
Invoked during parsing to add the token parameter as a child of this token.

Specified by:
addToken in interface IScriptToken

writeChildren

protected void writeChildren(StringBuffer buffer,
                             ScriptSession session)
Invokes IScriptToken.write(StringBuffer,ScriptSession)on each child token (if there are any).


evaluate

protected Object evaluate(String expression,
                          ScriptSession session)
Evaluates the expression against the session's symbols, using ExpressionEvaluator.read(Object, String) and returns the result.


evaluateBoolean

protected boolean evaluateBoolean(String expression,
                                  ScriptSession session)
Evaluates an expression and coerces the result to a boolean.

Since:
4.0


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