Class StyleAttrCSSResolver

  • All Implemented Interfaces:
    CSSResolver

    public class StyleAttrCSSResolver
    extends java.lang.Object
    implements CSSResolver
    Resolves CSS properties.
    • Method Detail

      • mergeTextDecorationRules

        private java.lang.String mergeTextDecorationRules​(java.lang.String oldRule,
                                                          java.lang.String newRule)
      • splitRules

        private void splitRules​(java.util.Map<java.lang.String,​java.lang.String> css,
                                java.lang.String key,
                                java.lang.String value)
        Parameters:
        css - the css map to populate
        key - the property
        value - the value
      • setCssInheritance

        public void setCssInheritance​(CssInheritanceRules cssInheritanceRules)
        By setting an implementation of CssInheritanceRules a developer can set rules on what css selectors are inherited from parent tags.
        Parameters:
        cssInheritanceRules - the inherit to set
      • canInherite

        private boolean canInherite​(Tag t,
                                    java.lang.String property)
        Defaults to true if no CssInheritanceRules implementation set.
        Parameters:
        t -
        property -
        Returns:
        true if may be inherited false otherwise
      • mustInherit

        private boolean mustInherit​(java.lang.String tag)
        Defaults to true if no CssInheritanceRules implementation set.
        Parameters:
        tag -
        Returns:
        true if must be inherited false otherwise
      • addCss

        public void addCss​(java.lang.String content,
                           java.lang.String charSet,
                           boolean isPersistent)
                    throws CssResolverException
        Description copied from interface: CSSResolver
        Add a piece of CSS code.
        Specified by:
        addCss in interface CSSResolver
        Parameters:
        content - the CSS
        charSet - a charset
        isPersistent - true if the added css should not be deleted on a call to clear
        Throws:
        CssResolverException - thrown if something goes wrong
      • addCssFile

        public void addCssFile​(java.lang.String href,
                               boolean isPersistent)
                        throws CssResolverException
        Add a file to the CssFiles Collection.
        Specified by:
        addCssFile in interface CSSResolver
        Parameters:
        href - the path, if it starts with http we try to retrieve the file from the net, if not we try a normal file operation.
        isPersistent - true if the added css should not be deleted on a call to clear
        Throws:
        CssResolverException - thrown if something goes wrong
      • addCss

        public void addCss​(CssFile file)
        Add a file to the CssFiles Collection.
        Specified by:
        addCss in interface CSSResolver
        Parameters:
        file - the CssFile to add.
      • addCss

        public void addCss​(java.lang.String content,
                           boolean isPersistent)
                    throws CssResolverException
        Description copied from interface: CSSResolver
        Add a piece of CSS code.
        Specified by:
        addCss in interface CSSResolver
        Parameters:
        content - the content to parse to css
        isPersistent - true if the added css should not be deleted on a call to clear
        Throws:
        CssResolverException - thrown if something goes wrong
      • setCssInheritanceRules

        public void setCssInheritanceRules​(CssInheritanceRules inherit)
        Parameters:
        inherit - the inherit to set