View Javadoc

1   /*
2    * This file was automatically generated by Apache Tiles Autotag.
3    */
4   package org.apache.tiles.velocity.template;
5   
6   import java.io.IOException;
7   import java.io.Writer;
8   
9   import org.apache.tiles.autotag.core.runtime.ModelBody;
10  import org.apache.tiles.autotag.core.runtime.AutotagRuntime;
11  import org.apache.velocity.context.InternalContextAdapter;
12  import org.apache.velocity.runtime.directive.Directive;
13  import org.apache.velocity.runtime.parser.node.Node;
14  
15  /**
16   * <p>
17   * <strong>Declare a list that will be pass as attribute to tile. </strong>
18   * </p>
19   * <p>
20   * Declare a list that will be pass as attribute to tile. List elements are
21   * added using the tags 'addAttribute' or 'addListAttribute'. This tag can only
22   * be used inside 'insertTemplate', 'insertDefinition', 'definition' tags.
23   * </p>
24   */
25  public class PutListAttributeDirective extends Directive {
26  
27      /**
28       * The template model.
29       */
30      private org.apache.tiles.template.PutListAttributeModel model = new org.apache.tiles.template.PutListAttributeModel();
31  
32      /** {@inheritDoc} */
33      @Override
34      public String getName() {
35          return "tiles_putListAttribute";
36      }
37  
38      /** {@inheritDoc} */
39      @Override
40      public int getType() {
41          return BLOCK;
42      }
43  
44      /** {@inheritDoc} */
45      @Override
46      public boolean render(InternalContextAdapter context, Writer writer, Node node)
47              throws IOException {
48          AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.velocity.autotag.VelocityAutotagRuntime();
49          if (runtime instanceof Directive) {
50              ((Directive) runtime).render(context, writer, node);
51          }
52          org.apache.tiles.request.Request request = runtime.createRequest();
53          ModelBody modelBody = runtime.createModelBody();
54          model.execute(
55              runtime.getParameter("name", java.lang.String.class, null),
56              runtime.getParameter("role", java.lang.String.class, null),
57              runtime.getParameter("inherit", java.lang.Boolean.class, false),
58              runtime.getParameter("cascade", java.lang.Boolean.class, false),
59              request, modelBody
60          );
61          return true;
62      }
63  }