org.apache.struts2.views.velocity.components
Class AbstractDirective

java.lang.Object
  extended by org.apache.velocity.runtime.directive.Directive
      extended by org.apache.struts2.views.velocity.components.AbstractDirective
All Implemented Interfaces:
Cloneable, org.apache.velocity.runtime.directive.DirectiveConstants
Direct Known Subclasses:
ActionDirective, ActionErrorDirective, ActionMessageDirective, AnchorDirective, BeanDirective, CheckBoxDirective, CheckBoxListDirective, ComboBoxDirective, ComponentDirective, DateDirective, DivDirective, DoubleSelectDirective, FieldErrorDirective, FileDirective, FormDirective, HeadDirective, HiddenDirective, I18nDirective, IncludeDirective, InputTransferSelectDirective, LabelDirective, OptGroupDirective, OptionTransferSelectDirective, ParamDirective, PasswordDirective, PropertyDirective, PushDirective, RadioDirective, ResetDirective, SelectDirective, SetDirective, SubmitDirective, TextAreaDirective, TextDirective, TextFieldDirective, TokenDirective, UpDownSelectDirective, URLDirective

public abstract class AbstractDirective
extends org.apache.velocity.runtime.directive.Directive


Field Summary
 
Fields inherited from class org.apache.velocity.runtime.directive.Directive
rsvc
 
Fields inherited from interface org.apache.velocity.runtime.directive.DirectiveConstants
BLOCK, LINE
 
Constructor Summary
AbstractDirective()
           
 
Method Summary
protected  Map createPropertyMap(org.apache.velocity.context.InternalContextAdapter contextAdapter, org.apache.velocity.runtime.parser.node.Node node)
          create a Map of properties that the user has passed in.
protected abstract  Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res)
           
abstract  String getBeanName()
           
 String getName()
           
 int getType()
          All components, unless otherwise stated, are LINE-level directives.
protected  void putProperty(Map propertyMap, org.apache.velocity.context.InternalContextAdapter contextAdapter, org.apache.velocity.runtime.parser.node.Node node)
          adds a given Node's key/value pair to the propertyMap.
 boolean render(org.apache.velocity.context.InternalContextAdapter ctx, Writer writer, org.apache.velocity.runtime.parser.node.Node node)
           
 
Methods inherited from class org.apache.velocity.runtime.directive.Directive
getColumn, getLine, init, setLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDirective

public AbstractDirective()
Method Detail

getName

public String getName()
Specified by:
getName in class org.apache.velocity.runtime.directive.Directive

getBeanName

public abstract String getBeanName()

getType

public int getType()
All components, unless otherwise stated, are LINE-level directives.

Specified by:
getType in class org.apache.velocity.runtime.directive.Directive

getBean

protected abstract Component getBean(ValueStack stack,
                                     HttpServletRequest req,
                                     HttpServletResponse res)

render

public boolean render(org.apache.velocity.context.InternalContextAdapter ctx,
                      Writer writer,
                      org.apache.velocity.runtime.parser.node.Node node)
               throws IOException,
                      org.apache.velocity.exception.ResourceNotFoundException,
                      org.apache.velocity.exception.ParseErrorException,
                      org.apache.velocity.exception.MethodInvocationException
Specified by:
render in class org.apache.velocity.runtime.directive.Directive
Throws:
IOException
org.apache.velocity.exception.ResourceNotFoundException
org.apache.velocity.exception.ParseErrorException
org.apache.velocity.exception.MethodInvocationException

createPropertyMap

protected Map createPropertyMap(org.apache.velocity.context.InternalContextAdapter contextAdapter,
                                org.apache.velocity.runtime.parser.node.Node node)
                         throws org.apache.velocity.exception.ParseErrorException,
                                org.apache.velocity.exception.MethodInvocationException
create a Map of properties that the user has passed in. for example,
 #xxx("name=hello" "value=world" "template=foo")
 
would yield a params that contains {["name", "hello"], ["value", "world"], ["template", "foo"]}

Parameters:
node - the Node passed in to the render method
Returns:
a Map of the user specified properties
Throws:
org.apache.velocity.exception.ParseErrorException - if the was an error in the format of the property
org.apache.velocity.exception.MethodInvocationException

putProperty

protected void putProperty(Map propertyMap,
                           org.apache.velocity.context.InternalContextAdapter contextAdapter,
                           org.apache.velocity.runtime.parser.node.Node node)
                    throws org.apache.velocity.exception.ParseErrorException,
                           org.apache.velocity.exception.MethodInvocationException
adds a given Node's key/value pair to the propertyMap. For example, if this Node contained the value "rows=20", then the key, rows, would be added to the propertyMap with the String value, 20.

Parameters:
propertyMap - a params containing all the properties that we wish to set
node - the parameter to set expressed in "name=value" format
Throws:
org.apache.velocity.exception.ParseErrorException
org.apache.velocity.exception.MethodInvocationException


Copyright © 2000-2009 Apache Software Foundation. All Rights Reserved.