Groovy Documentation

org.codehaus.groovy.grails.web.taglib
[Java] Class LayoutWriterStack

java.lang.Object
  org.codehaus.groovy.grails.web.taglib.LayoutWriterStack

public class LayoutWriterStack
extends java.lang.Object

Class that can be used by "layout" tags, i.e. tags that use the different parts in their body to assemble a bigger part. Example a threeColumn tag that expects a left, center and right part in its body and places them in a table:

  
      left contents
      middle contents
      right contents
  
  
  
Authors:
Ivo Houbrechts


Method Summary
static java.io.Writer currentWriter(java.lang.String name)

Returns a java.io.Writer where a layout part can write its contents to.

static java.util.Map writeParts(groovy.lang.Closure body)

Executes the body closure of a tag and returns a Map with namned results that hold the content of the parts within the body.

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Method Detail

currentWriter

public static java.io.Writer currentWriter(java.lang.String name)
Returns a java.io.Writer where a layout part can write its contents to. This method should only be called by tags that are part of a surrounding layout tag. Example:
  def left = { attrs, body ->
      LayoutWriterStack.currentWriter('left') << "
" << body() <<"
" }
Parameters:
name - Name of the layout part
Returns:
writer


writeParts

public static java.util.Map writeParts(groovy.lang.Closure body)
Executes the body closure of a tag and returns a Map with namned results that hold the content of the parts within the body. This method should only be called by tags that are part of a surrounding layout tag. Example:
  def parts = LayoutWriterStack.writeParts(body)
  out << "left part:" << parts.left << "; right part:" << parts.right << ";remainder of body:" << parts.body
  
  
Parameters:
body - the body closure of the calling "layout" tag
Returns:
a Map that contains the results of all the parts in the body and the body itself


 

Groovy Documentation