net.xoetrope.builder.w3c.html
Class XHtmlStyle

java.lang.Object
  extended by net.xoetrope.builder.w3c.html.XHtmlStyle

public class XHtmlStyle
extends java.lang.Object

XHtmlStyle holds the attributes and properties defined as part of a CSS style sheet style.

Copyright (c) Xoetrope Ltd., 2002-2006

$Revision: 1.2 $

License: see License.txt


Field Summary
protected  java.util.Hashtable<java.lang.String,java.lang.String> attributes
           
protected  java.lang.String className
           
protected  java.util.Hashtable<java.lang.String,java.lang.Object> objects
           
 
Constructor Summary
XHtmlStyle(java.lang.String styleName)
          Creates a new instance of XHtmlStyle
 
Method Summary
 java.lang.String getAttribute(java.lang.String attribName)
          Get a style attribute
 java.awt.Color getBackground(boolean returnDefault)
          Get the background color defined by this style, if any.
 java.awt.Font getFont()
          Get the Font setup by this style
 java.awt.Color getForeground(boolean returnDefault)
          Get the foreground color defined by this style, if any.
 void parse(java.lang.String css)
          Parse a CSS string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

className

protected java.lang.String className

attributes

protected java.util.Hashtable<java.lang.String,java.lang.String> attributes

objects

protected java.util.Hashtable<java.lang.String,java.lang.Object> objects
Constructor Detail

XHtmlStyle

public XHtmlStyle(java.lang.String styleName)
Creates a new instance of XHtmlStyle

Parameters:
styleName - the name of teh style as defined in the style sheet
Method Detail

getAttribute

public java.lang.String getAttribute(java.lang.String attribName)
Get a style attribute

Parameters:
attribName - the attribute name
Returns:
the attribute value

getFont

public java.awt.Font getFont()
Get the Font setup by this style

Returns:
the font

getForeground

public java.awt.Color getForeground(boolean returnDefault)
Get the foreground color defined by this style, if any. Otherwise black is returned.

Parameters:
returnDefault - return the default value if no attribute is specified
Returns:
the foreground color or null if no default is specified and returnDefault is false

getBackground

public java.awt.Color getBackground(boolean returnDefault)
Get the background color defined by this style, if any. Otherwise whiye is returned.

Parameters:
returnDefault - return the default value if no attribute is specified
Returns:
the background color or null if no default is specified and returnDefault is false

parse

public void parse(java.lang.String css)
Parse a CSS string

Parameters:
the - css string containing a single style style