Package: org.codehaus.groovy.grails.web.taglib

## [Java] Class LayoutWriterStack

- org.codehaus.groovy.grails.web.taglib.LayoutWriterStack

- 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:

        <g.threeColumn>
            <g.left>left contents</g.left>
            <g.center>middle contents</g.center>
            <g.right>right contents</g.right>
        </g.threeColumn>

  Authors:
    Ivo Houbrechts

- - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `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<java.lang.String, java.lang.Object>` | `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.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), 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

    - #### 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') << "<div class='left'>" << body() <<"</div>"
            }

      Parameters:
        `name` - Name of the layout part
      Returns:
        writer

    - #### public static java.util.Map<java.lang.String, java.lang.Object> 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