to.etc.domui.themes
Class FragmentedThemeFactory

java.lang.Object
  extended by to.etc.domui.themes.FragmentedThemeFactory
All Implemented Interfaces:
IThemeFactory

public class FragmentedThemeFactory
extends java.lang.Object
implements IThemeFactory

Experimental - This class collects all ".frag.css" files in the specified "directory", while allowing them to be "overridden" in other parts of the structure. The resulting set of .frag.css files is then run through the template compiler (one by one) to create the final result. This result should be the "actual" css file to use.

Style inheritance

A style can 'inherit' another style. This is done in each style's ".jsprops" file where the file must start with an "inherit('xxxx')" statement.

Author:
Frits Jalvingh Created on Jan 5, 2011

Nested Class Summary
static class FragmentedThemeFactory.Check
          The type of fragment expansion/check to do.
 
Constructor Summary
FragmentedThemeFactory()
           
FragmentedThemeFactory(java.lang.String colorName, java.lang.String iconName, java.lang.String styleName)
           
 
Method Summary
 java.util.List<java.lang.String> collectFragments(java.util.List<java.lang.String> directoryStack, java.lang.String suffix)
           
protected  IResourceRef findRef(IResourceDependencyList rdl, java.lang.String rurl)
           
 CssPropertySet getFragmentedProperties(java.lang.String dir, java.lang.String rootfile, java.lang.String suffix, java.util.Map<java.lang.String,java.lang.Object> start)
           
 void getFragments(java.lang.StringBuilder target, java.util.List<java.lang.String> directory, java.lang.String suffix, FragmentedThemeFactory.Check loadType, IResourceDependencyList rdl, java.util.Map<java.lang.String,java.lang.Object> propertyMap)
          This code collects "fragments" of files and connects them to form a full file which is the concatenation of all fragments.
 CssPropertySet getProperties(java.lang.String dir, java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> start)
          Load a property file set for colors and style properties, where the properties are not fragmented.
 void loadStyleInfo(DomApplication da)
           
 void loadStyleInfo(java.lang.String colorset, java.lang.String iconset, java.lang.String styleset)
           
 FragmentedThemeStore loadTheme(DomApplication da)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FragmentedThemeFactory

public FragmentedThemeFactory()

FragmentedThemeFactory

public FragmentedThemeFactory(java.lang.String colorName,
                              java.lang.String iconName,
                              java.lang.String styleName)
Method Detail

loadTheme

public FragmentedThemeStore loadTheme(DomApplication da)
                               throws java.lang.Exception
Specified by:
loadTheme in interface IThemeFactory
Throws:
java.lang.Exception

loadStyleInfo

public void loadStyleInfo(DomApplication da)
                   throws java.lang.Exception
Throws:
java.lang.Exception

loadStyleInfo

public void loadStyleInfo(java.lang.String colorset,
                          java.lang.String iconset,
                          java.lang.String styleset)
                   throws java.lang.Exception
Throws:
java.lang.Exception

getProperties

public CssPropertySet getProperties(java.lang.String dir,
                                    java.lang.String name,
                                    java.util.Map<java.lang.String,java.lang.Object> start)
                             throws java.lang.Exception
Load a property file set for colors and style properties, where the properties are not fragmented.

Throws:
java.lang.Exception

getFragmentedProperties

public CssPropertySet getFragmentedProperties(java.lang.String dir,
                                              java.lang.String rootfile,
                                              java.lang.String suffix,
                                              java.util.Map<java.lang.String,java.lang.Object> start)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

getFragments

public void getFragments(java.lang.StringBuilder target,
                         java.util.List<java.lang.String> directory,
                         java.lang.String suffix,
                         FragmentedThemeFactory.Check loadType,
                         IResourceDependencyList rdl,
                         java.util.Map<java.lang.String,java.lang.Object> propertyMap)
                  throws java.lang.Exception
This code collects "fragments" of files and connects them to form a full file which is the concatenation of all fragments. The fragments are identified by a set of "directory names" and a "suffix". The fragments are either files inside [webapp-dir/directory], i.e. files below WebContent, or class resources below a "resources" toplevel "package". Files take precedence over resources with the same name, so every resource can be easily overridden by a file in the same directory with the exact same name.

The loadType decides whether the content of each fragment is expanded or not.

Throws:
java.lang.Exception

findRef

@Nullable
protected IResourceRef findRef(@Nonnull
                                        IResourceDependencyList rdl,
                                        @Nonnull
                                        java.lang.String rurl)
                        throws java.lang.Exception
Throws:
java.lang.Exception

collectFragments

public java.util.List<java.lang.String> collectFragments(java.util.List<java.lang.String> directoryStack,
                                                         java.lang.String suffix)
                                                  throws java.lang.Exception
Throws:
java.lang.Exception