javax.swing.text.html
Class CSS.CssValue

java.lang.Object
  extended byjavax.swing.text.html.CSS.CssValue
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CSS.BackgroundImage, CSS.BackgroundPosition, CSS.BorderStyle, CSS.ColorValue, CSS.CssValueMapper, CSS.FontFamily, CSS.FontSize, CSS.FontWeight, CSS.LengthValue, CSS.StringValue
Enclosing class:
CSS

static class CSS.CssValue
extends Object
implements Serializable

Base class to CSS values in the attribute sets. This is intended to act as a convertor to/from other attribute formats.

The CSS parser uses the parseCssValue method to convert a string to whatever format is appropriate a given key (i.e. these convertors are stored in a map using the CSS.Attribute as a key and the CssValue as the value).

The HTML to CSS conversion process first converts the HTML.Attribute to a CSS.Attribute, and then calls the parseHtmlValue method on the value of the HTML attribute to produce the corresponding CSS value.

The StyleConstants to CSS conversion process first converts the StyleConstants attribute to a CSS.Attribute, and then calls the fromStyleConstants method to convert the StyleConstants value to a CSS value.

The CSS to StyleConstants conversion process first converts the StyleConstants attribute to a CSS.Attribute, and then calls the toStyleConstants method to convert the CSS value to a StyleConstants value.


Field Summary
(package private)  String svalue
          The value as a string... before conversion to a binary format.
 
Constructor Summary
(package private) CSS.CssValue()
           
 
Method Summary
(package private)  Object fromStyleConstants(StyleConstants key, Object value)
          Converts a StyleConstants attribute value to a CSS attribute value.
(package private)  Object parseCssValue(String value)
          Convert a CSS value string to the internal format (for fast processing) used in the attribute sets.
(package private)  Object parseHtmlValue(String value)
          Convert an HTML attribute value to a CSS attribute value.
 String toString()
          Return the CSS format of the value
(package private)  Object toStyleConstants(StyleConstants key, View v)
          Converts a CSS attribute value to a StyleConstants value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

svalue

String svalue
The value as a string... before conversion to a binary format.

Constructor Detail

CSS.CssValue

CSS.CssValue()
Method Detail

parseCssValue

Object parseCssValue(String value)
Convert a CSS value string to the internal format (for fast processing) used in the attribute sets. The fallback storage for any value that we don't have a special binary format for is a String.


parseHtmlValue

Object parseHtmlValue(String value)
Convert an HTML attribute value to a CSS attribute value. If there is no conversion, return null. This is implemented to simply forward to the CSS parsing by default (since some of the attribute values are the same). If the attribute value isn't recognized as a CSS value it is generally returned as null.


fromStyleConstants

Object fromStyleConstants(StyleConstants key,
                          Object value)
Converts a StyleConstants attribute value to a CSS attribute value. If there is no conversion, returns null. By default, there is no conversion.

Parameters:
key - the StyleConstants attribute
value - the value of a StyleConstants attribute to be converted
Returns:
the CSS value that represents the StyleConstants value

toStyleConstants

Object toStyleConstants(StyleConstants key,
                        View v)
Converts a CSS attribute value to a StyleConstants value. If there is no conversion, returns null. By default, there is no conversion.

Parameters:
key - the StyleConstants attribute
v - the view containing AttributeSet
Returns:
the StyleConstants attribute value that represents the CSS attribute value

toString

public String toString()
Return the CSS format of the value

Overrides:
toString in class Object
Returns:
a string representation of the object.