Package io.guise.framework.platform.web
Class AbstractWebDepictContext
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
io.guise.framework.platform.web.AbstractWebDepictContext
- All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,DepictContext
,TextDepictContext
,WebDepictContext
,XHTMLDepictContext
,XMLDepictContext
- Direct Known Subclasses:
HTTPServletWebDepictContext
public abstract class AbstractWebDepictContext
extends AbstractXHTMLDepictContext
implements WebDepictContext
Abstract implementation of information related to the current depiction on the web platform.
This implementation maps the XHTML namespace WebPlatform.GUISE_ML_NAMESPACE_URI
to the prefix "guise".
This implementation maps the XHTML namespace OpenGraph.NAMESPACE_URI
to the prefix "og".
This implementation defaults to not using quirks mode.
- 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
ConstructorsConstructorDescriptionAbstractWebDepictContext
(GuiseSession session, Destination destination) Guise session constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected static StringBuilder
appendCSSValue
(StringBuilder stringBuilder, Extent extent) Appends a CSS string representation of the given extent.protected static StringBuilder
appendCSSValue
(StringBuilder stringBuilder, Cursor cursor, Orientation orientation) Appends a CSS string representation of the given cursor.protected static StringBuilder
appendCSSValue
(StringBuilder stringBuilder, Color color) Appends a CSS string representation of the given color.protected static StringBuilder
appendCSSValue
(StringBuilder stringBuilder, FontStyle fontStyle) Appends a CSS string representation of the given font style.protected static StringBuilder
appendCSSValue
(StringBuilder stringBuilder, LineStyle lineStyle) Appends a CSS string representation of the given line style, such as used for a border style.protected StringBuilder
appendCSSValue
(StringBuilder stringBuilder, Object value, Orientation orientation) Appends a CSS value to the given string builder.protected StringBuilder
appendCSSValue
(StringBuilder stringBuilder, URI uri) Appends a CSS string representation of the given URI.protected static StringBuilder
appendCSSValue
(StringBuilder stringBuilder, List<?> items) Appends a CSS string containing the given list of items.getCSSStyleString
(Map<String, Object> styles, Orientation orientation) Returns a string representation of the provided style declarations.boolean
Methods inherited from class io.guise.framework.platform.AbstractXHTMLDepictContext
appendAttributeName, isAllDataAttributes, isDataAttributeNamespaceURI, registerDataAttributeNamespaceURI, setAllDataAttributes, writeJavaScriptElement, writeMetaElement, writeMetaElement
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, 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, 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.XHTMLDepictContext
isAllDataAttributes, isDataAttributeNamespaceURI, registerDataAttributeNamespaceURI, setAllDataAttributes, writeJavaScriptElement, writeMetaElement, writeMetaElement
Methods inherited from interface io.guise.framework.platform.XMLDepictContext
getQualifiedName, writeAttribute, writeComment, writeCommentClose, writeCommentOpen, writeDocType, writeDocType, writeDocType, writeDocType, writeElementBegin, writeElementBegin, writeElementEnd
-
Constructor Details
-
AbstractWebDepictContext
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
-
isQuirksMode
public boolean isQuirksMode()This implementation always returns
false
.- Specified by:
isQuirksMode
in interfaceWebDepictContext
- Returns:
- Whether quirks mode is being used.
-
getPlatform
- Specified by:
getPlatform
in interfaceDepictContext
- Specified by:
getPlatform
in interfaceWebDepictContext
- Overrides:
getPlatform
in classAbstractDepictContext
- Returns:
- The platform on which Guise objects are depicted.
-
getCSSStyleString
Description copied from interface:WebDepictContext
Returns a string representation of the provided style declarations. This method performs special processing on the following properties, including generating user-agent-specific styles to allow proper display on certain browsers:- "color" with a value of
Color
and an alpha less than 1.0. - "cursor" with a value of
URI
, interpreted as a predefined cursor (one ofCursor.getURI()
) or as a URI to a custom cursor; URI references are allowed in either. - "display" with a value of "inline-block".
- "font-weight" with a value of
Number
, interpreted in terms ofPresentationModel.FONT_WEIGHT_NORMAL
andPresentationModel.FONT_WEIGHT_BOLD
. - "max-width" or "max-height" with a pixel value of
Extent
. - "opacity" with a value of
Number
.
Color
Cursor
Extent
FontStyle
LineStyle
List
URI
with URI references allowed- An array of objects, each of which will be serialized and separated by spaces.
Object.toString()
.- Specified by:
getCSSStyleString
in interfaceWebDepictContext
- Parameters:
styles
- The map of styles to write, each keyed to a CSS style property.orientation
- The orientation of the component for which the style is being produced.- Returns:
- A string containing the given CSS properties and styles.
- "color" with a value of
-
appendCSSValue
protected StringBuilder appendCSSValue(StringBuilder stringBuilder, Object value, Orientation orientation) Appends a CSS value to the given string builder. If the value is an array of a non-primitive type, each element in the array will be appended separated by spaces.- Parameters:
stringBuilder
- The string builder to which the style value will be added.value
- The value to append.orientation
- The orientation of the component for which the style is being produced.- Returns:
- The provided string builder.
-
appendCSSValue
Appends a CSS string representation of the given color. This method correctly handles transparent colors with the special CSS keyword "transparent".- Parameters:
stringBuilder
- The string builder to which the style will be added.color
- The color to represent in CSS.- Returns:
- The provided string builder.
-
appendCSSValue
protected static StringBuilder appendCSSValue(StringBuilder stringBuilder, Cursor cursor, Orientation orientation) Appends a CSS string representation of the given cursor.- Parameters:
stringBuilder
- The string builder to which the style will be addedcursor
- The cursor to represent in CSS.orientation
- The orientation of the component for which the cursor is being set.- Returns:
- The provided string builder.
- Throws:
NullPointerException
- if the given cursor isnull
.
-
appendCSSValue
Appends a CSS string representation of the given extent.- Parameters:
stringBuilder
- The string builder to which the style will be addedextent
- The extent to be represented by a CSS length string.- Returns:
- The provided string builder.
-
appendCSSValue
Appends a CSS string representation of the given font style.- Parameters:
stringBuilder
- The string builder to which the style will be addedfontStyle
- The font style to represent in CSS.- Returns:
- The provided string builder.
- Throws:
NullPointerException
- if the given font style isnull
.
-
appendCSSValue
Appends a CSS string representation of the given line style, such as used for a border style.- Parameters:
stringBuilder
- The string builder to which the style will be addedlineStyle
- The line style to be represented in CSS.- Returns:
- The provided string builder.
- Throws:
NullPointerException
- if the given line style isnull
.
-
appendCSSValue
Appends a CSS string containing the given list of items. Strings containing spaces will be quoted. Items that arenull
will be represented by a missing item in the list.- Parameters:
stringBuilder
- The string builder to which the style will be addeditems
- The list of items to be converted to a string.- Returns:
- The provided string builder.
-
appendCSSValue
Appends a CSS string representation of the given URI. The URI will be dereferenced and resolved to the application as well as converted to a depict URI.- Parameters:
stringBuilder
- The string builder to which the style will be addeduri
- The URI to be represented in CSS.- Returns:
- The provided string builder.
- See Also:
-