Class StyleSheetParserUtil


  • public final class StyleSheetParserUtil
    extends java.lang.Object
    A helper class that simplifies the parsing of stylesheets.
    Author:
    Thomas Morgner
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static StyleSheetParserUtil getInstance()  
      org.w3c.css.sac.LexicalUnit parseLexicalStyleValue​(java.lang.String value)
      Parses an single lexical unit.
      static java.lang.String[] parseNamespaceIdent​(java.lang.String attrName)
      Parses a single namespace identifier.
      org.w3c.css.sac.SelectorList parseSelector​(java.util.Map namespaces, java.lang.String selector, org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager, org.pentaho.reporting.libraries.resourceloader.ResourceKey baseURL)
      Parses a single style value for the given key.
      CSSDeclarationRule parseStyleRule​(java.util.Map namespaces, java.lang.String styleText, org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager, org.pentaho.reporting.libraries.resourceloader.ResourceKey baseURL, CSSDeclarationRule baseRule)
      Parses a style rule.
      CSSStyleRule parseStyles​(java.util.Map namespaces, java.lang.String name, java.lang.String value, org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager, org.pentaho.reporting.libraries.resourceloader.ResourceKey baseURL)
      Parses a style value.
      CSSStyleRule parseStyles​(java.util.Map namespaces, java.lang.String name, java.lang.String value, org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager, org.pentaho.reporting.libraries.resourceloader.ResourceKey baseURL, CSSDeclarationRule baseRule)
      Parses a style value.
      CSSStyleRule parseStyles​(java.util.Map namespaces, StyleKey key, java.lang.String value, org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager, org.pentaho.reporting.libraries.resourceloader.ResourceKey baseURL)
      Parses a style value.
      CSSValue parseStyleValue​(java.util.Map namespaces, StyleKey key, java.lang.String value, org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager, org.pentaho.reporting.libraries.resourceloader.ResourceKey baseURL)
      Parses a single style value for the given key.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StyleSheetParserUtil

        public StyleSheetParserUtil()
    • Method Detail

      • parseSelector

        public org.w3c.css.sac.SelectorList parseSelector​(java.util.Map namespaces,
                                                          java.lang.String selector,
                                                          org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager,
                                                          org.pentaho.reporting.libraries.resourceloader.ResourceKey baseURL)
        Parses a single style value for the given key. Returns null, if the key denotes a compound definition, which has no internal representation.
        Parameters:
        namespaces - an optional map of known namespaces (prefix -> uri)
        selector - the selector text that should be parsed.
        resourceManager - an optional resource manager
        baseURL - an optional base url
        Returns:
        the parsed selector or null
      • parseStyleValue

        public CSSValue parseStyleValue​(java.util.Map namespaces,
                                        StyleKey key,
                                        java.lang.String value,
                                        org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager,
                                        org.pentaho.reporting.libraries.resourceloader.ResourceKey baseURL)
        Parses a single style value for the given key. Returns null, if the key denotes a compound definition, which has no internal representation.
        Parameters:
        namespaces - an optional map of known namespaces (prefix -> uri)
        key - the stylekey to which the value should be assigned.
        value - the value text
        resourceManager - an optional resource manager
        baseURL - an optional base url
        Returns:
        the parsed value or null, if the value was not valid.
      • parseLexicalStyleValue

        public org.w3c.css.sac.LexicalUnit parseLexicalStyleValue​(java.lang.String value)
        Parses an single lexical unit. This returns the un-interpreted tokenized value. The only use this method has is to parse performance critical tokens.
        Parameters:
        value - the value as string.
        Returns:
        the parsed value or null, if the string was unparseable.
      • parseStyles

        public CSSStyleRule parseStyles​(java.util.Map namespaces,
                                        StyleKey key,
                                        java.lang.String value,
                                        org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager,
                                        org.pentaho.reporting.libraries.resourceloader.ResourceKey baseURL)
        Parses a style value. If the style value is a compound key, the corresonding style entries will be added to the style rule.
        Parameters:
        namespaces - an optional map of known namespaces (prefix -> uri)
        key - the stylekey to which the value should be assigned.
        value - the value text
        resourceManager - an optional resource manager
        baseURL - an optional base url
        Returns:
        the CSS-Style-Rule that contains all values for the given text.
      • parseStyleRule

        public CSSDeclarationRule parseStyleRule​(java.util.Map namespaces,
                                                 java.lang.String styleText,
                                                 org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager,
                                                 org.pentaho.reporting.libraries.resourceloader.ResourceKey baseURL,
                                                 CSSDeclarationRule baseRule)
        Parses a style rule.
        Parameters:
        namespaces - an optional map of known namespaces (prefix -> uri)
        styleText - the css text that should be parsed
        resourceManager - an optional resource manager
        baseURL - an optional base url
        baseRule - an optional base-rule to which the result gets added.
        Returns:
        the CSS-Style-Rule that contains all values for the given text.
      • parseStyles

        public CSSStyleRule parseStyles​(java.util.Map namespaces,
                                        java.lang.String name,
                                        java.lang.String value,
                                        org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager,
                                        org.pentaho.reporting.libraries.resourceloader.ResourceKey baseURL)
        Parses a style value. If the style value is a compound key, the corresonding style entries will be added to the style rule.
        Parameters:
        namespaces - an optional map of known namespaces (prefix -> uri)
        name - the stylekey-name to which the value should be assigned.
        value - the value text
        resourceManager - an optional resource manager
        baseURL - an optional base url
        Returns:
        the CSS-Style-Rule that contains all values for the given text.
      • parseStyles

        public CSSStyleRule parseStyles​(java.util.Map namespaces,
                                        java.lang.String name,
                                        java.lang.String value,
                                        org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager,
                                        org.pentaho.reporting.libraries.resourceloader.ResourceKey baseURL,
                                        CSSDeclarationRule baseRule)
        Parses a style value. If the style value is a compound key, the corresonding style entries will be added to the style rule.
        Parameters:
        namespaces - an optional map of known namespaces (prefix -> uri)
        name - the stylekey-name to which the value should be assigned.
        value - the value text
        resourceManager - an optional resource manager
        baseURL - an optional base url
        baseRule - an optional base-rule to which the result gets added.
        Returns:
        the CSS-Style-Rule that contains all values for the given text.
      • parseNamespaceIdent

        public static java.lang.String[] parseNamespaceIdent​(java.lang.String attrName)
        Parses a single namespace identifier. This simply splits the given attribute name when a namespace separator is encountered ('|').
        Parameters:
        attrName - the attribute name
        Returns:
        the parsed attribute.