public abstract class CSSEngine extends Object
Modifier and Type | Class and Description |
---|---|
protected class |
CSSEngine.CSSNavigableDocumentHandler
To handle mutations of a CSSNavigableDocument.
|
protected static class |
CSSEngine.DocumentAdapter
Provides an (empty) adapter for the DocumentHandler interface.
|
protected class |
CSSEngine.DOMAttrModifiedListener
To handle the element attributes modification in the associated
document.
|
protected class |
CSSEngine.DOMCharacterDataModifiedListener
To handle the modification of a CSSStyleSheetNode.
|
protected class |
CSSEngine.DOMNodeInsertedListener
To handle the insertion of a CSSStyleSheetNode in the
associated document.
|
protected class |
CSSEngine.DOMNodeRemovedListener
To handle the removal of a CSSStyleSheetNode from the
associated document.
|
protected class |
CSSEngine.DOMSubtreeModifiedListener
To handle the removal of a CSSStyleSheetNode from the
associated document.
|
static interface |
CSSEngine.MainPropertyReceiver
Interface for people interesting in having 'primary' properties
set.
|
protected class |
CSSEngine.StyleDeclarationBuilder
To build a StyleDeclaration object.
|
protected class |
CSSEngine.StyleDeclarationDocumentHandler
To parse a style declaration.
|
protected class |
CSSEngine.StyleDeclarationUpdateHandler
To parse a style declaration and update a StyleMap.
|
protected class |
CSSEngine.StyleSheetDocumentHandler
To parse a style sheet.
|
Modifier and Type | Field and Description |
---|---|
protected int[] |
ALL_PROPERTIES
Used to fire a change event for all the properties.
|
protected String |
alternateStyleSheet
The alternate stylesheet title.
|
protected String |
classLocalName
The class attribute local name.
|
protected String |
classNamespaceURI
The class attribute namespace URI.
|
protected int |
colorIndex
The color property index.
|
protected org.apache.batik.util.ParsedURL |
cssBaseURI
The current base URI.
|
protected org.apache.batik.css.engine.sac.CSSConditionFactory |
cssConditionFactory
The CSS condition factory.
|
protected org.apache.batik.css.engine.CSSContext |
cssContext
The CSS context.
|
protected CSSEngine.CSSNavigableDocumentHandler |
cssNavigableDocumentListener
Listener for CSSNavigableDocument events.
|
protected Document |
document
The associated document.
|
protected org.apache.batik.util.ParsedURL |
documentURI
The document URI.
|
protected EventListener |
domAttrModifiedListener
The DOMAttrModified event listener.
|
protected EventListener |
domCharacterDataModifiedListener
The DOMCharacterDataModified event listener.
|
protected EventListener |
domNodeInsertedListener
The DOMNodeInserted event listener.
|
protected EventListener |
domNodeRemovedListener
The DOMNodeRemoved event listener.
|
protected EventListener |
domSubtreeModifiedListener
The DOMSubtreeModified event listener.
|
protected org.apache.batik.css.engine.CSSStylableElement |
element
The current element.
|
protected List |
fontFaces
List of StyleMap objects, one for each @font-face rule
encountered by this CSSEngine.
|
protected int |
fontSizeIndex
The font-size property index.
|
protected org.apache.batik.css.engine.StringIntMap |
indexes
The property/int mappings.
|
protected boolean |
isCSSNavigableDocument
Whether the document is a CSSNavigableDocument.
|
protected int |
lineHeightIndex
The line-height property index.
|
protected static org.apache.batik.css.engine.CSSEngineListener[] |
LISTENER_ARRAY |
protected List |
listeners
The listeners.
|
protected org.w3c.css.sac.SACMediaList |
media
The media to use to cascade properties.
|
protected Set |
nonCSSPresentationalHints
The non CSS presentational hints.
|
protected String |
nonCSSPresentationalHintsNamespaceURI
The non CSS presentational hints namespace URI.
|
protected org.apache.batik.css.parser.ExtendedParser |
parser
The CSS parser.
|
protected String[] |
pseudoElementNames
The pseudo-element names.
|
protected Node |
removedStylableElementSibling
The right sibling of the last removed node.
|
protected Set |
selectorAttributes
The attributes found in stylesheets selectors.
|
protected org.apache.batik.css.engine.StringIntMap |
shorthandIndexes
The shorthand-property/int mappings.
|
protected org.apache.batik.css.engine.value.ShorthandManager[] |
shorthandManagers
The shorthand managers.
|
protected CSSEngine.StyleDeclarationBuilder |
styleDeclarationBuilder
The style declaration document handler used to build a
StyleDeclaration object.
|
protected CSSEngine.StyleDeclarationDocumentHandler |
styleDeclarationDocumentHandler
The style declaration document handler.
|
protected CSSEngine.StyleDeclarationUpdateHandler |
styleDeclarationUpdateHandler
The style declaration update handler.
|
protected String |
styleLocalName
The style attribute local name.
|
protected String |
styleNamespaceURI
The style attribute namespace URI.
|
protected CSSEngine.StyleSheetDocumentHandler |
styleSheetDocumentHandler
The style sheet document handler.
|
protected List |
styleSheetNodes
The DOM nodes which contains StyleSheets.
|
protected boolean |
styleSheetRemoved
Whether a style sheet as been removed from the document.
|
protected org.apache.batik.css.engine.CSSEngineUserAgent |
userAgent
The user agent used for showing error messages.
|
protected org.apache.batik.css.engine.StyleSheet |
userAgentStyleSheet
The user-agent style-sheet.
|
protected org.apache.batik.css.engine.StyleSheet |
userStyleSheet
The user style-sheet.
|
protected org.apache.batik.css.engine.value.ValueManager[] |
valueManagers
The value managers.
|
Modifier | Constructor and Description |
---|---|
protected |
CSSEngine(Document doc,
org.apache.batik.util.ParsedURL uri,
org.apache.batik.css.parser.ExtendedParser p,
org.apache.batik.css.engine.value.ValueManager[] vm,
org.apache.batik.css.engine.value.ShorthandManager[] sm,
String[] pe,
String sns,
String sln,
String cns,
String cln,
boolean hints,
String hintsNS,
org.apache.batik.css.engine.CSSContext ctx)
Creates a new CSSEngine.
|
Modifier and Type | Method and Description |
---|---|
void |
addCSSEngineListener(org.apache.batik.css.engine.CSSEngineListener l)
Adds a CSS engine listener.
|
protected void |
addEventListeners(EventTarget doc)
Adds event listeners to the document to track CSS changes.
|
protected void |
addMatchingRules(List rules,
org.apache.batik.css.engine.StyleSheet ss,
Element elt,
String pseudo)
Adds the rules matching the element/pseudo-element of given style
sheet to the list.
|
protected void |
addRules(Element elt,
String pseudo,
org.apache.batik.css.engine.StyleMap sm,
ArrayList rules,
short origin)
Adds the rules contained in the given list to a stylemap.
|
void |
dispose()
Disposes the CSSEngine and all the attached resources.
|
protected void |
disposeStyleMaps(Node node)
Removes the style maps from each CSSStylableElement in the document.
|
protected void |
findSelectorAttributes(Set attrs,
org.apache.batik.css.engine.StyleSheet ss)
Finds the selector attributes in the given stylesheet.
|
protected void |
findStyleSheetNodes(Node n)
An auxiliary method for getStyleSheets().
|
protected void |
firePropertiesChangedEvent(Element target,
int[] props)
Fires a CSSEngineEvent, given a list of modified properties.
|
org.apache.batik.css.engine.StyleMap |
getCascadedStyleMap(org.apache.batik.css.engine.CSSStylableElement elt,
String pseudo)
Returns the cascaded style of the given element/pseudo-element.
|
int |
getColorIndex()
Returns the color property index.
|
org.apache.batik.css.engine.value.Value |
getComputedStyle(org.apache.batik.css.engine.CSSStylableElement elt,
String pseudo,
int propidx)
Returns the computed style of the given element/pseudo for the
property corresponding to the given index.
|
org.apache.batik.util.ParsedURL |
getCSSBaseURI()
Returns the current base-url.
|
org.apache.batik.css.engine.CSSContext |
getCSSContext()
Returns the CSS context.
|
org.apache.batik.css.engine.CSSEngineUserAgent |
getCSSEngineUserAgent() |
protected static Node |
getCSSFirstChild(Node n)
Returns the CSS first child node of the given node.
|
protected static Node |
getCSSNextSibling(Node n)
Returns the CSS next sibling node of the given node.
|
static Node |
getCSSParentNode(Node n)
Returns the CSS parent node of the given node.
|
protected static Node |
getCSSPreviousSibling(Node n)
Returns the CSS previous sibling node of the given node.
|
Document |
getDocument()
Returns the document associated with this engine.
|
List |
getFontFaces()
Gets the StyleMaps generated by @font-face rules
encountered by this CSSEngine thus far.
|
int |
getFontSizeIndex()
Returns the font-size property index.
|
int |
getLineHeightIndex()
Returns the line-height property index.
|
int |
getNumberOfProperties()
Returns the number of properties.
|
static org.apache.batik.css.engine.CSSStylableElement |
getParentCSSStylableElement(Element elt)
Returns the next stylable parent of the given element.
|
int |
getPropertyIndex(String name)
Returns the property index, or -1.
|
String |
getPropertyName(int idx)
Returns the name of the property at the given index.
|
int |
getShorthandIndex(String name)
Returns the shorthand property index, or -1.
|
org.apache.batik.css.engine.value.ShorthandManager[] |
getShorthandManagers()
Returns the ShorthandManagers.
|
List |
getStyleSheetNodes()
Returns the document CSSStyleSheetNodes in a list.
|
org.apache.batik.css.engine.value.ValueManager[] |
getValueManagers()
Returns the ValueManagers.
|
protected void |
handleAttrModified(Element e,
Attr attr,
short attrChange,
String prevValue,
String newValue)
Handles an attribute change in the document.
|
protected void |
handleCharacterDataModified(Node n)
Handles a character data modification in the document.
|
protected void |
handleNodeInserted(Node n)
Handles a node insertion in the document.
|
protected void |
handleNodeRemoved(Node n)
Handles a node removal from the document.
|
protected void |
handleSubtreeModified(Node ignored)
Handles a subtree modification in the document.
|
protected boolean |
hasStyleSheetNode(Node n)
Returns whether the DOM subtree rooted at the specified node
contains a
CSSStyleSheetNode . |
void |
importCascadedStyleMaps(Element src,
CSSEngine srceng,
Element dest)
Recursively imports the cascaded style from a source element
to an element of the current document.
|
protected void |
inlineStyleAttributeUpdated(org.apache.batik.css.engine.CSSStylableElement elt,
org.apache.batik.css.engine.StyleMap style,
short attrChange,
String prevValue,
String newValue)
Called when the inline style of the given element has been updated.
|
protected void |
invalidateProperties(Node node,
int[] properties,
boolean[] updated,
boolean recascade)
Invalidates all the properties of the given node.
|
protected boolean |
mediaMatch(org.w3c.css.sac.SACMediaList ml)
Whether the given media list matches the media list of this
CSSEngine object.
|
protected void |
nonCSSPresentationalHintUpdated(org.apache.batik.css.engine.CSSStylableElement elt,
org.apache.batik.css.engine.StyleMap style,
String property,
short attrChange,
String newValue)
Called when a non-CSS presentational hint has been updated.
|
org.apache.batik.css.engine.value.Value |
parsePropertyValue(org.apache.batik.css.engine.CSSStylableElement elt,
String prop,
String value)
Parses and creates a property value from elt.
|
org.apache.batik.css.engine.StyleDeclaration |
parseStyleDeclaration(org.apache.batik.css.engine.CSSStylableElement elt,
String value)
Parses and creates a style declaration.
|
org.apache.batik.css.engine.StyleSheet |
parseStyleSheet(org.w3c.css.sac.InputSource is,
org.apache.batik.util.ParsedURL uri,
String media)
Parses and creates a new style-sheet.
|
org.apache.batik.css.engine.StyleSheet |
parseStyleSheet(org.apache.batik.util.ParsedURL uri,
String media)
Parses and creates a new style-sheet.
|
org.apache.batik.css.engine.StyleSheet |
parseStyleSheet(String rules,
org.apache.batik.util.ParsedURL uri,
String media)
Parses and creates a new style-sheet.
|
protected void |
parseStyleSheet(org.apache.batik.css.engine.StyleSheet ss,
org.w3c.css.sac.InputSource is,
org.apache.batik.util.ParsedURL uri)
Parses and fills the given style-sheet.
|
void |
parseStyleSheet(org.apache.batik.css.engine.StyleSheet ss,
org.apache.batik.util.ParsedURL uri)
Parses and fills the given style-sheet.
|
void |
parseStyleSheet(org.apache.batik.css.engine.StyleSheet ss,
String rules,
org.apache.batik.util.ParsedURL uri)
Parses and fills the given style-sheet.
|
protected void |
propagateChanges(Node node,
int[] props,
boolean recascade)
Propagates the changes that occurs on the parent of the given node.
|
protected void |
putAuthorProperty(org.apache.batik.css.engine.StyleMap dest,
int idx,
org.apache.batik.css.engine.value.Value sval,
boolean imp,
short origin)
Puts an author property from a style-map in another style-map,
if possible.
|
void |
removeCSSEngineListener(org.apache.batik.css.engine.CSSEngineListener l)
Removes a CSS engine listener.
|
protected void |
removeEventListeners(EventTarget doc)
Removes the event listeners from the document.
|
void |
setAlternateStyleSheet(String str)
Sets the alternate style-sheet title.
|
void |
setCSSEngineUserAgent(org.apache.batik.css.engine.CSSEngineUserAgent userAgent) |
void |
setMainProperties(org.apache.batik.css.engine.CSSStylableElement elt,
CSSEngine.MainPropertyReceiver dst,
String pname,
String value,
boolean important) |
void |
setMedia(String str)
Sets the media to use to compute the styles.
|
void |
setUserAgentStyleSheet(org.apache.batik.css.engine.StyleSheet ss)
Sets the user agent style-sheet.
|
void |
setUserStyleSheet(org.apache.batik.css.engine.StyleSheet ss)
Sets the user style-sheet.
|
protected void |
sortRules(ArrayList rules,
Element elt,
String pseudo)
Sorts the rules matching the element/pseudo-element of given style
sheet to the list.
|
protected static final org.apache.batik.css.engine.CSSEngineListener[] LISTENER_ARRAY
protected final int[] ALL_PROPERTIES
protected org.apache.batik.css.engine.CSSEngineUserAgent userAgent
protected org.apache.batik.css.engine.CSSContext cssContext
protected Document document
protected org.apache.batik.util.ParsedURL documentURI
protected boolean isCSSNavigableDocument
protected org.apache.batik.css.engine.StringIntMap indexes
protected org.apache.batik.css.engine.StringIntMap shorthandIndexes
protected org.apache.batik.css.engine.value.ValueManager[] valueManagers
protected org.apache.batik.css.engine.value.ShorthandManager[] shorthandManagers
protected org.apache.batik.css.parser.ExtendedParser parser
protected String[] pseudoElementNames
protected int fontSizeIndex
protected int lineHeightIndex
protected int colorIndex
protected org.apache.batik.css.engine.StyleSheet userAgentStyleSheet
protected org.apache.batik.css.engine.StyleSheet userStyleSheet
protected org.w3c.css.sac.SACMediaList media
protected List styleSheetNodes
protected List fontFaces
protected String styleNamespaceURI
protected String styleLocalName
protected String classNamespaceURI
protected String classLocalName
protected Set nonCSSPresentationalHints
protected String nonCSSPresentationalHintsNamespaceURI
protected CSSEngine.StyleDeclarationDocumentHandler styleDeclarationDocumentHandler
protected CSSEngine.StyleDeclarationUpdateHandler styleDeclarationUpdateHandler
protected CSSEngine.StyleSheetDocumentHandler styleSheetDocumentHandler
protected CSSEngine.StyleDeclarationBuilder styleDeclarationBuilder
protected org.apache.batik.css.engine.CSSStylableElement element
protected org.apache.batik.util.ParsedURL cssBaseURI
protected String alternateStyleSheet
protected CSSEngine.CSSNavigableDocumentHandler cssNavigableDocumentListener
protected EventListener domAttrModifiedListener
protected EventListener domNodeInsertedListener
protected EventListener domNodeRemovedListener
protected EventListener domSubtreeModifiedListener
protected EventListener domCharacterDataModifiedListener
protected boolean styleSheetRemoved
protected Node removedStylableElementSibling
protected List listeners
protected Set selectorAttributes
protected org.apache.batik.css.engine.sac.CSSConditionFactory cssConditionFactory
protected CSSEngine(Document doc, org.apache.batik.util.ParsedURL uri, org.apache.batik.css.parser.ExtendedParser p, org.apache.batik.css.engine.value.ValueManager[] vm, org.apache.batik.css.engine.value.ShorthandManager[] sm, String[] pe, String sns, String sln, String cns, String cln, boolean hints, String hintsNS, org.apache.batik.css.engine.CSSContext ctx)
doc
- The associated document.uri
- The document URI.p
- The CSS parser.vm
- The property value managers.sm
- The shorthand properties managers.pe
- The pseudo-element names supported by the associated
XML dialect. Must be null if no support for pseudo-
elements is required.sns
- The namespace URI of the style attribute.sln
- The local name of the style attribute.cns
- The namespace URI of the class attribute.cln
- The local name of the class attribute.hints
- Whether the CSS engine should support non CSS
presentational hints.hintsNS
- The hints namespace URI.ctx
- The CSS context.public static Node getCSSParentNode(Node n)
protected static Node getCSSFirstChild(Node n)
protected static Node getCSSNextSibling(Node n)
protected static Node getCSSPreviousSibling(Node n)
public static org.apache.batik.css.engine.CSSStylableElement getParentCSSStylableElement(Element elt)
protected void addEventListeners(EventTarget doc)
protected void removeEventListeners(EventTarget doc)
public void dispose()
protected void disposeStyleMaps(Node node)
public org.apache.batik.css.engine.CSSContext getCSSContext()
public Document getDocument()
public int getFontSizeIndex()
public int getLineHeightIndex()
public int getColorIndex()
public int getNumberOfProperties()
public int getPropertyIndex(String name)
public int getShorthandIndex(String name)
public String getPropertyName(int idx)
public org.apache.batik.css.engine.CSSEngineUserAgent getCSSEngineUserAgent()
public void setCSSEngineUserAgent(org.apache.batik.css.engine.CSSEngineUserAgent userAgent)
public void setUserAgentStyleSheet(org.apache.batik.css.engine.StyleSheet ss)
public void setUserStyleSheet(org.apache.batik.css.engine.StyleSheet ss)
public org.apache.batik.css.engine.value.ValueManager[] getValueManagers()
public org.apache.batik.css.engine.value.ShorthandManager[] getShorthandManagers()
public List getFontFaces()
public void setMedia(String str)
public void setAlternateStyleSheet(String str)
public void importCascadedStyleMaps(Element src, CSSEngine srceng, Element dest)
public org.apache.batik.util.ParsedURL getCSSBaseURI()
public org.apache.batik.css.engine.StyleMap getCascadedStyleMap(org.apache.batik.css.engine.CSSStylableElement elt, String pseudo)
elt
- The stylable element.pseudo
- Optional pseudo-element string (null if none).public org.apache.batik.css.engine.value.Value getComputedStyle(org.apache.batik.css.engine.CSSStylableElement elt, String pseudo, int propidx)
public List getStyleSheetNodes()
protected void findStyleSheetNodes(Node n)
protected void findSelectorAttributes(Set attrs, org.apache.batik.css.engine.StyleSheet ss)
public void setMainProperties(org.apache.batik.css.engine.CSSStylableElement elt, CSSEngine.MainPropertyReceiver dst, String pname, String value, boolean important)
public org.apache.batik.css.engine.value.Value parsePropertyValue(org.apache.batik.css.engine.CSSStylableElement elt, String prop, String value)
elt
- The element property is from.prop
- The property name.value
- The property value.public org.apache.batik.css.engine.StyleDeclaration parseStyleDeclaration(org.apache.batik.css.engine.CSSStylableElement elt, String value)
value
- The style declaration text.public org.apache.batik.css.engine.StyleSheet parseStyleSheet(org.apache.batik.util.ParsedURL uri, String media) throws DOMException
uri
- The style-sheet URI.media
- The target media of the style-sheet.DOMException
public org.apache.batik.css.engine.StyleSheet parseStyleSheet(org.w3c.css.sac.InputSource is, org.apache.batik.util.ParsedURL uri, String media) throws DOMException
is
- The input source used to read the document.uri
- The base URI.media
- The target media of the style-sheet.DOMException
public void parseStyleSheet(org.apache.batik.css.engine.StyleSheet ss, org.apache.batik.util.ParsedURL uri) throws DOMException
ss
- The stylesheet to fill.uri
- The base URI.DOMException
public org.apache.batik.css.engine.StyleSheet parseStyleSheet(String rules, org.apache.batik.util.ParsedURL uri, String media) throws DOMException
rules
- The style-sheet rules to parse.uri
- The style-sheet URI.media
- The target media of the style-sheet.DOMException
public void parseStyleSheet(org.apache.batik.css.engine.StyleSheet ss, String rules, org.apache.batik.util.ParsedURL uri) throws DOMException
ss
- The stylesheet to fill.rules
- The style-sheet rules to parse.uri
- The base URI.DOMException
protected void parseStyleSheet(org.apache.batik.css.engine.StyleSheet ss, org.w3c.css.sac.InputSource is, org.apache.batik.util.ParsedURL uri) throws IOException
ss
- The stylesheet to fill.uri
- The base URI.IOException
protected void putAuthorProperty(org.apache.batik.css.engine.StyleMap dest, int idx, org.apache.batik.css.engine.value.Value sval, boolean imp, short origin)
protected void addMatchingRules(List rules, org.apache.batik.css.engine.StyleSheet ss, Element elt, String pseudo)
protected void addRules(Element elt, String pseudo, org.apache.batik.css.engine.StyleMap sm, ArrayList rules, short origin)
protected void sortRules(ArrayList rules, Element elt, String pseudo)
protected boolean mediaMatch(org.w3c.css.sac.SACMediaList ml)
public void addCSSEngineListener(org.apache.batik.css.engine.CSSEngineListener l)
public void removeCSSEngineListener(org.apache.batik.css.engine.CSSEngineListener l)
protected void firePropertiesChangedEvent(Element target, int[] props)
protected void inlineStyleAttributeUpdated(org.apache.batik.css.engine.CSSStylableElement elt, org.apache.batik.css.engine.StyleMap style, short attrChange, String prevValue, String newValue)
protected void invalidateProperties(Node node, int[] properties, boolean[] updated, boolean recascade)
protected void propagateChanges(Node node, int[] props, boolean recascade)
protected void nonCSSPresentationalHintUpdated(org.apache.batik.css.engine.CSSStylableElement elt, org.apache.batik.css.engine.StyleMap style, String property, short attrChange, String newValue)
protected boolean hasStyleSheetNode(Node n)
CSSStyleSheetNode
.protected void handleAttrModified(Element e, Attr attr, short attrChange, String prevValue, String newValue)
protected void handleNodeInserted(Node n)
protected void handleNodeRemoved(Node n)
protected void handleSubtreeModified(Node ignored)
protected void handleCharacterDataModified(Node n)
Copyright © 2025. All rights reserved.