Class AbstractXHTMLDepictContext

    • Constructor Detail

      • AbstractXHTMLDepictContext

        public AbstractXHTMLDepictContext​(GuiseSession session,
                                          Destination destination)
                                   throws java.io.IOException
        Guise session constructor.
        Parameters:
        session - The Guise user session of which this context is a part.
        destination - The destination with which this context is associated.
        Throws:
        java.lang.NullPointerException - if the given session and/or destination is null.
        java.io.IOException - If there was an I/O error loading a needed resource.
    • Method Detail

      • registerDataAttributeNamespaceURI

        public void registerDataAttributeNamespaceURI​(java.net.URI namespaceURI)
        Description copied from interface: XHTMLDepictContext
        Registers a namespace URI to be represented as an HTML5 data attribute. Any attribute in this namespace will be converted to lowercase and presented as an HTML5 attribute. For example, an attribute in the form example:fooBar will be depicted as data-example-foobar.
        Specified by:
        registerDataAttributeNamespaceURI in interface XHTMLDepictContext
        Parameters:
        namespaceURI - The namespace URI to register.
      • isDataAttributeNamespaceURI

        public boolean isDataAttributeNamespaceURI​(java.net.URI namespaceURI)
        Description copied from interface: XHTMLDepictContext
        Determines whether the given namespace URI should be represented as an HTML5 data attribute.
        Specified by:
        isDataAttributeNamespaceURI in interface XHTMLDepictContext
        Parameters:
        namespaceURI - The namespace URI to check.
        Returns:
        true if the given namespace URI should be represented as an HTML5 data attribute.
      • setAllDataAttributes

        public void setAllDataAttributes​(boolean dataAttributesEnabled)
        Description copied from interface: XHTMLDepictContext
        Sets whether all non-default-namespace attributes are encoded at HTML5 data attributes. If this setting is enabled, any non-default-namespace attribute will be converted to lowercase and presented as an HTML5 attribute. For example, an attribute in the form example:fooBar will be depicted as data-example-foobar.

        If set to true, the setting of XHTMLDepictContext.isDataAttributeNamespaceURI(URI) is ignored.

        Specified by:
        setAllDataAttributes in interface XHTMLDepictContext
        Parameters:
        dataAttributesEnabled - Whether non-XHTML-namespace attributes are encoded at HTML5 data attributes.
      • appendAttributeName

        protected <A extends java.lang.Appendable> A appendAttributeName​(A appendable,
                                                                         com.globalmentor.xml.QualifiedName attributeQualifiedName)
                                                                  throws java.io.IOException
        Appends an attribute name to the given appendable.

        This implementation appends the attribute qname.

        If HTML5 data attributes are enabled for all attributes or for the given namespace, this implementation converts non-XHTML-namespace attributes into HTML data attribute form. For example, an attribute in the form example:fooBar will be depicted as data-example-foobar. "xmlns" namespace attribute will never be converted.

        Overrides:
        appendAttributeName in class AbstractXMLDepictContext
        Type Parameters:
        A - The type of the appendable.
        Parameters:
        appendable - The appendable to which the attribute should be appended.
        attributeQualifiedName - The qualified name of the attribute.
        Returns:
        The given appendable.
        Throws:
        java.io.IOException - if there is a problem appending the attribute information.
        See Also:
        HTML 5 Data Attributes, isAllDataAttributes(), isDataAttributeNamespaceURI(URI)
      • writeJavaScriptElement

        public XMLDepictContext.ElementState writeJavaScriptElement​(java.net.URI javascriptURI)
                                                             throws java.io.IOException
        Description copied from interface: XHTMLDepictContext
        Generates a JavaScript element that references the given URI. The given URI is resolved to the application path.
        Specified by:
        writeJavaScriptElement in interface XHTMLDepictContext
        Parameters:
        javascriptURI - The application-relative IRO to the JavaScript file.
        Returns:
        The state of the element written.
        Throws:
        java.io.IOException - if there is an error writing the information.
      • writeMetaElement

        public XMLDepictContext.ElementState writeMetaElement​(java.lang.String property,
                                                              java.lang.String content)
                                                       throws java.io.IOException
        Description copied from interface: XHTMLDepictContext
        Generates a meta element suitable for the head of an XHTML document.
        Specified by:
        writeMetaElement in interface XHTMLDepictContext
        Parameters:
        property - The meta property name.
        content - The meta property content.
        Returns:
        The state of the element written.
        Throws:
        java.io.IOException - if there is an error writing the information.
      • writeMetaElement

        public XMLDepictContext.ElementState writeMetaElement​(java.net.URI propertyNamespaceURI,
                                                              java.lang.String propertyLocalName,
                                                              java.lang.String content)
                                                       throws java.io.IOException
        Description copied from interface: XHTMLDepictContext
        Generates a meta element suitable for the head of an XHTML document, creating a qualified name or the meta property based upon the given namespace URI and local name.
        Specified by:
        writeMetaElement in interface XHTMLDepictContext
        Parameters:
        propertyNamespaceURI - The URI of the XML namespace of the meta property name, or null if there is no namespace.
        propertyLocalName - The local name of the meta property name with no prefix.
        content - The meta property content.
        Returns:
        The state of the element being written.
        Throws:
        java.io.IOException - if there is an error writing the information.