org.wings.style
Class CSSStyleSheet

java.lang.Object
  extended by org.wings.style.CSSStyleSheet
All Implemented Interfaces:
Serializable, Renderable, StyleSheet

public class CSSStyleSheet
extends Object
implements StyleSheet

See Also:
Serialized Form

Constructor Summary
CSSStyleSheet()
          Constructs an empty style sheet.
CSSStyleSheet(InputStream in)
          Constructs a new style sheet instance by parsing the passed input stream into read(java.io.InputStream).
 
Method Summary
static String getAttribute(Color color)
           
static CSSAttributeSet getAttributes(Color color, CSSProperty cssProperty)
           
static CSSAttributeSet getAttributes(Insets insets)
           
static CSSAttributeSet getAttributes(SFont font)
           
static Color getBackground(CSSAttributeSet a)
          Takes a set of attributes and turn it into a background color specification.
static SFont getFont(CSSAttributeSet a)
          Fetches the font to use for the given set of attributes.
static Color getForeground(CSSAttributeSet a)
          Takes a set of attributes and turn it into a foreground color specification.
static Insets getInsets(CSSAttributeSet a)
           
static float getLength(String value)
           
static URL getURL(URL base, String cssString)
           
 void importStyleSheet(URL url)
          Reads and imports a style sheet file accessible via the passed URL.
 boolean isFinal()
          Declares if this style sheet is final or may change during runtime.
 void putStyle(Style style)
          Register a Style in the style sheet.
 void read(InputStream inStream)
          Creates styles by parsing an input stream.
 Set<Style> styles()
          The Styles definitions contained in this style sheet.
 void write(Device out)
          Write each style in set to the device.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSSStyleSheet

public CSSStyleSheet()
Constructs an empty style sheet.


CSSStyleSheet

public CSSStyleSheet(InputStream in)
              throws IOException
Constructs a new style sheet instance by parsing the passed input stream into read(java.io.InputStream).

Parameters:
in - Input stream containing a valid CSS style sheet file.
Throws:
IOException
Method Detail

putStyle

public void putStyle(Style style)
Description copied from interface: StyleSheet
Register a Style in the style sheet.

Specified by:
putStyle in interface StyleSheet

styles

public Set<Style> styles()
Description copied from interface: StyleSheet
The Styles definitions contained in this style sheet.

Specified by:
styles in interface StyleSheet
Returns:
All set of Styles contained in this style sheet

write

public void write(Device out)
           throws IOException
Write each style in set to the device.

Specified by:
write in interface Renderable
Throws:
IOException

read

public void read(InputStream inStream)
          throws IOException
Creates styles by parsing an input stream.

Parameters:
inStream - Stream containing style sheet source
Throws:
IOException

importStyleSheet

public void importStyleSheet(URL url)
Reads and imports a style sheet file accessible via the passed URL.

Parameters:
url - The url of the style sheet file.

isFinal

public boolean isFinal()
Description copied from interface: StyleSheet
Declares if this style sheet is final or may change during runtime.

Specified by:
isFinal in interface StyleSheet
Returns:
true if the content of this style sheet will never change, false otherwise.

getFont

public static SFont getFont(CSSAttributeSet a)
Fetches the font to use for the given set of attributes.


getInsets

public static Insets getInsets(CSSAttributeSet a)

getAttributes

public static CSSAttributeSet getAttributes(Insets insets)

getLength

public static float getLength(String value)

getForeground

public static Color getForeground(CSSAttributeSet a)
Takes a set of attributes and turn it into a foreground color specification. This might be used to specify things like brighter, more hue, etc.

Parameters:
a - the set of attributes
Returns:
the color

getBackground

public static Color getBackground(CSSAttributeSet a)
Takes a set of attributes and turn it into a background color specification. This might be used to specify things like brighter, more hue, etc.

Parameters:
a - the set of attributes
Returns:
the color

getURL

public static URL getURL(URL base,
                         String cssString)

getAttributes

public static CSSAttributeSet getAttributes(SFont font)

getAttributes

public static CSSAttributeSet getAttributes(Color color,
                                            CSSProperty cssProperty)

getAttribute

public static String getAttribute(Color color)


wingS Swings ;-)