Class ConfigurationModel

  • All Implemented Interfaces:
    Element.DualDomNode, Peer

    public final class ConfigurationModel
    extends Model
    A class to model the collection of all XFA nodes that make up form config.
    • Constructor Detail

      • ConfigurationModel

        public ConfigurationModel​(Element parent,
                                  Node prevSibling)
        Default Constructor.
    • Method Detail

      • createNode

        public Node createNode​(int eTag,
                               Element parent,
                               java.lang.String aName,
                               java.lang.String aNS,
                               boolean bDoVersionCheck)
        Description copied from class: Model
        Create an element with the given tag, parent, name and uri.
        Specified by:
        createNode in class Model
        Parameters:
        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.
        Returns:
        a new element.
        See Also:
        Model.createNode(int, Element, String, String, boolean)
      • getHeadNS

        public java.lang.String getHeadNS()
        Specified by:
        getHeadNS in class Model
      • getConfigurationModel

        public static ConfigurationModel getConfigurationModel​(AppModel appModel,
                                                               boolean bCreateIfNotFound)
        Gets the configuration model held within an XFA DOM hierarchy.
        Parameters:
        appModel - the application model.
        bCreateIfNotFound - when set, create a model if necessary.
        Returns:
        the configuration model or null if none found.
      • configurationNS

        public static java.lang.String configurationNS()
        Namespace
        Returns:
        The configuration namespace URI string
      • getNS

        public java.lang.String getNS()
        Description copied from class: Element
        Gets this element's namespace.
        Overrides:
        getNS in class Model
        Returns:
        the namespace URI.
        See Also:
        Element.getNS()
      • getConfigValue

        public Attribute getConfigValue​(java.lang.String sSOM,
                                        BooleanHolder isDefault)
        Gets the value of a configuration value node.

        If the node doesn't exist, the default value will be returned.

        Parameters:
        sSOM - A SOM expression specifying the configuration value node.
        isDefault - a scalar which is set to true if the node exists, and false if the node does not exist and the value returned is a default value.
        Returns:
        the retrieved attribute.
      • getConfigValue

        public boolean getConfigValue​(java.lang.String sSOM,
                                      java.lang.StringBuilder sValue)
        Gets the value of a configuration value node.

        If the node doesn't exist, the default value will be returned.

        Parameters:
        sSOM - A SOM expression specifying the configuration value node.
        sValue - The retrieved value.
        Returns:
        true if the node exists, and false if the node does not exist and the value returned is a default value.
      • getCommonNode

        public Element getCommonNode​(java.lang.String sSchemaName)
        Retrieve the common ConfigurationKey node. For a particular schema root. The schema root must have the common property child.
        Parameters:
        sSchemaName - The name of the root of the schema.
        Returns:
        The common ConfigurationKey, null if common is not a valid property of the root node.
      • createElement

        public Element createElement​(Element parent,
                                     Node prevSibling,
                                     java.lang.String uri,
                                     java.lang.String localName,
                                     java.lang.String qName,
                                     org.xml.sax.Attributes attributes,
                                     int lineNumber,
                                     java.lang.String fileName)
        Create an element based on the parameters provided by the SAX handler.
        Overrides:
        createElement in class Model
        Parameters:
        uri - namespace for this element.
        localName - local name for this element.
        qName - qualified name for this element.
        attributes - structure containing attribute definitions.
        parent - the element's parent, if any.
        prevSibling - the element's previous sibling, if any.
        Returns:
        a new Element created according to our schema.
      • 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. This implementation simply returns XFA.CONFIGURATIONKEYTAG. It should be clever enough to determine either KEY or VALUE in the same way that XFAConfigurationModelImpl::getNodeType does on the C++ side, but that's not possible here due to the single DOM. Post-load fix-ups should recategorize this KEY to a VALUE when necessary.
        Overrides:
        remapTag in class Model
        Parameters:
        eTag - the original input tag.
        Returns:
        the new remapped tag.
      • publish

        public boolean publish​(Model.Publisher publisher)
        Description copied from class: Model
        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.
        Overrides:
        publish in class Model
        Parameters:
        publisher - an instance of a class derived from TemplateModel.Publisher.
        See Also:
        Model.publish(com.adobe.xfa.Model.Publisher)