Class CssFile

java.lang.Object
com.webfirmframework.wffweb.css.file.CssFile
All Implemented Interfaces:
Serializable, Cloneable

public abstract class CssFile extends Object implements Serializable, Cloneable
Since:
1.0.0
See Also:
  • Constructor Details

    • CssFile

      public CssFile()
  • Method Details

    • initCssFile

      protected final void initCssFile()
    • getCssBlocks

      public Set<AbstractCssFileBlock> getCssBlocks()
      Returns:
      the cssBlocks
      Since:
      1.0.0
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toCssString

      public String toCssString()
      Returns:
      the css string. i.e. the contents in the css file as a string.
      Since:
      1.0.0
    • toCssString

      public String toCssString(boolean rebuild)
      Parameters:
      rebuild - true to force to rebuild
      Returns:
      the css string. i.e. the contents in the css file as a string.
      Since:
      1.0.0
    • toOutputStream

      public void toOutputStream(OutputStream os, String charset) throws IOException
      Parameters:
      os - the OutputStream object to write
      charset - the charset type of bytes to write
      Throws:
      IOException
      Since:
      1.1.2
    • toOutputStream

      public void toOutputStream(OutputStream os, String charsetName, boolean rebuild) throws IOException
      Parameters:
      os - the OutputStream object to write
      charsetName - the charset type of bytes to write
      rebuild - the load method in CssBlocked will be invoked a gain
      Throws:
      IOException
      Since:
      1.1.2
    • toOutputStream

      public void toOutputStream(OutputStream os, boolean rebuild) throws IOException
      Parameters:
      os - the OutputStream object to write
      rebuild - the load method in CssBlocked will be invoked a gain
      Throws:
      IOException
      Since:
      1.1.2
    • toOutputStream

      public void toOutputStream(OutputStream os, Charset charset) throws IOException
      Parameters:
      os - the OutputStream object to write
      charset - the charset type of bytes to write
      Throws:
      IOException
      Since:
      1.1.2
    • toOutputStream

      public void toOutputStream(OutputStream os, Charset charset, boolean rebuild) throws IOException
      Parameters:
      os - the OutputStream object to write
      charset - the charset type of bytes to write
      Throws:
      IOException
      Since:
      1.1.2
    • toOutputStream

      public void toOutputStream(OutputStream os) throws IOException
      Parameters:
      os - the OutputStream object to write
      Throws:
      IOException
      Since:
      1.1.2
    • isOptimizeCssString

      public final boolean isOptimizeCssString()
      Returns:
      true if the toCssString to be optimized.
      Since:
      1.0.0
    • setOptimizeCssString

      public void setOptimizeCssString(boolean optimizeCssString)
      optimizes the toCssString output. For instance the optimized output for the following blocks in the CssFile extended class will be .test4-class{list-style-position:outside;background-repeat:no-repeat;} .
      private CssBlock cssBlock1 = new CssBlock(".test4-class") {
      @Override
      protected void load(Set<CssProperty> cssProperties) {
      cssProperties.add(ListStylePosition.INSIDE);
      }
      };
      private CssBlock cssBlock2 = new CssBlock(".test4-class") {
      @Override
      protected void load(Set<CssProperty> cssProperties) {
      cssProperties.add(BackgroundRepeat.NO_REPEAT);
      cssProperties.add(ListStylePosition.OUTSIDE);
      }
      };
      Parameters:
      optimizeCssString - the optimizeCssString to set. true to optimize the toCssString value and false to turn off optimization. The default value is true.
      Since:
      1.0.0
    • isPrependCharset

      public boolean isPrependCharset()
      Returns:
      true or false
      Since:
      1.1.2
    • setPrependCharset

      public void setPrependCharset(boolean prependCharset)
      prepends the charset declaration (eg: @CHARSET "UTF-8";) while writing css string to the output stream by toOutputStream methods.
      Parameters:
      prependCharset - true to prepend the charset declaration (eg: @CHARSET "UTF-8";) while writing css string to the output stream by toOutputStream methods.
      Since:
      1.1.2