Oracle UIX API Reference
Release 2.1.22.0.0
B12196-01

oracle.cabo.style.util
Class CSSUtils

java.lang.Object
  |
  +--oracle.cabo.style.util.CSSUtils

public class CSSUtils
extends java.lang.Object

CSS-related utilities.


Constructor Summary
CSSUtils()
           
 
Method Summary
static java.lang.String getColorValue(java.awt.Color color)
          Converts the specified Color to a valid CSS color value.
static java.util.Enumeration getStyleClasses(java.lang.String selector)
          Returns an Enumeration of all of the style class selectors included in the specified selector.
static boolean isStyleClassSelector(java.lang.String selector)
          Tests whether the specified selector is a simple style class selector.
static java.awt.Color parseColor(java.lang.String value)
          Parses the CSS color value.
static java.lang.String[] parseFontFamilies(java.lang.String value)
          Parses a CSS font family value into a list of font family names.
static java.lang.Integer parseFontSize(java.lang.String value)
          Parses a CSS font size.
static java.lang.Object parseFontStyle(java.lang.String value)
          Parses a CSS font style
static java.lang.Object parseFontWeight(java.lang.String value)
          Parses a CS font weight
static java.lang.Integer parseLength(java.lang.String value)
          Parses a CSS length value.
static void writeCSS(StyleContext context, StyleNode[] styles, java.io.PrintWriter out, java.io.File outputFile)
          Converts the specified set of StyleNodes to CSS.
static void writeCSS(StyleContext context, StyleNode[] styles, java.io.PrintWriter out, java.io.File outputFile, java.util.Dictionary shortStyleClassMap)
          Converts the specified set of StyleNodes to CSS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSSUtils

public CSSUtils()
Method Detail

parseColor

public static java.awt.Color parseColor(java.lang.String value)
                                 throws PropertyParseException
Parses the CSS color value.
Parameters:
value - A CSS color value.
Returns:
A Color object which corresponds to the provided value
Throws:
PropertyParseException - Thrown if the specified color value can not be parsed.

parseFontFamilies

public static java.lang.String[] parseFontFamilies(java.lang.String value)
                                            throws PropertyParseException
Parses a CSS font family value into a list of font family names.
Parameters:
value - A CSS font family value.
Returns:
The list of font family names present in the font family property
Throws:
PropertyParseException - Thrown if the specified font family value can not be parsed.

parseFontSize

public static java.lang.Integer parseFontSize(java.lang.String value)
                                       throws PropertyParseException
Parses a CSS font size.
Parameters:
value - A CSS font size value. At the moment, all font sizes must be specified in points (eg. "12pt").
Returns:
An Integer font size suitable for use as an AWT Font size
Throws:
PropertyParseException - Thrown if the specified font size value can not be parsed.

parseFontStyle

public static java.lang.Object parseFontStyle(java.lang.String value)
                                       throws PropertyParseException
Parses a CSS font style
Parameters:
value - A CSS font style value.
Returns:
An integer font style suitable for use as an AWT Font style
Throws:
PropertyParseException - Thrown if the specified font style value can not be parsed.

parseFontWeight

public static java.lang.Object parseFontWeight(java.lang.String value)
                                        throws PropertyParseException
Parses a CS font weight
Parameters:
value - A CSS font weight value. At the moment, all font weights must be specified as either "bold" or "normal".
Returns:
An integer font weight suitable for use as the weight component of an AWT Font style
Throws:
PropertyParseException - Thrown if the specified font weight value can not be parsed.

parseLength

public static java.lang.Integer parseLength(java.lang.String value)
                                     throws PropertyParseException
Parses a CSS length value.
Parameters:
value - A CSS length value.
Returns:
An Integer font size representing the length
Throws:
PropertyParseException - Thrown if the specified value can not be parsed.

writeCSS

public static void writeCSS(StyleContext context,
                            StyleNode[] styles,
                            java.io.PrintWriter out,
                            java.io.File outputFile)
Converts the specified set of StyleNodes to CSS.
Parameters:
context - The current StyleContext
styles - The style nodes to convert
out - The PrintWriter to write to

writeCSS

public static void writeCSS(StyleContext context,
                            StyleNode[] styles,
                            java.io.PrintWriter out,
                            java.io.File outputFile,
                            java.util.Dictionary shortStyleClassMap)
Converts the specified set of StyleNodes to CSS.
Parameters:
context - The current StyleContext
styles - The style nodes to convert
out - The PrintWriter to write to
shortStyleClassMap - A Dictionary which maps style class names to short names.

getColorValue

public static java.lang.String getColorValue(java.awt.Color color)
Converts the specified Color to a valid CSS color value.

isStyleClassSelector

public static boolean isStyleClassSelector(java.lang.String selector)
Tests whether the specified selector is a simple style class selector.

getStyleClasses

public static java.util.Enumeration getStyleClasses(java.lang.String selector)
Returns an Enumeration of all of the style class selectors included in the specified selector. For example, ".OraNav1Enabled" returns a single element Enumeration with the string ".OraNav1Enabled". "P.OraNav1Enabled SPAN.text" returns a two element Enumeration with ".OraNav1Enabled" and ".text".

Oracle UIX API Reference
Release 2.1.22.0.0
B12196-01

Copyright © 2002,2003, Oracle. All Rights Reserved.