org.nuiton.guix.tags
Class StyleHandler

java.lang.Object
  extended by org.nuiton.guix.tags.StyleHandler

public class StyleHandler
extends java.lang.Object

Handles the style tag.

Author:
morin

Field Summary
protected static org.apache.commons.logging.Log log
          log
 
Constructor Summary
StyleHandler()
           
 
Method Summary
 StyleSheet autoDetectStyleFile(java.io.File styleFile)
          Load the file with the name of the class and creates a StyleSheet with the content of the file.
 StyleSheet compileStyle(org.xmlpull.v1.XmlPullParser xpp, java.io.File styleFile)
          Load the file specified by the source attribute or the code between the style tags and creates a StyleSheet with this content.
protected  Rule processRule(SimpleNode ruleNode)
          Analyses a CSS rule
protected  Selector processSelector(SimpleNode selector)
          Analyses a selector node
protected  StyleSheet processStylesheet(java.lang.String stylesheetText)
          Analyses the CSS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log
log

Constructor Detail

StyleHandler

public StyleHandler()
Method Detail

autoDetectStyleFile

public StyleSheet autoDetectStyleFile(java.io.File styleFile)
                               throws java.io.IOException
Load the file with the name of the class and creates a StyleSheet with the content of the file.

Parameters:
styleFile - the file containing the css code
Returns:
a StyleSheet containing the content of the file
Throws:
java.io.FileNotFoundException - if the file with the same name as the class does not exist
java.io.IOException - if an error occurs while reading the file with the same name as the class

compileStyle

public StyleSheet compileStyle(org.xmlpull.v1.XmlPullParser xpp,
                               java.io.File styleFile)
                        throws java.io.IOException,
                               org.xmlpull.v1.XmlPullParserException
Load the file specified by the source attribute or the code between the style tags and creates a StyleSheet with this content.

Parameters:
xpp - the parser referencing the style tag
styleFile - the file containing the css code
Returns:
a StyleSheet containing the content of the file
Throws:
java.io.IOException - if an error occurs while reading the file specified by the source attribute
org.xmlpull.v1.XmlPullParserException - if an error occurs while parsing the guix file

processSelector

protected Selector processSelector(SimpleNode selector)
Analyses a selector node

Parameters:
selector - the selector node to analyse
Returns:
a Selector with the class, styleclass, pseudoclass and/or id which rules will be applied to

processRule

protected Rule processRule(SimpleNode ruleNode)
Analyses a CSS rule

Parameters:
ruleNode - the CSSParser node containing the rule to analyse
Returns:
a Rule containing the properties and the selectors of the rule

processStylesheet

protected StyleSheet processStylesheet(java.lang.String stylesheetText)
                                throws java.io.IOException
Analyses the CSS

Parameters:
stylesheetText - the content of the CSS file or the style tag
Returns:
the StyleSheet containing the rules of the CSS file or the style tag
Throws:
java.io.IOException


Copyright © 2009 CodeLutin. All Rights Reserved.