com.flexive.shared.scripting.groovy
Class GroovyContentBuilder

java.lang.Object
  extended by groovy.lang.GroovyObjectSupport
      extended by groovy.util.BuilderSupport
          extended by com.flexive.shared.scripting.groovy.GroovyContentBuilder
All Implemented Interfaces:
groovy.lang.GroovyObject

public class GroovyContentBuilder
extends groovy.util.BuilderSupport

A groovy builder for FxContent instances.

Example:

 def builder = new GroovyContentBuilder("DOCUMENT")
 builder {
  title("Test article")
  Abstract("My abstract text")
  teaser {
      teaser_title("Teaser title")
      teaser_text("Teaser text")
  }
  box {
      box_title(new FxString(false, "Box title 1"))
  }
  box {
      box_title("Box title 2")
      box_text("Some box text")
  }
 }
 

Version:
$Rev: 2906 $
Author:
Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)

Constructor Summary
GroovyContentBuilder(FxContent content)
          Create a new content builder that operates on the given content instance.
GroovyContentBuilder(FxPK pk)
          Create a content builder for the given instance.
GroovyContentBuilder(java.lang.String typeName)
          Create an empty content builder for the given type.
 
Method Summary
protected  java.lang.Object createNode(java.lang.Object name)
          
protected  java.lang.Object createNode(java.lang.Object name, java.util.Map attributes)
          
protected  java.lang.Object createNode(java.lang.Object name, java.util.Map attributes, java.lang.Object value)
          
protected  java.lang.Object createNode(java.lang.Object name, java.lang.Object value)
          
 FxContent getContent()
          Return our content instance.
protected  void setParent(java.lang.Object parent, java.lang.Object child)
          
 
Methods inherited from class groovy.util.BuilderSupport
doInvokeMethod, getCurrent, getName, invokeMethod, invokeMethod, nodeCompleted, postNodeCompletion, setClosureDelegate, setCurrent
 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, getProperty, setMetaClass, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroovyContentBuilder

public GroovyContentBuilder(FxContent content)
Create a new content builder that operates on the given content instance.

Parameters:
content - the target content

GroovyContentBuilder

public GroovyContentBuilder(java.lang.String typeName)
                     throws FxApplicationException
Create an empty content builder for the given type.

Parameters:
typeName - the content type name
Throws:
FxApplicationException - if the content could not be initialized by the content engine

GroovyContentBuilder

public GroovyContentBuilder(FxPK pk)
                     throws FxApplicationException
Create a content builder for the given instance.

Parameters:
pk - the object id (the content will be loaded through the content engine)
Throws:
FxApplicationException - if the content could not be loaded
Method Detail

getContent

public FxContent getContent()
Return our content instance.

Returns:
our content instance.

setParent

protected void setParent(java.lang.Object parent,
                         java.lang.Object child)

Specified by:
setParent in class groovy.util.BuilderSupport

createNode

protected java.lang.Object createNode(java.lang.Object name)

Specified by:
createNode in class groovy.util.BuilderSupport

createNode

protected java.lang.Object createNode(java.lang.Object name,
                                      java.lang.Object value)

Specified by:
createNode in class groovy.util.BuilderSupport

createNode

protected java.lang.Object createNode(java.lang.Object name,
                                      java.util.Map attributes)

Specified by:
createNode in class groovy.util.BuilderSupport

createNode

protected java.lang.Object createNode(java.lang.Object name,
                                      java.util.Map attributes,
                                      java.lang.Object value)

Specified by:
createNode in class groovy.util.BuilderSupport