Package com.adobe.xfa

Class Model

    • Method Detail

      • checkforCompatibleNS

        public static boolean checkforCompatibleNS​(String aNS,
                                                   String aModelNS)
        Helper function for isCompatibleNS
        aNS - - namespace of node being checked
        aModelNS - - namespace of model being checked against.
      • addErrorList

        public final void addErrorList​(ExFull error,
                                       int eSeverity,
                                       Element context)
      • removeLastError

        public final void removeLastError()
      • addUseHRefNode

        public void addUseHRefNode​(Element poUseHRefNode)
        add a new new node to the useNodeHrefList
      • addUseNode

        public void addUseNode​(Element poUse)
        add a new new node to the useNodeList
      • addXMLLoadErrorContext

        public void addXMLLoadErrorContext​(Node oSrc,
                                           ExFull oEx)
        This method is called by derived classes to output the filename and line number when an error occurs during the load of an XML File.
      • allowUpdates

        public void allowUpdates​(boolean bAllowUpdates)
        Sets whether this model can be updated at runtime. This should only be true for Designer.
        bAllowUpdates - - true if this model can be modified at runtime, otherwise false.
      • clearErrorList

        public void clearErrorList()
        Clears the model's current list of errors.
      • createElement

        public Element createElement​(Element parent,
                                     Node prevSibling,
                                     String uri,
                                     String qName)
        Creates an element with the given parent, previous sibling, namespace uri and qualified name.
        parent - the element's parent, if any.
        prevSibling - the element's previous sibling, if any.
        uri - the element's namespace URI. This string must be interned.
        qName - the element's qualified name. This string must be interned.
        a new element conformant to our schema.
      • createElement

        public Element createElement​(Element parent,
                                     Node prevSibling,
                                     String uri,
                                     String localName,
                                     String qName,
                                     Attributes attributes,
                                     int lineNumber,
                                     String fileName)
        Creates an element with the given parent, sibling, namespace uri, local name and SAX attributes.
        parent - the element's parent, if any.
        prevSibling - the element's previous sibling, if any.
        uri - the element's namespace. This string must be interned.
        localName - the element's name. This string must be interned.
        qName - the element's qualified name. This string must be interned.
        attributes - the element's (SAX) attribute definitions.
        a new element conformant to our schema.
      • createElement

        public final Element createElement​(int eTag,
                                           String name)
        Create an element with the given element tag and name.
        eTag - the element's tag.
        name - the element's name, if known. This string must be interned.
        a new element conformant to the XFA schema.
      • createElement

        public final Element createElement​(String className,
                                           String name,
                                           Element parent)
        Creates an element with the given class, name and parent.
        className - the element's class name. This string must be interned.
        name - the element's name, if known. This string must be interned.
        parent - the element's parent.
        a new element conformant to the XFA schema.
      • createElement

        public Element createElement​(String name)
        Creates an element with the given name.
        name - the element's name. This string must be interned.
        a new element conformant to our schema.
      • createNode

        public abstract Node createNode​(int eTag,
                                        Element parent,
                                        String aName,
                                        String aNS,
                                        boolean bDoVersionCheck)
        Create an element with the given tag, parent, name and uri.
        eTag - the element's tag.
        parent - the element's parent.
        aName - the element's name.
        aNS - the element's namespace.
        bDoVersionCheck - check the element's version.
        a new element.
      • createTextNode

        public final TextNode createTextNode​(Element parent,
                                             Node prevSibling,
                                             char[] ch,
                                             int start,
                                             int length)
      • createTextNode

        public final TextNode createTextNode​(Element parent,
                                             Node prevSibling,
                                             String text)
        Creates a text node with the given text.
        parent - the node's parent, if any.
        prevSibling - the node's previous sibling, if any.
        text - the node's text.
        a new node conformant to our schema.
      • getAliasNode

        public final Element getAliasNode()
        Returns the node that is represented by the alias for this model. The returned model is normally the model itself, but not always. For example, while $template refers to the template model, by default, $data refers to the first child of the data model.
        an Node that corresponds to the alias for this model.
      • getAppModelIsTransient

        public boolean getAppModelIsTransient()
      • getBaseNS

        public abstract String getBaseNS()
      • getCachedLocale

        public String getCachedLocale()
      • getContext

        public final Node getContext()
        Retrieves the current node, which is the starting node for calls to resolveNode() and resolveNodes()
        The current node.
      • getCurrentVersion

        public int getCurrentVersion()
        Gets the current version of this model.
        the version number (times 10).
      • getDeltas

        public Obj getDeltas​(Node oNode)
      • getDocument

        public final Document getDocument()
        Returns this model's document.
        the document node.
      • getErrorContextList

        public List<Element> getErrorContextList()
        Gets all the context nodes that correspond to entries in the error list.
        A list of Element objects where the load discovered a problem.
      • getErrorList

        public List<ExFull> getErrorList()
        Gets all the errors that have been generated by this model since the last method call to clear the error list. Note that these are not fatal errors. They are typically syntax problems discovered when loading the collateral. Some applications may choose to sift through the list and stop processing if they recognize specific problems. However most applications should simply dump the messages into the log file and continue processing. i.e. treat this as a list of warnings.
        the current list of ExFull error objects.
      • getEventManager

        public EventManager getEventManager()
        the EventManager manages xfe:script scripts and their associated events (ie. events that cause the scripts to execute)
      • getGenerator

        public Generator getGenerator()
      • getHeadNS

        public abstract String getHeadNS()
      • getHeadVersion

        public int getHeadVersion()
      • getIDValueMap

        public IDValueMap getIDValueMap()
      • getLegacySetting

        public boolean getLegacySetting​(AppModel.LegacyMask nLegacyFlag)
        Gets the boolean value of a particular legacy setting.
        nLegacyFlag - the specific legacy setting to check
        true if the legacy setting is set, or is the default the original version.
      • getLogMessenger

        public LogMessenger getLogMessenger()
        Retrieves the log messenger associated with this model.
        The log messenger.
      • getName

        public final String getName()
        Description copied from class: Element
        Gets this element's name.

        The name of an element is the value of its name attribute, or the element name if there is no name attribute.

        getName in class Element
        the name of the element.
        See Also:
      • getNeedsNSNormalize

        public boolean getNeedsNSNormalize()
      • getNode

        public Element getNode​(String aID)
        Look up an XFA ID. Since XFA IDs are only guaranteed to be unique within the scope of their model (to prevent conflicts with customer-controlled data), the lookup is done by namespace.

        Note: jfDomDocument::getElementByXFAId handles the conversion of versioned model namespace strings to unversioned ones.

        aID - The node id
        The node if found, null if not found.
      • getOriginalVersion

        public String getOriginalVersion​(boolean bDefault)
      • getOriginalVersionNode

        public ProcessingInstruction getOriginalVersionNode​(boolean bCreate,
                                                            String sValue)
        Get the processing instruction that holds our version number.
        bCreate - - if true, create the PI if it doesn't exist
        sValue - - the value to use for the PI if we create it
        the version node PI
      • getProtoList

        public List<ProtoableNode> getProtoList()
        Keep track of proto Nodes and 'use' tags for quick lookup later our
        our list of protos
      • getSchema

        public final Schema getSchema()
        Return the schema definition for this model.
        a class derived from Schema
      • getSourceBelow

        public int getSourceBelow()
      • getVersion

        public int getVersion​(String sNS)
      • isCompatibleNS

        public boolean isCompatibleNS​(String aNS)
        Determine if a specified namespace string is compatible with the namespace of this model. Essentially this determines if the two namespaces are equivalent (though the strings that represent them may not be identical).
        aNS - The namespace to compare.
      • isContainer

        public final boolean isContainer()
        Description copied from class: Node
        Check to see if this is a container object. A container is defined as something that is not a leaf node not properties ( [0..1] occurrences ). It does NOT indicate whether this node derives from XFAContainer
        isContainer in class Element
        true if this node is a container, false otherwise
      • isLoading

        public final boolean isLoading()
      • isVersionCompatible

        public boolean isVersionCompatible​(int nVersion,
                                           int nTargetVersion)
      • loadSpecialAttribute

        public boolean loadSpecialAttribute​(Attribute attr,
                                            String aLocalName,
                                            Element element,
                                            boolean bCheckOnly)
        loadSpecialAttribute should be called by the loadNode method. It scans for special attributes. Currently it only looks for event-related attributes (for automatic execution of script). The bCheckOnly flag can be set to TRUE to cause this routine to do nothing except return whether or not the attribute would be handled.
        true if the attribute is handled
      • loadSpecialNode

        public boolean loadSpecialNode​(Element parent,
                                       Node node,
                                       boolean bCheckOnly)
        loadSpecialNode should be called by the loadNode method. It checks for special nodes. Currently it only looks for event-related nodes (for automatic execution of script).
        true if the node is handled
      • loadRootAttributes

        public boolean loadRootAttributes()
      • modelCleanup

        public void modelCleanup​(Node node)
      • nodeCleanup

        public void nodeCleanup​(Node pNode,
                                boolean bHasAttrs,
                                boolean bHasChildren)
      • doAttributeCleanup

        public boolean doAttributeCleanup​(Node node,
                                          int eAttributeTag,
                                          String sAttrValue)
        Return TRUE if the given attribute can be removed, aka cleaned up from a given node. Return FALSE otherwise.
      • normalizeNameSpaces

        public void normalizeNameSpaces()
      • normalizeNameSpaces

        public void normalizeNameSpaces​(Element poNode,
                                        String aURI)
        Helper function for normalizeNameSpaces().
        poNode - the node to normalize.
        aURI - the new namespace.
      • normalizeNameSpaces

        public boolean normalizeNameSpaces​(int nTargetVersion,
                                           List<NodeValidationInfo> oResult)
        Walks through the XFA DOM and normalizes the namespaces of all the nodes.
        nTargetVersion - the version of the schema desired. One of XFAVERSION_10, ... XFAVERSION_HEAD.
        oResult - a list of NodeValidationInfo objects: invalid children, attributes and attribute values based upon the target version. If this model is not a valid child of its parent, this model will be the first entry of oResult. If oResult is not null, this method will ensure all child nodes attributes and attribute values are valid for given the target version.
        true if successful, else false.
      • preLoadNode

        public Node preLoadNode​(Element parent,
                                Node node,
                                Generator genTag)
        Preprocess the node. The node may be removed.
        the next XML sibling to be processed, or null if all siblings have been processed.
      • publish

        public boolean publish​(Model.Publisher publisher)
        Publish the model to an Application Storage facility. This involves updating all external references (such as image hrefs) such that they point to local collateral. The actual details of this are left up to the implementer of the class derived from Model.Publisher specified in the oPublisher parameter. What publish() itself does is recursively traverse the tree structure of the model. When an external reference is encountered (for example, the href attribute of an image node), the updateExternalRef() method is called. The node, attribute identifier and original value of the external reference are passed to updateExternalRef(). The derived class should copy the collateral to the application storage area (if desired), and should update the value of sExternalRefValue to indicate the new value for the external reference (probably some sort of relative path). If an external reference stored as an element value (for example, a uri node) is encountered, updateExternalRef is called with node and the eAttribute arg is set to XFA.TEXTNODETAG. Two or more instances of an identical external reference result in only one call to updateExternalRef(), because returned values are cached and reused. If called on the AppModel, this method recursively calls publish on all contained models.
        publisher - an instance of a class derived from TemplateModel.Publisher.
      • ready

        public boolean ready​(boolean bForced)
        Indicates that the model is ready. This causes the "ready" event to be issued so that script waiting on that event will execute. When applied to an AppModel, this call recursively calls ready() on each child model (as a convenience). Some applications may choose to call the ready() on each model individually. Calling ready() a second time on a given model has no effect.
        true if ready scripts fire
      • remove

        public void remove()
        Description copied from class: Node
        Removes this node from its parent child list.
        remove in class Node
        See Also:
      • removeReferences

        public void removeReferences​(Node node)
        remove references to a given node.
      • remapTag

        public int remapTag​(int eTag)
        Remap a given tag to a new value. This gives a model a chance to remap a tag to a new value after it's determined that the original wasn't valid in the current context. The default implementation returns the input tag, which is a no-op.
        eTag - the original input tag.
        the new remapped tag.
      • resolveProtos

        public void resolveProtos​(boolean bForceExternalProtoResolve)
      • setAliasNode

        public final void setAliasNode​(Element aliasNode)
        Specify the node that is represented by the alias for this model.
        aliasNode - The node that will represent this model.
      • setAppModel

        public void setAppModel​(AppModel pNewModel)
        pNewModel -
      • setAppModelIsTransient

        public void setAppModelIsTransient​(boolean bAppModelIsTransient)
      • setContext

        public void setContext​(Node node)
        Specifies the current node, which is the starting node for calls to resolveNode and resolveNodes.
        node - the new current node.

        resolveNode and resolveNodes differ from Node.resolveNode() and Node.resolveNodes() in that the current node is the node set via setContext(), instead of "this" node.

      • setCurrentVersion

        public void setCurrentVersion​(int nVersion)
      • setIDValueMap

        public void setIDValueMap​(IDValueMap idValueMap)
      • setName

        public final void setName​(String name)
        Set the name for this model
        setName in class Element
        name - the model name
      • setNeedsNSNormalize

        public void setNeedsNSNormalize​(boolean bNormalize)
      • shortCutName

        public String shortCutName()
      • validateUsage

        public boolean validateUsage​(int nXFAVersion,
                                     int nAvailability,
                                     boolean bUpdateVersion)
        Description copied from class: Obj
        Validate if the given Version and Availability flags are valid for the current document
        validateUsage in class Node
        nXFAVersion - The target XFA Version
        nAvailability - The target Availability flags, this indicates for what clients the script is available
        bUpdateVersion - indicates if the model version can be updated by the calling code
        if true, Version and Availability flags are valid
        See Also:
        Node.validateUsage(int, int, boolean)
      • validateUsageFailedIsFatal

        public boolean validateUsageFailedIsFatal​(int nXFAVersion,
                                                  int nAvailability)
        Description copied from class: Obj
        Determines if disallowing a version should be considered a fatal error.

        This method is called after calling Obj.validateUsage(int, int, boolean) when that method returns false.

        validateUsageFailedIsFatal in class Node
        nXFAVersion - The target XFA Version
        nAvailability - The target Availability flags, this indicates for what clients the script is available
        true if disallowing nVersion should be considered a fatal error
        See Also:
        Node.validateUsageFailedIsFatal(int, int)
      • willDirtyDoc

        public void willDirtyDoc​(boolean bWillDirty)
      • willDirtyDoc

        public boolean willDirtyDoc()
      • getOriginalXFAVersion

        public int getOriginalXFAVersion()
      • setOriginalXFAVersion

        public void setOriginalXFAVersion​(int nXFAVersion)