de.enough.polish.preprocess.css
Class CssBlock

java.lang.Object
  extended by de.enough.polish.preprocess.css.CssBlock

public class CssBlock
extends Object

Interpretes a single CSS block.

A block can consist of a single style or of the colors, borders, backgrounds or fonts-definition.

Copyright Enough Software 2004 - 2008

 history
        02-Mar-2004 - rob creation
 

Author:
Robert Virkus, robert@enough.de

Field Summary
protected static String ATTRIBUTE_NAME_STR
           
protected static String ATTRIBUTE_SELECTOR_STR
           
protected static String ATTRIBUTE_VALUE_STR
           
protected static Pattern INNER_BLOCK_PATTERN
           
 
Constructor Summary
CssBlock(String cssCode)
          Creates a new CSS Block
 
Method Summary
 CssDeclarationBlock[] getDeclarationBlocks()
          Retrieves all CSS declaration blocks embedded in this block
 List getDeclarationBlocksAsList()
          Retrieves all CSS declaration blocks embedded in this block
 HashMap getDeclarationsMap()
           
 AttributesGroup getGroupDeclarations(String groupName)
          Retrieves the declarations for the specific group.
 String[] getGroupNames()
          Retrieves the names of all found groups like "font" or "background"
 String getSelector()
           
 void setSelector(String styleName)
          Sets the selector for this block
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTE_NAME_STR

protected static final String ATTRIBUTE_NAME_STR
See Also:
Constant Field Values

ATTRIBUTE_SELECTOR_STR

protected static final String ATTRIBUTE_SELECTOR_STR
See Also:
Constant Field Values

ATTRIBUTE_VALUE_STR

protected static final String ATTRIBUTE_VALUE_STR
See Also:
Constant Field Values

INNER_BLOCK_PATTERN

protected static final Pattern INNER_BLOCK_PATTERN
Constructor Detail

CssBlock

public CssBlock(String cssCode)
Creates a new CSS Block

Parameters:
cssCode - the CSS code of this block.
Throws:
BuildException - when the code contains errors.
Method Detail

getSelector

public String getSelector()
Returns:
Returns the name of the selector of this block.

getDeclarationsMap

public HashMap getDeclarationsMap()
Returns:
Returns all declarations stored in a HashMap

getGroupNames

public String[] getGroupNames()
Retrieves the names of all found groups like "font" or "background"

Returns:
String array with the names of all found groups

getGroupDeclarations

public AttributesGroup getGroupDeclarations(String groupName)
Retrieves the declarations for the specific group.

Parameters:
groupName - the name of the group.
Returns:
all declaration of the specified group in a HashMap

setSelector

public void setSelector(String styleName)
Sets the selector for this block

Parameters:
styleName - the streamlined selector name

getDeclarationBlocks

public CssDeclarationBlock[] getDeclarationBlocks()
Retrieves all CSS declaration blocks embedded in this block

Returns:
an array of all CSS declaration blocks, can be empty

getDeclarationBlocksAsList

public List getDeclarationBlocksAsList()
Retrieves all CSS declaration blocks embedded in this block

Returns:
a list of all CSS declaration blocks, can be empty