jacquard 1.12.0 by The Web Engineering Factory and Toolworks

uk.co.weft.domutil
Class ContextElementGenerator

java.lang.Object
  extended byuk.co.weft.htform.ResourceConsumerImpl
      extended byuk.co.weft.domutil.NodeGeneratorImpl
          extended byuk.co.weft.domutil.MaybeParseGenerator
              extended byuk.co.weft.domutil.ElementGenerator
                  extended byuk.co.weft.domutil.ContextElementGenerator
All Implemented Interfaces:
NodeGenerator, ResourceConsumer

public abstract class ContextElementGenerator
extends ElementGenerator

a ContextElementGenerator generates a DOM elements from contexts. Intended to be subclassed: add your attrNames and childNames values.

Version:
$Revision: 1.4.4.2 $ This revision: $Author: simon $
Author:
Simon Brooke

Field Summary
protected  java.lang.String[] attrNames
          The names which, if bound in the generate timecontext, should be implemented as attributes of the generated element
protected  java.lang.String[] childNames
          The names which, if bound in the generate time context, should be implemented as children of the generated element having only text content.
 
Fields inherited from class uk.co.weft.domutil.ElementGenerator
childrenAndContent, generators, keyname, mapping, storename, token
 
Fields inherited from class uk.co.weft.domutil.MaybeParseGenerator
embeddedMarkup
 
Fields inherited from class uk.co.weft.domutil.NodeGeneratorImpl
debug, name, namespaceURI
 
Fields inherited from class uk.co.weft.htform.ResourceConsumerImpl
resourceBundleName
 
Fields inherited from interface uk.co.weft.domutil.NodeGenerator
NAMESPACEURIMAGICTOKEN
 
Fields inherited from interface uk.co.weft.htform.ResourceConsumer
RESOURCEBUNDLEMAGICTOKEN
 
Constructor Summary
ContextElementGenerator()
          no args constructor; recommend you don't use this, but it makes it easier to write subclasses
ContextElementGenerator(java.lang.String name)
          constructor: fix up my name
ContextElementGenerator(java.lang.String name, java.lang.String[] attrNames, java.lang.String[] childNames)
          constructor: fix up all my instance variables
 
Method Summary
 Node generate(Document doc, Context context)
          construct an element with my name and attach my attributes and children.
protected  java.lang.String[] getAttrNames()
          return a String array of the names of my properties to output as attributes
protected  java.lang.String[] getChildNames()
          return a String array of the names of my properties to output as children
 
Methods inherited from class uk.co.weft.domutil.ElementGenerator
addGenerator, doinit, fetchDetail, generate, generate, getTokenValue, init, register, setChildrenAndContent
 
Methods inherited from class uk.co.weft.domutil.MaybeParseGenerator
allowEmbeddedMarkup, maybeParse
 
Methods inherited from class uk.co.weft.domutil.NodeGeneratorImpl
getName, getNamespaceURI, setDebug, setNamespaceURI
 
Methods inherited from class uk.co.weft.htform.ResourceConsumerImpl
getContextOrResource, getResource, getResourceOrContext, getResourceString, grs, grs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.co.weft.domutil.NodeGenerator
getName, getNamespaceURI, setDebug
 

Field Detail

attrNames

protected java.lang.String[] attrNames
The names which, if bound in the generate timecontext, should be implemented as attributes of the generated element


childNames

protected java.lang.String[] childNames
The names which, if bound in the generate time context, should be implemented as children of the generated element having only text content.

Constructor Detail

ContextElementGenerator

public ContextElementGenerator()
no args constructor; recommend you don't use this, but it makes it easier to write subclasses


ContextElementGenerator

public ContextElementGenerator(java.lang.String name)
constructor: fix up my name


ContextElementGenerator

public ContextElementGenerator(java.lang.String name,
                               java.lang.String[] attrNames,
                               java.lang.String[] childNames)
constructor: fix up all my instance variables

Parameters:
name - the name of the element I will generate
attrNames - the names which, if bound in the generate time context, should be implemented as attributes of the generated element
childNames - the names which, if bound in the generate time context, should be implemented as children of the generated element having only text content.
Method Detail

generate

public Node generate(Document doc,
                     Context context)
              throws GenerationException,
                     DOMException
construct an element with my name and attach my attributes and children. Specialise for elements with more complex internal structure

Specified by:
generate in interface NodeGenerator
Overrides:
generate in class ElementGenerator
Parameters:
doc - the document in which this element is to be created.
context - the context in which this generation takes place
Returns:
the element created.
Throws:
GenerationException - may throw a GenerationException if the generation cannot be completed.
DOMException - will be passed through if Xerces barfs

getAttrNames

protected java.lang.String[] getAttrNames()
return a String array of the names of my properties to output as attributes


getChildNames

protected java.lang.String[] getChildNames()
return a String array of the names of my properties to output as children


jacquard 1.12.0 by The Web Engineering Factory and Toolworks