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 ofapplication/xhtml+xml
information related to the current depiction.This implementation maps the XHTML namespace
HTML.XHTML_NAMESPACE_URI
to thenull
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
Constructors Constructor Description AbstractXHTMLDepictContext(GuiseSession session, Destination destination)
Guise session constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <A extends java.lang.Appendable>
AappendAttributeName(A appendable, com.globalmentor.xml.QualifiedName attributeQualifiedName)
Appends an attribute name to the given appendable.boolean
isAllDataAttributes()
Returns whether all non-default-namespace attributes are encoded at HTML5 data attributes.boolean
isDataAttributeNamespaceURI(java.net.URI namespaceURI)
Determines whether the given namespace URI should be represented as an HTML5 data attribute.void
registerDataAttributeNamespaceURI(java.net.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.XMLDepictContext.ElementState
writeJavaScriptElement(java.net.URI javascriptURI)
Generates a JavaScript element that references the given URI.XMLDepictContext.ElementState
writeMetaElement(java.lang.String property, java.lang.String content)
Generates a meta element suitable for the head of an XHTML document.XMLDepictContext.ElementState
writeMetaElement(java.net.URI propertyNamespaceURI, java.lang.String propertyLocalName, java.lang.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 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 formexample:fooBar
will be depicted asdata-example-foobar
.- Specified by:
registerDataAttributeNamespaceURI
in interfaceXHTMLDepictContext
- 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 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 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 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:
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 interfaceXHTMLDepictContext
- 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 interfaceXHTMLDepictContext
- 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 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:
java.io.IOException
- if there is an error writing the information.
-
-