info.informatica.doc.style.css
Interface CSS2ComputedProperties

All Known Implementing Classes:
ComputedCSSStyle, DOM4JCSSStyleDeclaration, DOMCSSStyleDeclaration

public interface CSS2ComputedProperties

Interface that allows the retrieval of the primitive, "computed" values of CSS properties for practical use in formatting.

Classes implementing this interface must inherit the elements as necessary to get the final primitive values and not relative 'inherited' ones. Whenever possible, values intended to be 'used' (as opposed to simply 'computed' values) should be returned. See paragraph 6.1 of the CSS specification for the differences between 'computed' and 'used' values.

Author:
Carlos Amengual (amengual at informatica.info)

Method Summary
 float computeFloatValue(CSSNumberValue cssValue)
          Computes the value, in the device's natural unit, of the given number value.
 org.w3c.dom.css.CSSPrimitiveValue getBackgroundColor()
          Gets the primitive, computed value for the 'background-color' property.
 String getBackgroundImage()
          Gets the computed value for the 'background-image' property.
 URL getBaseURL()
          Gets the base URL that should be used to resolve relative URLs in property values.
 org.w3c.dom.css.CSSPrimitiveValue getColor()
          Gets the primitive, computed value for the 'color' property.
 String getFontFamily()
          Gets the 'used' value for the font-family property.
 int getFontSize()
          Gets the computed value of the font-size property.
 String getFontWeight()
          Gets the computed font weight.
 CSS2ComputedProperties getParentComputedStyle()
          Gets the computed style for the parent element.
 Node getPeerNode()
          Gets the peer node.
 String getPeerXPath()
          Gets the XPath of the node to which this style applies.
 org.w3c.dom.css.CSSValue getPropertyCSSValue(String propertyName)
          Retrieves the computed object representation of the value of a CSS property.
 String getPropertyValue(String propertyName)
          Retrieves the String value of a CSS property.
 StyleDatabase getStyleDatabase()
          Gets the style database used to compute the style.
 

Method Detail

getPropertyCSSValue

org.w3c.dom.css.CSSValue getPropertyCSSValue(String propertyName)
Retrieves the computed object representation of the value of a CSS property. This method returns null if the property is a shorthand property.

Parameters:
propertyName - The name of the CSS property.
Returns:
the object value of the property.

getPropertyValue

String getPropertyValue(String propertyName)
Retrieves the String value of a CSS property.

Parameters:
propertyName - The name of the CSS property. See the CSS property index.
Returns:
the value of the property.

computeFloatValue

float computeFloatValue(CSSNumberValue cssValue)
Computes the value, in the device's natural unit, of the given number value.

Usage note: after calling this method, check whether the CSS value is a percentage, and if the returned float is different from zero, then compute the percentage base and apply to it.

Parameters:
cssValue - the CSS value representing a number.
Returns:
the float value in the device's natural unit, or the value of a percentage if the value is a percentage.

getColor

org.w3c.dom.css.CSSPrimitiveValue getColor()
Gets the primitive, computed value for the 'color' property.

Returns:
the value for the 'color' property.

getBackgroundColor

org.w3c.dom.css.CSSPrimitiveValue getBackgroundColor()
Gets the primitive, computed value for the 'background-color' property.

Returns:
the value for the 'background-color' property.

getBackgroundImage

String getBackgroundImage()
Gets the computed value for the 'background-image' property.

Returns:
the value for the 'background-image' property, or null if no background image was set for the element.

getFontFamily

String getFontFamily()
Gets the 'used' value for the font-family property.

This method requires a style database.

Returns:
the value of the font-family property.
Throws:
IllegalStateException - if the style database has not been set.

getFontWeight

String getFontWeight()
Gets the computed font weight.

Returns:
the font weight.

getFontSize

int getFontSize()
Gets the computed value of the font-size property.

May require a style database to work.

Returns:
the value of the font-size property, in typographic points.

getBaseURL

URL getBaseURL()
Gets the base URL that should be used to resolve relative URLs in property values.

Returns:
the base URL, or null if could not be determined.

getPeerNode

Node getPeerNode()
Gets the peer node.

Returns:
the peer node.

getPeerXPath

String getPeerXPath()
Gets the XPath of the node to which this style applies.

Returns:
the XPath of the node.

getParentComputedStyle

CSS2ComputedProperties getParentComputedStyle()
Gets the computed style for the parent element.

Returns:
the computed style for the parent element, or null if there is no parent element, or has no style associated.

getStyleDatabase

StyleDatabase getStyleDatabase()
Gets the style database used to compute the style.

Returns:
the style database.


Copyright © 2011 informatica.info. All Rights Reserved.