Package io.guise.framework.platform
Class AbstractXHTMLDepictContext
java.lang.Object
com.globalmentor.beans.BoundPropertyObject
io.guise.framework.platform.AbstractDepictContext
io.guise.framework.platform.AbstractTextDepictContext
io.guise.framework.platform.AbstractXMLDepictContext
io.guise.framework.platform.AbstractXHTMLDepictContext
- All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,DepictContext
,TextDepictContext
,XHTMLDepictContext
,XMLDepictContext
- Direct Known Subclasses:
AbstractWebDepictContext
public abstract class AbstractXHTMLDepictContext
extends AbstractXMLDepictContext
implements XHTMLDepictContext
Abstract encapsulation of
application/xhtml+xml
information related to the current depiction.
This implementation maps the XHTML namespace HTML.XHTML_NAMESPACE_URI
to the null
prefix.
- Author:
- Garret Wilson
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.guise.framework.platform.XMLDepictContext
XMLDepictContext.ElementState
-
Field Summary
Fields inherited from class com.globalmentor.beans.BoundPropertyObject
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
Fields inherited from interface io.guise.framework.platform.XHTMLDepictContext
CSS_PROPERTY_BORDER_X_COLOR_TEMPLATE, CSS_PROPERTY_BORDER_X_STYLE_TEMPLATE, CSS_PROPERTY_BORDER_X_WIDTH_TEMPLATE, CSS_PROPERTY_BORDER_X_Y_RADIUS_TEMPLATE, CSS_PROPERTY_MARGIN_X_TEMPLATE, CSS_PROPERTY_PADDING_X_TEMPLATE, CSS_SIDES
-
Constructor Summary
ConstructorDescriptionAbstractXHTMLDepictContext
(GuiseSession session, Destination destination) Guise session constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected <A extends Appendable>
AappendAttributeName
(A appendable, com.globalmentor.xml.spec.NsQualifiedName attributeQualifiedName) Appends an attribute name to the given appendable.boolean
Returns whether all non-default-namespace attributes are encoded at HTML5 data attributes.boolean
isDataAttributeNamespaceURI
(URI namespaceURI) Determines whether the given namespace URI should be represented as an HTML5 data attribute.void
registerDataAttributeNamespaceURI
(URI namespaceURI) Registers a namespace URI to be represented as an HTML5 data attribute.void
setAllDataAttributes
(boolean dataAttributesEnabled) Sets whether all non-default-namespace attributes are encoded at HTML5 data attributes.writeJavaScriptElement
(URI javascriptURI) Generates a JavaScript element that references the given URI.writeMetaElement
(String property, String content) Generates a meta element suitable for the head of an XHTML document.writeMetaElement
(URI propertyNamespaceURI, String propertyLocalName, String content) 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.Methods inherited from class io.guise.framework.platform.AbstractXMLDepictContext
appendAttribute, appendAttributeValue, clearDepictText, encode, getAttributeHashAttributeQualifiedName, getAttributeValue, getContentHashAttributeQualifiedName, getDepictStringBuilder, getMessageDigest, getQualifiedName, getXMLNamespacePrefixManager, isHashAttributesGenerated, setHashAttributesGenerated, writeAttribute, writeComment, writeCommentClose, writeCommentOpen, writeDocType, writeDocType, writeDocType, writeDocType, writeElementBegin, writeElementBegin, writeElementEnd
Methods inherited from class io.guise.framework.platform.AbstractTextDepictContext
getDepictText, getIndentLevel, indent, indent, isFormatted, setIndentLevel, unindent, write, write, writeIndent, writeLiteral
Methods inherited from class io.guise.framework.platform.AbstractDepictContext
getDepictionURI, getDepictionURI, getDestination, getPlatform, getSession, getStyles
Methods inherited from class com.globalmentor.beans.BoundPropertyObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.guise.framework.platform.DepictContext
getDepictionURI, getDepictionURI, getDepictionURI, getDestination, getPlatform, getSession, getStyles
Methods inherited from interface com.globalmentor.beans.PropertyBindable
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from interface io.guise.framework.platform.TextDepictContext
clearDepictText, getDepictStringBuilder, getDepictText, getIndentLevel, getOutputCharset, getOutputContentType, indent, indent, isFormatted, setIndentLevel, setOutputContentType, unindent, write, write, writeIndent, writeLiteral
Methods inherited from interface io.guise.framework.platform.XMLDepictContext
getQualifiedName, writeAttribute, writeComment, writeCommentClose, writeCommentOpen, writeDocType, writeDocType, writeDocType, writeDocType, writeElementBegin, writeElementBegin, writeElementEnd
-
Constructor Details
-
AbstractXHTMLDepictContext
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:
NullPointerException
- if the given session and/or destination is null.IOException
- If there was an I/O error loading a needed resource.
-
-
Method Details
-
registerDataAttributeNamespaceURI
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 formexample:fooBar
will be depicted asdata-example-foobar
.- Specified by:
registerDataAttributeNamespaceURI
in interfaceXHTMLDepictContext
- Parameters:
namespaceURI
- The namespace URI to register.
-
isDataAttributeNamespaceURI
Description copied from interface:XHTMLDepictContext
Determines whether the given namespace URI should be represented as an HTML5 data attribute.- Specified by:
isDataAttributeNamespaceURI
in interfaceXHTMLDepictContext
- Parameters:
namespaceURI
- The namespace URI to check.- Returns:
true
if the given namespace URI should be represented as an HTML5 data attribute.
-
isAllDataAttributes
public boolean isAllDataAttributes()Description copied from interface:XHTMLDepictContext
Returns whether all non-default-namespace attributes are encoded at HTML5 data attributes. This setting overridesXHTMLDepictContext.isDataAttributeNamespaceURI(URI)
.- Specified by:
isAllDataAttributes
in interfaceXHTMLDepictContext
- Returns:
- Whether all non-default-namespace attributes are encoded at HTML5 data attributes.
-
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 formexample:fooBar
will be depicted asdata-example-foobar
.If set to
true
, the setting ofXHTMLDepictContext.isDataAttributeNamespaceURI(URI)
is ignored.- Specified by:
setAllDataAttributes
in interfaceXHTMLDepictContext
- Parameters:
dataAttributesEnabled
- Whether non-XHTML-namespace attributes are encoded at HTML5 data attributes.
-
appendAttributeName
protected <A extends Appendable> A appendAttributeName(A appendable, com.globalmentor.xml.spec.NsQualifiedName attributeQualifiedName) throws 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 asdata-example-foobar
. "xmlns" namespace attribute will never be converted.- Overrides:
appendAttributeName
in classAbstractXMLDepictContext
- 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:
IOException
- if there is a problem appending the attribute information.- See Also:
-
writeJavaScriptElement
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 interfaceXHTMLDepictContext
- Parameters:
javascriptURI
- The application-relative IRO to the JavaScript file.- Returns:
- The state of the element written.
- Throws:
IOException
- if there is an error writing the information.
-
writeMetaElement
public XMLDepictContext.ElementState writeMetaElement(String property, String content) throws IOException Description copied from interface:XHTMLDepictContext
Generates a meta element suitable for the head of an XHTML document.- Specified by:
writeMetaElement
in interfaceXHTMLDepictContext
- Parameters:
property
- The meta property name.content
- The meta property content.- Returns:
- The state of the element written.
- Throws:
IOException
- if there is an error writing the information.
-
writeMetaElement
public XMLDepictContext.ElementState writeMetaElement(URI propertyNamespaceURI, String propertyLocalName, String content) throws 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 interfaceXHTMLDepictContext
- Parameters:
propertyNamespaceURI
- The URI of the XML namespace of the meta property name, ornull
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:
IOException
- if there is an error writing the information.
-