org.apache.velocity.runtime.directive
Class Block

java.lang.Object
  extended by org.apache.velocity.runtime.directive.Directive
      extended by org.apache.velocity.runtime.directive.Block
All Implemented Interfaces:
Cloneable, DirectiveConstants
Direct Known Subclasses:
BlockMacro, Define

public abstract class Block
extends Directive

Directive that puts an unrendered AST block in the context under the specified key, postponing rendering until the reference is used and rendered.

Since:
1.7
Version:
$Id: Block.java 686842 2008-08-18 18:29:31Z nbubna $
Author:
Andrew Tetlaw, Nathan Bubna, Jarkko Viinamaki

Nested Class Summary
static class Block.Reference
          actual class placed in the context, holds the context being used for the render, as well as the parent (which already holds everything else we need).
 
Field Summary
protected  Node block
           
protected  String key
           
protected  Log log
           
protected  int maxDepth
           
 
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
Block()
           
 
Method Summary
 int getType()
          Return type of this directive.
protected  String id(InternalContextAdapter context)
          Creates a string identifying the source and location of the block definition, and the current template being rendered if that is different.
 void init(RuntimeServices rs, InternalContextAdapter context, Node node)
          simple init - get the key
 boolean render(InternalContextAdapter context, Writer writer)
           
 
Methods inherited from class org.apache.velocity.runtime.directive.Directive
getColumn, getLine, getName, getScopeName, getTemplateName, isScopeProvided, makeScope, postRender, preRender, render, setLocation, setLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

block

protected Node block

log

protected Log log

maxDepth

protected int maxDepth

key

protected String key
Constructor Detail

Block

public Block()
Method Detail

getType

public int getType()
Return type of this directive.

Specified by:
getType in class Directive
Returns:
The directive type BLOCK/LINE.

init

public void init(RuntimeServices rs,
                 InternalContextAdapter context,
                 Node node)
          throws TemplateInitException
simple init - get the key

Overrides:
init in class Directive
Throws:
TemplateInitException

render

public boolean render(InternalContextAdapter context,
                      Writer writer)

id

protected String id(InternalContextAdapter context)
Creates a string identifying the source and location of the block definition, and the current template being rendered if that is different.



Copyright © 2000-2010 The Apache Software Foundation. All Rights Reserved.