| java.lang.Object org.apache.batik.css.engine.CSSEngine
All known Subclasses: org.netbeans.modules.visualweb.designer.markup.RaveElement, org.netbeans.modules.visualweb.designer.cssengine.XhtmlCssEngine,
CSSEngine | abstract public class CSSEngine (Code) | | This is the base class for all the CSS engines.
author: Stephane Hillion version: $Id$ author: Tor Norbye (see // BEGIN RAVE MODIFICATIONS markers) |
Inner Class :public interface StyleElementLink | |
Inner Class :public interface MainPropertyReceiver | |
Inner Class :protected static class DocumentAdapter implements DocumentHandler | |
Inner Class :protected class DOMNodeInsertedListener implements EventListener | |
Inner Class :protected class DOMNodeRemovedListener implements EventListener | |
Inner Class :protected class DOMSubtreeModifiedListener implements EventListener | |
Inner Class :protected class DOMCharacterDataModifiedListener implements EventListener | |
Inner Class :protected class DOMAttrModifiedListener implements EventListener | |
Constructor Summary | |
protected | CSSEngine(Document doc, URL uri, ExtendedParser p, ValueManager[] vm, ShorthandManager[] sm, String[] pe, String sns, String sln, String cns, String cln, boolean hints, String hintsNS, CSSContext ctx) Creates a new CSSEngine.
Parameters: doc - The associated document. Parameters: uri - The document URI. Parameters: p - The CSS parser. Parameters: vm - The property value managers. Parameters: sm - The shorthand properties managers. Parameters: pe - The pseudo-element names supported by the associatedXML dialect. |
Method Summary | |
public void | addCSSEngineListener(CSSEngineListener l) Adds a CSS engine listener. | protected void | addMatchingRules(List rules, 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, StyleMap sm, List rules, short origin) Adds the rules contained in the given list to a stylemap. | public void | addTransientStyleSheetNode(CSSStyleSheetNode elt) | protected void | applyNonCSSPresentationalHint(CSSStylableElement elt, StyleMap map, int idx, String value) For use by the implementation of applyNonCSSPresentationalHints;
apply a non-presentational CSS hint as the given CSS value for
the given CSS property. | protected void | applyNonCSSPresentationalHint(CSSStylableElement elt, StyleMap map, int idx, Value v) For use by the implementation of applyNonCSSPresentationalHints;
apply a non-presentational CSS hint as the given CSS value for
the given CSS property. | protected void | applyNonCSSPresentationalHints(CSSStylableElement elt, StyleMap map) | public void | clearTransientStyleSheetNodes() | protected void | displayError(DOMException e, Object location, int lineno, int column) | protected void | displayMissingStyleSheet(String uri) | public void | dispose() Disposes the CSSEngine and all the attached resources. | protected void | disposeStyleMaps(Node node) | protected void | findSelectorAttributes(Set attrs, StyleSheet ss) Finds the selector attributes in the given stylesheet. | protected void | findStyleSheetNodes() | 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. | public URL | getCSSBaseURI() Returns the current base-url. | public CSSContext | getCSSContext() Returns the CSS context. | public CSSEngineUserAgent | getCSSEngineUserAgent() | public StyleMap | getCascadedStyleMap(CSSStylableElement elt, String pseudo) Returns the cascaded style of the given element/pseudo-element. | public int | getColorIndex() Returns the color property index. | public Value | getComputedStyle(CSSStylableElement elt, String pseudo, int propidx) Returns the computed style of the given element/pseudo for the
property corresponding to the given index. | public Document | getDocument() Returns the document associated with this engine. | public String | getExpandingShorthandProperty() Return the shorthand property being set. | public List | getFontFaces() Get's the StyleMaps generated by @font-face rules
encountered by this CSSEngine thus far. | public int | getFontSizeIndex() Returns the font-size property index. | public static CSSImportedElementRoot | getImportedChild(Node node) Returns the imported child of the given node, if any. | public int | getLineHeightIndex() Returns the line-height property index. | public static Node | getLogicalParentNode(Node parent) Returns the logical parent of a node, given its physical parent. | public String | getMatchingRules(Element elt, boolean includeAgentRules) | public int | getNumberOfProperties() Returns the number of properties. | public static CSSStylableElement | getParentCSSStylableElement(Element elt) Returns the next stylable parent of the given element. | public static Element | getParentElement(Element elt) Returns the next parent element of the given element, from the
CSS point of view. | public int | getPropertyIndex(String name) Returns the property index, or -1. | public String | getPropertyName(int idx) Returns the name of the property at the given index. | public int | getShorthandIndex(String name) Returns the shorthand property index, or -1. | public Collection | getStyleClasses() Return a list of style classes defined in the stylesheets for
this engine. | public List<WeakReference<CSSStyleSheetNode>> | getStyleSheetNodes() Returns the document CSSStyleSheetNodes in a list. | public String | getUpdatedLocalStyleValues(CSSStylableElement elt, StyleSetting[] stylesToSet, StyleSetting[] stylesToRemove) Updates the local styles for an element. | public ValueManager[] | getValueManagers() Returns the ValueManagers. | public 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(CSSStylableElement elt, StyleMap style, MutationEvent evt) 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. | public boolean | isDefaultValue(CSSStylableElement elt, String pseudo, int propidx) Return true iff the given CSS property for the given element
is not set, e.g. | public boolean | isInheritedValue(CSSStylableElement elt, int propidx) Return true iff the given CSS property for the given element
was inherited, as opposed to referenced directly by some rule. | protected boolean | mediaMatch(SACMediaList ml) Whether the given media list matches the media list of this
CSSEngine object. | protected void | nonCSSPresentationalHintUpdated(CSSStylableElement elt, StyleMap style, String property, MutationEvent evt) Called when a non-CSS presentational hint has been updated. | public Value | parsePropertyValue(CSSStylableElement elt, String prop, String value) Parses and creates a property value from elt. | public StyleDeclaration | parseStyleDeclaration(CSSStylableElement elt, String value) Parses and creates a style declaration. | public StyleSheet | parseStyleSheet(URL uri, String media, Object location) Parses and creates a new style-sheet. | public StyleSheet | parseStyleSheet(InputSource is, URL uri, String media, Object location) Parses and creates a new style-sheet. | public void | parseStyleSheet(StyleSheet ss, URL uri, Object location) Parses and fills the given style-sheet. | public StyleSheet | parseStyleSheet(String rules, URL uri, String media, Object location) Parses and creates a new style-sheet. | public void | parseStyleSheet(StyleSheet ss, String rules, URL uri, Object location) Parses and fills the given style-sheet. | protected void | parseStyleSheet(StyleSheet ss, InputSource is, URL uri, Object location) 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(StyleMap dest, int idx, Value sval, boolean imp, short origin) Puts an author property from a style-map in another style-map,
if possible. | public void | removeCSSEngineListener(CSSEngineListener l) Removes a CSS engine listener. | public void | setAlternateStyleSheet(String str) Sets the alternate style-sheet title. | protected void | setAttributeValue(Element elt, String name, String value) Set the given element's value for a given attribute; if value is
null, remove the attribute. | public void | setCSSEngineUserAgent(CSSEngineUserAgent userAgent) | public void | setMainProperties(CSSStylableElement elt, MainPropertyReceiver dst, String pname, String value, boolean important) | public void | setMedia(String str) Sets the media to use to compute the styles. | public void | setUserAgentStyleSheet(StyleSheet ss) Sets the user agent style-sheet. | public void | setUserStyleSheet(StyleSheet ss) Sets the user style-sheet. | protected void | sortRules(List rules, Element elt, String pseudo) Sorts the rules matching the element/pseudo-element of given style
sheet to the list. | protected String | toMinimalStyleString(StyleMap map) Try to create a minimal (as short as possible) style string
from this map, by using shortcuts when possible. | protected void | warnCircularReference(URL uri, Object location) |
ALL_PROPERTIES | final protected int[] ALL_PROPERTIES(Code) | | Used to fire a change event for all the properties.
|
DEBUG_FILTERING | final public static boolean DEBUG_FILTERING(Code) | | |
PARSING_SHEET | final public static StyleSheet PARSING_SHEET(Code) | | Constant which indicates that the given stylesheet is being parsed. Used
to avoid circular references.
|
RULE_FILTERING | final public static boolean RULE_FILTERING(Code) | | Rule filtering will attempt to quickly filter out rules that don't need to be considered when adding matching
rules for an element - that's currently the slowest operation in the designer.
|
alternateStyleSheet | protected String alternateStyleSheet(Code) | | The alternate stylesheet title.
|
classLocalName | protected String classLocalName(Code) | | The class attribute local name.
|
classNamespaceURI | protected String classNamespaceURI(Code) | | The class attribute namespace URI.
|
colorIndex | protected int colorIndex(Code) | | The color property index.
|
cssBaseURI | protected URL cssBaseURI(Code) | | The current base URI.
|
documentURI | protected URL documentURI(Code) | | The document URI.
|
domAttrModifiedListener | protected EventListener domAttrModifiedListener(Code) | | The DOMAttrModified event listener.
|
domCharacterDataModifiedListener | protected EventListener domCharacterDataModifiedListener(Code) | | The DOMCharacterDataModified event listener.
|
domNodeInsertedListener | protected EventListener domNodeInsertedListener(Code) | | The DOMNodeInserted event listener.
|
domNodeRemovedListener | protected EventListener domNodeRemovedListener(Code) | | The DOMNodeRemoved event listener.
|
domSubtreeModifiedListener | protected EventListener domSubtreeModifiedListener(Code) | | The DOMSubtreeModified event listener.
|
fontFaces | protected List fontFaces(Code) | | List of StyleMap objects, one for each @font-face rule
encountered by this CSSEngine.
|
fontSizeIndex | protected int fontSizeIndex(Code) | | The font-size property index.
|
lineHeightIndex | protected int lineHeightIndex(Code) | | The line-height property index.
|
listeners | protected List listeners(Code) | | The listeners.
|
nonCSSPresentationalHints | protected Set nonCSSPresentationalHints(Code) | | The non CSS presentational hints.
|
nonCSSPresentationalHintsNamespaceURI | protected String nonCSSPresentationalHintsNamespaceURI(Code) | | The non CSS presentational hints namespace URI.
|
pseudoElementNames | protected String[] pseudoElementNames(Code) | | The pseudo-element names.
|
removedStylableElementSibling | protected Node removedStylableElementSibling(Code) | | The right sibling of the last removed node.
|
selectorAttributes | protected Set selectorAttributes(Code) | | The attributes found in stylesheets selectors.
|
shorthandIndexes | protected StringIntMap shorthandIndexes(Code) | | The shorthand-property/int mappings.
|
styleDeclarationBuilder | protected StyleDeclarationBuilder styleDeclarationBuilder(Code) | | The style declaration document handler used to build a
StyleDeclaration object.
|
styleDeclarationDocumentHandler | protected StyleDeclarationDocumentHandler styleDeclarationDocumentHandler(Code) | | The style declaration document handler.
|
styleDeclarationUpdateHandler | protected StyleDeclarationUpdateHandler styleDeclarationUpdateHandler(Code) | | The style declaration update handler.
|
styleLocalName | protected String styleLocalName(Code) | | The style attribute local name.
|
styleLookupCount | public static int styleLookupCount(Code) | | For statistics gathering during development
|
styleNamespaceURI | protected String styleNamespaceURI(Code) | | The style attribute namespace URI.
|
styleSheetDocumentHandler | protected StyleSheetDocumentHandler styleSheetDocumentHandler(Code) | | The style sheet document handler.
|
styleSheetRemoved | protected boolean styleSheetRemoved(Code) | | Whether a style sheet as been removed from the document.
|
unknownPropertyNames | protected List unknownPropertyNames(Code) | | When non null, stores a list of properties that were not recognized.
This is only currently done for parsing of style expressions, not style
sheets, since it's used for local style element manipulation.
|
unknownPropertyValues | protected List unknownPropertyValues(Code) | | |
userAgentStyleSheet | protected StyleSheet userAgentStyleSheet(Code) | | The user-agent style-sheet.
|
CSSEngine | protected CSSEngine(Document doc, URL uri, ExtendedParser p, ValueManager[] vm, ShorthandManager[] sm, String[] pe, String sns, String sln, String cns, String cln, boolean hints, String hintsNS, CSSContext ctx)(Code) | | Creates a new CSSEngine.
Parameters: doc - The associated document. Parameters: uri - The document URI. Parameters: p - The CSS parser. Parameters: vm - The property value managers. Parameters: sm - The shorthand properties managers. Parameters: pe - The pseudo-element names supported by the associatedXML dialect. Must be null if no support for pseudo-elements is required. Parameters: sns - The namespace URI of the style attribute. Parameters: sln - The local name of the style attribute. Parameters: cns - The namespace URI of the class attribute. Parameters: cln - The local name of the class attribute. Parameters: hints - Whether the CSS engine should support non CSSpresentational hints. Parameters: hintsNS - The hints namespace URI. Parameters: ctx - The CSS context. |
addMatchingRules | protected void addMatchingRules(List rules, StyleSheet ss, Element elt, String pseudo)(Code) | | Adds the rules matching the element/pseudo-element of given style
sheet to the list.
|
addRules | protected void addRules(Element elt, String pseudo, StyleMap sm, List rules, short origin)(Code) | | Adds the rules contained in the given list to a stylemap.
|
addTransientStyleSheetNode | public void addTransientStyleSheetNode(CSSStyleSheetNode elt)(Code) | | Notify the engine that a new style element has been
created
|
applyNonCSSPresentationalHint | protected void applyNonCSSPresentationalHint(CSSStylableElement elt, StyleMap map, int idx, String value)(Code) | | For use by the implementation of applyNonCSSPresentationalHints;
apply a non-presentational CSS hint as the given CSS value for
the given CSS property.
|
applyNonCSSPresentationalHint | protected void applyNonCSSPresentationalHint(CSSStylableElement elt, StyleMap map, int idx, Value v)(Code) | | For use by the implementation of applyNonCSSPresentationalHints;
apply a non-presentational CSS hint as the given CSS value for
the given CSS property.
|
applyNonCSSPresentationalHints | protected void applyNonCSSPresentationalHints(CSSStylableElement elt, StyleMap map)(Code) | | Scan attributes for an element and transcribe deprecated
style-type attributes into real style properties
|
clearTransientStyleSheetNodes | public void clearTransientStyleSheetNodes()(Code) | | |
displayError | protected void displayError(DOMException e, Object location, int lineno, int column)(Code) | | Some error occurred while parsing stylesheet - display it to
the developer
|
displayMissingStyleSheet | protected void displayMissingStyleSheet(String uri)(Code) | | |
dispose | public void dispose()(Code) | | Disposes the CSSEngine and all the attached resources.
|
disposeStyleMaps | protected void disposeStyleMaps(Node node)(Code) | | |
findSelectorAttributes | protected void findSelectorAttributes(Set attrs, StyleSheet ss)(Code) | | Finds the selector attributes in the given stylesheet.
|
findStyleSheetNodes | protected void findStyleSheetNodes()(Code) | | |
findStyleSheetNodes | protected void findStyleSheetNodes(Node n)(Code) | | An auxiliary method for getStyleSheets().
|
firePropertiesChangedEvent | protected void firePropertiesChangedEvent(Element target, int[] props)(Code) | | Fires a CSSEngineEvent, given a list of modified properties.
|
getCSSBaseURI | public URL getCSSBaseURI()(Code) | | Returns the current base-url.
|
getCascadedStyleMap | public StyleMap getCascadedStyleMap(CSSStylableElement elt, String pseudo)(Code) | | Returns the cascaded style of the given element/pseudo-element.
Parameters: elt - The stylable element. Parameters: pseudo - Optional pseudo-element string (null if none). |
getColorIndex | public int getColorIndex()(Code) | | Returns the color property index.
|
getComputedStyle | public Value getComputedStyle(CSSStylableElement elt, String pseudo, int propidx)(Code) | | Returns the computed style of the given element/pseudo for the
property corresponding to the given index.
|
getDocument | public Document getDocument()(Code) | | Returns the document associated with this engine.
|
getExpandingShorthandProperty | public String getExpandingShorthandProperty()(Code) | | Return the shorthand property being set. Set when we're processing a shorthand property
such that individual value managers can figure out that they're part of a shorthand
property expansion (useful when creating error messages for example. Returns null
if no shorthand property is being processed.
|
getFontFaces | public List getFontFaces()(Code) | | Get's the StyleMaps generated by @font-face rules
encountered by this CSSEngine thus far.
|
getFontSizeIndex | public int getFontSizeIndex()(Code) | | Returns the font-size property index.
|
getLineHeightIndex | public int getLineHeightIndex()(Code) | | Returns the line-height property index.
|
getLogicalParentNode | public static Node getLogicalParentNode(Node parent)(Code) | | Returns the logical parent of a node, given its physical parent.
|
getMatchingRules | public String getMatchingRules(Element elt, boolean includeAgentRules)(Code) | | Return a display of the matching rules for the given element
|
getNumberOfProperties | public int getNumberOfProperties()(Code) | | Returns the number of properties.
|
getParentCSSStylableElement | public static CSSStylableElement getParentCSSStylableElement(Element elt)(Code) | | Returns the next stylable parent of the given element.
|
getParentElement | public static Element getParentElement(Element elt)(Code) | | Returns the next parent element of the given element, from the
CSS point of view.
|
getPropertyIndex | public int getPropertyIndex(String name)(Code) | | Returns the property index, or -1.
|
getPropertyName | public String getPropertyName(int idx)(Code) | | Returns the name of the property at the given index.
|
getShorthandIndex | public int getShorthandIndex(String name)(Code) | | Returns the shorthand property index, or -1.
|
getStyleClasses | public Collection getStyleClasses()(Code) | | Return a list of style classes defined in the stylesheets for
this engine. This will not include any styleclasses defined in
the user agent stylesheet.
|
getUpdatedLocalStyleValues | public String getUpdatedLocalStyleValues(CSSStylableElement elt, StyleSetting[] stylesToSet, StyleSetting[] stylesToRemove) throws Exception(Code) | | Updates the local styles for an element. First any style settings
in the set parameter array are applied, then any properties
pointed to by the remove array are applied.
The new style string |
importCascadedStyleMaps | public void importCascadedStyleMaps(Element src, CSSEngine srceng, Element dest)(Code) | | Recursively imports the cascaded style from a source element
to an element of the current document.
|
invalidateProperties | protected void invalidateProperties(Node node, int[] properties, boolean[] updated, boolean recascade)(Code) | | Invalidates all the properties of the given node.
|
isDefaultValue | public boolean isDefaultValue(CSSStylableElement elt, String pseudo, int propidx)(Code) | | Return true iff the given CSS property for the given element
is not set, e.g. the default value would be returned instead.
Note - it's not the same as asking if the property has the same
value as its default property; this method will still return false
in that case since it has a value set, so it doesn't have to pull
the default value.
|
isInheritedValue | public boolean isInheritedValue(CSSStylableElement elt, int propidx)(Code) | | Return true iff the given CSS property for the given element
was inherited, as opposed to referenced directly by some rule.
|
mediaMatch | protected boolean mediaMatch(SACMediaList ml)(Code) | | Whether the given media list matches the media list of this
CSSEngine object.
|
parsePropertyValue | public Value parsePropertyValue(CSSStylableElement elt, String prop, String value)(Code) | | Parses and creates a property value from elt.
Parameters: elt - The element property is from. Parameters: prop - The property name. Parameters: value - The property value. |
parseStyleSheet | public StyleSheet parseStyleSheet(URL uri, String media, Object location) throws DOMException(Code) | | Parses and creates a new style-sheet.
Parameters: uri - The style-sheet URI. Parameters: media - The target media of the style-sheet. |
parseStyleSheet | public StyleSheet parseStyleSheet(InputSource is, URL uri, String media, Object location) throws DOMException(Code) | | Parses and creates a new style-sheet.
Parameters: is - The input source used to read the document. Parameters: uri - The base URI. Parameters: media - The target media of the style-sheet. |
parseStyleSheet | public void parseStyleSheet(StyleSheet ss, URL uri, Object location) throws DOMException(Code) | | Parses and fills the given style-sheet.
Parameters: ss - The stylesheet to fill. Parameters: uri - The base URI. |
parseStyleSheet | public StyleSheet parseStyleSheet(String rules, URL uri, String media, Object location) throws DOMException(Code) | | Parses and creates a new style-sheet.
Parameters: rules - The style-sheet rules to parse. Parameters: uri - The style-sheet URI. Parameters: media - The target media of the style-sheet. |
parseStyleSheet | public void parseStyleSheet(StyleSheet ss, String rules, URL uri, Object location) throws DOMException(Code) | | Parses and fills the given style-sheet.
Parameters: ss - The stylesheet to fill. Parameters: rules - The style-sheet rules to parse. Parameters: uri - The base URI. |
parseStyleSheet | protected void parseStyleSheet(StyleSheet ss, InputSource is, URL uri, Object location) throws IOException(Code) | | Parses and fills the given style-sheet.
Parameters: ss - The stylesheet to fill. Parameters: uri - The base URI. |
propagateChanges | protected void propagateChanges(Node node, int[] props, boolean recascade)(Code) | | Propagates the changes that occurs on the parent of the given node.
Props is a list of known 'changed' properties.
If recascade is true then the stylesheets will be applied
again to see if the any new rules apply (or old rules don't
apply).
|
putAuthorProperty | protected void putAuthorProperty(StyleMap dest, int idx, Value sval, boolean imp, short origin)(Code) | | Puts an author property from a style-map in another style-map,
if possible.
|
removeCSSEngineListener | public void removeCSSEngineListener(CSSEngineListener l)(Code) | | Removes a CSS engine listener.
|
setAlternateStyleSheet | public void setAlternateStyleSheet(String str)(Code) | | Sets the alternate style-sheet title.
|
setAttributeValue | protected void setAttributeValue(Element elt, String name, String value)(Code) | | Set the given element's value for a given attribute; if value is
null, remove the attribute.
|
setMedia | public void setMedia(String str)(Code) | | Sets the media to use to compute the styles.
|
setUserAgentStyleSheet | public void setUserAgentStyleSheet(StyleSheet ss)(Code) | | Sets the user agent style-sheet.
|
setUserStyleSheet | public void setUserStyleSheet(StyleSheet ss)(Code) | | Sets the user style-sheet.
|
sortRules | protected void sortRules(List rules, Element elt, String pseudo)(Code) | | Sorts the rules matching the element/pseudo-element of given style
sheet to the list.
|
toMinimalStyleString | protected String toMinimalStyleString(StyleMap map)(Code) | | Try to create a minimal (as short as possible) style string
from this map, by using shortcuts when possible.
This will for example compress border-color-left/right/bottom/top
into border-color: one two three four, and so on.
The default implementation just passes serializes the map directly.
|
warnCircularReference | protected void warnCircularReference(URL uri, Object location)(Code) | | |
|
|