public class LayoutWriterStack
extends java.lang.Object
<g.threeColumn>
<g.left>left contents</g.left>
<g.center>middle contents</g.center>
<g.right>right contents</g.right>
</g.threeColumn>
| Constructor and Description |
|---|
LayoutWriterStack() |
| Modifier and Type | Method and Description |
|---|---|
static java.io.Writer |
currentWriter(java.lang.String name)
Returns a
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.
|
public static java.io.Writer currentWriter(java.lang.String name)
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>"
}
name - Name of the layout partpublic static java.util.Map<java.lang.String,java.lang.Object> writeParts(groovy.lang.Closure<?> body)
def parts = LayoutWriterStack.writeParts(body)
out << "left part:" << parts.left << "; right part:" << parts.right << ";remainder of body:" << parts.body
body - the body closure of the calling "layout" tag