XFA4J

com.adobe.xfa.template
Class TemplateModel

java.lang.Object
  extended by com.adobe.xfa.Obj
      extended by com.adobe.xfa.Node
          extended by com.adobe.xfa.Element
              extended by com.adobe.xfa.Model
                  extended by com.adobe.xfa.template.TemplateModel

public final class TemplateModel
extends Model

A class to model the collection of all the XFA nodes that make up form template.


Nested Class Summary
static class TemplateModel.Insertion
          A class to define a mapping between a key and template fragment reference.
 
Nested classes/interfaces inherited from class com.adobe.xfa.Node
Node.ChangeLogger
 
Field Summary
 
Fields inherited from class com.adobe.xfa.Node
CREATE_ALWAYS_NEW, CREATE_IF_NOT_EXIST, CREATE_MUST_NOT_EXIST, CREATE_REPLACE
 
Method Summary
 void applyFixups()
          Applies fixups on the template model just after it has been loaded.
static TemplateModel getTemplateModel(AppModel app, boolean bCreateIfNotFound)
          Gets the template model held within an XFA DOM hierarchy.
 java.util.List<TemplateModel.Insertion> splice(java.util.List<TemplateModel.Insertion> insertions, boolean removeInsertionPoints)
          Splices external template fragments into this template.
 
Methods inherited from class com.adobe.xfa.Model
clearErrorList, createElement, createElement, createElement, createTextNode, getCurrentVersion, getDocument, getErrorContextList, getErrorList, normalizeNameSpaces, resolveNodes
 
Methods inherited from class com.adobe.xfa.Element
appendChild, assignNode, getAttr, getAttribute, getElement, getFirstXFAChild, getFirstXMLChild, getInstalledLocale, getLastXMLChild, getModel, getName, getNodes, getNS, getNumAttrs, getPrefix, getText, getXFAChild, getXMLChild, isInstalledLocaleAmbient, loadXML, saveXML, setAttribute, setAttribute, setAttribute, setLocalName, setName, setNS, setQName
 
Methods inherited from class com.adobe.xfa.Node
checkAncestorPerms, checkDescendentPerms, checkPerms, cleanDirtyFlags, compareVersions, getData, getDynamicScriptProp, getNextXFASibling, getNextXMLSibling, getOwnerDocument, getPreviousXMLSibling, getSOMExpression, getXFAChildCount, getXFAParent, getXMLChildCount, getXMLParent, hasChanged, remove, resolveNode, resolveNode, resolveNodes, setNextXMLSibling, setPermsLock, setXMLParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTemplateModel

public static TemplateModel getTemplateModel(AppModel app,
                                             boolean bCreateIfNotFound)
Gets the template model held within an XFA DOM hierarchy.

Parameters:
app - the application model.
bCreateIfNotFound - when true, create a template model if needed.
Returns:
the template model or null if none found.

applyFixups

public void applyFixups()
Applies fixups on the template model just after it has been loaded.

Note that this Java implementation does not handle the full set of fixups that are currently handled in the C++ implementation.


splice

public java.util.List<TemplateModel.Insertion> splice(java.util.List<TemplateModel.Insertion> insertions,
                                                      boolean removeInsertionPoints)
Splices external template fragments into this template. The points at which insertions are to be inserted are indicated by those elements containing an extras element that in turn contain a text element with the name "insertionPoint".

Elements containing an extras element that in turn contains a text element with the name "insertionPointPlaceholder" are removed.

The value contained within the text node is an insertion key, and it is matched against each key in insertions. The corresponding replacement reference identifies a template fragment that is loaded and inserted into the template. Each insertion is done by making a copy of the insertion point and inserting that copy before the insertion point. The template fragment reference is then resolved, and the resolved fragment is merged into the insertion point copy.

The values in insertions reference template fragments using the same syntax that the usehref attribute uses to reference external prototype fragments:

Any errors generated while loading the referenced fragment are copied to this TemplateModel.

The caller is responsible for registering an HrefHandler with the AppModel to allow any external references to be resolved.

Parameters:
insertions - the insertions to be spliced into the template.
removeInsertionPoints - if true, then any insertion points in the template are removed.
Returns:
a List containing the entries from insertions for which no corresponding insertion point was found, or null if all insertions were used.
See Also:
AppModel.getErrorList(), AppModel.setHrefHandler(HrefHandler handler)

XFA4J

© 2005 Adobe Systems Incorporated. All Rights Reserved.