|
jacquard 1.12.0 by The Web Engineering Factory and Toolworks | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.co.weft.htform.ResourceConsumerImpl
uk.co.weft.domutil.NodeGeneratorImpl
uk.co.weft.domutil.MaybeParseGenerator
uk.co.weft.domutil.ElementGenerator
an ElementGenerator is an superclass for things which generate [X|HT]ML elements. The behaviour of this class is subtle and may seem perverse, but it's actually handy. By default, if ElementGenerator has no sub generators added to it, it will generate nodes with content only, which will be parsed from the value associated with its token in the context. If it has subgenerators, it will generate elements containing the elements generated by its subgenerators only, but no content parsed from the value.
| Field Summary | |
protected boolean |
childrenAndContent
if I have child generaters, do I generate node content? By default I don't, for reasons discussed in the documentation above |
protected java.util.Vector |
generators
My generators for attributes and elements |
protected java.lang.String |
keyname
the name of the key field in that data store, if any |
protected java.util.Hashtable |
mapping
A mapping which tells me what generators to use for particular object types |
protected java.lang.String |
storename
the name of the data store (at this stage, a database table) I wrap, if any |
protected java.lang.String |
token
the token I will look for in the context to provide the value for the element I generate |
| 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 | |
ElementGenerator()
no args constructor; recommend you don't use this, but it makes it easier to write subclasses |
|
ElementGenerator(java.lang.String name)
constructor: fix up my name |
|
ElementGenerator(java.lang.String name,
java.lang.String token)
constructor: generally, the name of the value to extract from the context is the same as the name of the element, but this constructor handles the case where it isn't. |
|
ElementGenerator(java.lang.String name,
java.lang.String token,
java.lang.String storename)
constructor: we often generate elements from data stores, for example database tables. |
|
ElementGenerator(java.lang.String name,
java.lang.String token,
java.lang.String storename,
java.lang.String keyname)
constructor: we often generate elements from data stores, for example database tables. |
|
ElementGenerator(java.lang.String name,
java.lang.String token,
java.lang.String storename,
java.lang.String keyname,
boolean childrenAndContent)
constructor: we often generate elements from data stores, for example database tables. |
|
| Method Summary | |
ElementGenerator |
addGenerator(NodeGenerator generator)
add a generator to my generators, either for a child element or for an attribute |
protected void |
doinit(Context config)
Do any actual configuration required by this element. |
protected void |
fetchDetail(Context context)
fetch the detail of the item indicated by this context into this context |
Node |
generate(Document doc,
Context c)
construct an element with my name and attach my attributes and children. |
Node |
generate(Document doc,
java.lang.Object obj)
Construct an element representing this object with my name |
Node |
generate(Document doc,
java.lang.Object obj,
java.lang.String tag)
Construct an element representing this object with this name |
protected java.lang.Object |
getTokenValue(Context c)
subclasses can specialise this to mung the value in arbitrary ways. |
void |
init(Context config)
Initialise me and any children I already have at initialisation time. |
void |
register(java.lang.Class valueType,
ElementGenerator generator)
Register an ElementGenerator to handle values of class valueType. |
void |
setChildrenAndContent(boolean childrenAndContent)
|
| 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 |
protected java.util.Hashtable mapping
protected java.lang.String keyname
protected java.lang.String storename
protected java.lang.String token
protected java.util.Vector generators
protected boolean childrenAndContent
| Constructor Detail |
public ElementGenerator()
public ElementGenerator(java.lang.String name)
public ElementGenerator(java.lang.String name,
java.lang.String token)
name - the tag name of the element I will generatetoken - the token I will look up in the context to find the value
for the element I generate.
public ElementGenerator(java.lang.String name,
java.lang.String token,
java.lang.String storename)
name - the tag name of the element I will generatetoken - the token I will look up in the context to find the value
for the element I generate, and also the name of the keyfield
in the data store.storename - the name of the data store in which to look
public ElementGenerator(java.lang.String name,
java.lang.String token,
java.lang.String storename,
java.lang.String keyname)
name - the tag name of the element I will generatetoken - the token I will look up in the context to find the value
for the element I generatestorename - the name of the data store in which to lookkeyname - the name of the keyfield in that store
public ElementGenerator(java.lang.String name,
java.lang.String token,
java.lang.String storename,
java.lang.String keyname,
boolean childrenAndContent)
name - the tag name of the element I will generatetoken - the token I will look up in the context to find the value
for the element I generatestorename - the name of the data store in which to lookkeyname - the name of the keyfield in that storechildrenAndContent - if true, then generate my content from both
the value of my token in the context and from my added
generators. Otherwise, if I have added generators, generate
content from them only; if not, generate content from the value
only. See documentation.| Method Detail |
public void setChildrenAndContent(boolean childrenAndContent)
childrenAndContent - The childrenAndContent to set.public ElementGenerator addGenerator(NodeGenerator generator)
generator - the generator to add
public Node generate(Document doc,
Context c)
throws GenerationException,
DOMException
generate in interface NodeGeneratorgenerate in class NodeGeneratorImpldoc - the document in which this element is to be created.c - the context in which this generation takes place
GenerationException - may throw a GenerationException if the
generation cannot be completed.
DOMException - will be passed through if Xerces barfs
public Node generate(Document doc,
java.lang.Object obj,
java.lang.String tag)
throws GenerationException,
DOMException
doc - the document in which this element is to be created.obj - the object to represent in the generated elementtag - the name for this element
GenerationException - may throw a GenerationException if the
generation cannot be completed.
DOMException - will be passed through if Xerces barfs
public Node generate(Document doc,
java.lang.Object obj)
throws GenerationException,
DOMException
doc - the document in which this element is to be created.
GenerationException - may throw a GenerationException if the
generation cannot be completed.
DOMException - will be passed through if Xerces barfs
public void init(Context config)
throws InitialisationException
init in interface NodeGeneratorinit in class NodeGeneratorImplconfig - a context containing configuration information.
InitialisationException
public void register(java.lang.Class valueType,
ElementGenerator generator)
valueType - the class for which the generator I'm registering
should be usedgenerator - the generator to use for values of this classprotected java.lang.Object getTokenValue(Context c)
c - the context in which this generation takes placeprotected void doinit(Context config)
config - a context containing configuration information.init(Context)
protected void fetchDetail(Context context)
throws GenerationException
GenerationException
|
jacquard 1.12.0 by The Web Engineering Factory and Toolworks | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||