XFA4J

com.adobe.xfa
Class AppModel

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.AppModel

public final class AppModel
extends Model

A class to represent the top level element in the XFA object model. All application-specific models are represented as sub-models of this one.

Example:
 xfa <- this is the AppModel
   datasets <- this is the XFADataModel
     data <- this is $data in SOM expressions (a datagroup)


Nested Class Summary
static class AppModel.LegacyMask
           
 
Nested classes/interfaces inherited from class com.adobe.xfa.Node
Node.ChangeLogger
 
Field Summary
static AppModel.LegacyMask XFA_PATCH_W_2757988
           
 
Fields inherited from class com.adobe.xfa.Node
CREATE_ALWAYS_NEW, CREATE_IF_NOT_EXIST, CREATE_MUST_NOT_EXIST, CREATE_REPLACE
 
Constructor Summary
AppModel(LogMessenger messenger)
          Instantiates an app model with the given messenger.
 
Method Summary
 void addFactory(ModelFactory factory)
          Adds a model factory to the list of registered factories.
 void addPseudoModel(java.lang.String sShortCutName, Obj obj)
          Makes an object visible to the global scripting namespace.
 void addScriptHandler(ScriptHandler handler)
          Adds (registers) a script handler for this app model.
 void appendChild(Node newChild, boolean bValidate)
          Appends the given child to this element.
 void clearErrorList()
          Clears this app model's current list of errors.
 void clearScriptingContexts()
          Clears any scripting contexts associated with all script handlers previously registered with this app model.
 java.util.List<ModelFactory> factories()
          Returns the list of registered factories.
 java.util.List<Element> getErrorContextList()
          Gets all the context nodes that correspond to entries in the error list.
 java.util.List<ExFull> getErrorList()
          Gets all the errors that have been generated by this app model since the last method call to clear the error list.
 boolean getExternalProtosAreTransient()
          Determines whether external proto fragments are marked as transient when they are resolved.
 HrefHandler getHrefHandler()
          Gets the current HrefService handler.
 java.util.List<ScriptHandler> getScriptHandlers()
          Gets the list of script handlers registered with this app model.
static boolean includePacket(java.lang.String aPacketName, java.lang.String sInList)
          Determines if a packet should be included based on a packet list.
 void insertChild(Node newChild, Node refChild, boolean bValidate)
          Inserts a child before a specific child in the child list.
 Obj lookupPseudoModel(java.lang.String sShortCutName)
          Looks up a scripting object registered with the global scripting namespace.
 Element newDOM()
          Creates a new node hierarchy of a new XFA DOM.
 void removePseudoModel(java.lang.String sShortCutName)
          Removes a scripting object shortcut from the global scripting namespace.
 void setExternalProtosAreTransient(boolean bExternalProtosAreTransient)
          Determines whether external proto fragments are marked as transient when they are resolved.
 void setHrefHandler(HrefHandler handler)
          Sets the HrefService handler associated with this AppModel.
 
Methods inherited from class com.adobe.xfa.Model
createElement, createElement, createElement, createTextNode, getCurrentVersion, getDocument, normalizeNameSpaces, resolveNodes
 
Methods inherited from class com.adobe.xfa.Element
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
 

Field Detail

XFA_PATCH_W_2757988

public static final AppModel.LegacyMask XFA_PATCH_W_2757988
Constructor Detail

AppModel

public AppModel(LogMessenger messenger)
Instantiates an app model with the given messenger.

Parameters:
messenger - a log messenger, if any.
Method Detail

includePacket

public static boolean includePacket(java.lang.String aPacketName,
                                    java.lang.String sInList)
Determines if a packet should be included based on a packet list.

Parameters:
aPacketName - the packet to test for
sInList - the list of packets
Returns:
boolean -- in or out.

addFactory

public void addFactory(ModelFactory factory)
Adds a model factory to the list of registered factories.

Factories are added for models that are to be loaded with a full implementation. If no model is explicitly added, a default model with minimal functionality will be used.

Parameters:
factory - the factory to add.

addPseudoModel

public void addPseudoModel(java.lang.String sShortCutName,
                           Obj obj)
Makes an object visible to the global scripting namespace. The obj parameter will typically be derived from PseudoModel. The shortcut name must start with a dollar sign ($).

For example, an application might use this method to add an object derived from HostPseudoModel and register it with the name $host.

Parameters:
sShortCutName - the name of the scripting object.
obj - the scriptable object
See Also:
AppModel.removePseudoModel(String)

addScriptHandler

public void addScriptHandler(ScriptHandler handler)
Adds (registers) a script handler for this app model. Script handlers are added to provide scripting support for various languages.

Parameters:
handler - the script handler to add.

clearScriptingContexts

public void clearScriptingContexts()
Clears any scripting contexts associated with all script handlers previously registered with this app model.

See Also:
AppModel.addScriptHandler(ScriptHandler)

appendChild

public void appendChild(Node newChild,
                        boolean bValidate)
Description copied from class: Element
Appends the given child to this element.

Overrides:
appendChild in class Element
Parameters:
newChild - the child node being appended.
bValidate - when true, ensures the given child is valid per the model's schema and throws an ExFull if not.
See Also:
Element.appendChild(Node, boolean)

clearErrorList

public void clearErrorList()
Clears this app model's current list of errors.

Overrides:
clearErrorList in class Model
See Also:
Model.clearErrorList()

factories

public java.util.List<ModelFactory> factories()
Returns the list of registered factories.

Returns:
a list of Model factories.

getErrorContextList

public java.util.List<Element> getErrorContextList()
Gets all the context nodes that correspond to entries in the error list.

Overrides:
getErrorContextList in class Model
Returns:
A list of Element objects where the load discovered a problem.

getErrorList

public java.util.List<ExFull> getErrorList()
Gets all the errors that have been generated by this app model since the last method call to clear the error list. This involves getting the error lists for all the descendant models and concatenating them together.

Overrides:
getErrorList in class Model
Returns:
the current list of ExFull error objects.

getExternalProtosAreTransient

public boolean getExternalProtosAreTransient()
Determines whether external proto fragments are marked as transient when they are resolved. When proto fragments are marked as transient, the DOMSaveOptions.setSaveFragment(boolean) setting controls whether resolved fragments are included when the model is serialized. The default is false which means that resolved fragments are always serialized.

This flag is only relevant if AppModel.setHrefHandler(HrefHandler) has been called.

Returns:
true if external fragments should be transient (i.e. left as references when serialized), or false if they should be non-transient (i.e. expanded when serialized).
See Also:
AppModel.setExternalProtosAreTransient(boolean)

getHrefHandler

public HrefHandler getHrefHandler()
Gets the current HrefService handler.

Returns:
the HrefService handler associated with the AppModel.

getScriptHandlers

public java.util.List<ScriptHandler> getScriptHandlers()
Gets the list of script handlers registered with this app model.

Returns:
the list of script handlers.
See Also:
AppModel.addScriptHandler(ScriptHandler).

insertChild

public void insertChild(Node newChild,
                        Node refChild,
                        boolean bValidate)
Description copied from class: Element
Inserts a child before a specific child in the child list.

Overrides:
insertChild in class Element
Parameters:
newChild - the child to be inserted
refChild - the child to insert before
bValidate - if true, validate the insertion
See Also:
Element.insertChild(Node, Node, boolean)

lookupPseudoModel

public Obj lookupPseudoModel(java.lang.String sShortCutName)
Looks up a scripting object registered with the global scripting namespace.

Parameters:
sShortCutName - the scripting shortcut name.
Returns:
a scripting object (typically derived from PseudoModel), or null if not found.

newDOM

public Element newDOM()
Creates a new node hierarchy of a new XFA DOM. The returned node will always be the AppModel. The children that this node has depends on which factories have been added via addFactory(). Each installed factory will create some default node or tree of nodes under the AppModel node.

Returns:
The root node of the new hierarchy.

removePseudoModel

public void removePseudoModel(java.lang.String sShortCutName)
Removes a scripting object shortcut from the global scripting namespace.

Parameters:
sShortCutName - the shortcut name of a scripting object
See Also:
AppModel.addPseudoModel(String, Obj)

setExternalProtosAreTransient

public void setExternalProtosAreTransient(boolean bExternalProtosAreTransient)
Determines whether external proto fragments are marked as transient when they are resolved. When proto fragments are marked as transient, the DOMSaveOptions.setSaveFragment(boolean) setting controls whether resolved fragments are included when the model is serialized. The default is false which means that resolved fragments are always serialized.

This flag is only relevant if AppModel.setHrefHandler(HrefHandler) has been called.

Parameters:
bExternalProtosAreTransient - true if external fragments should be transient (i.e. left as references when serialized), or false if they should be non-transient (i.e. expanded when serialized).
See Also:
AppModel.getExternalProtosAreTransient(), AppModel.setHrefHandler(HrefHandler)

setHrefHandler

public void setHrefHandler(HrefHandler handler)
Sets the HrefService handler associated with this AppModel.

Parameters:
handler - the HrefService handler.

The href service handles the URL resolution and fragment loading for all usehref attribute values on ProtoableNodes.


XFA4J

© 2005 Adobe Systems Incorporated. All Rights Reserved.