NextApp Echo2
v2.1.1

nextapp.echo2.webcontainer.propertyrender
Class ExtentRender

java.lang.Object
  extended by nextapp.echo2.webcontainer.propertyrender.ExtentRender

public class ExtentRender
extends java.lang.Object

Utility class for rendering nextapp.echo2.app.Extent properties to CSS.


Method Summary
static boolean isZeroLength(nextapp.echo2.app.Extent extent)
          Determines if the given Extent is of zero length.
static java.lang.String renderCssAttributePixelValue(nextapp.echo2.app.Extent extent)
          Attempts to render a given Extent to a pixel CSS attribute value.
static java.lang.String renderCssAttributePixelValue(nextapp.echo2.app.Extent extent, java.lang.String invalidValue)
          Attempts to render a given Extent to a pixel CSS attribute value.
static java.lang.String renderCssAttributeValue(nextapp.echo2.app.Extent extent)
          Renders an Extent property value to a CSS dimensioned attribute value.
static java.lang.String renderCssAttributeValueHalf(nextapp.echo2.app.Extent extent)
          Renders 1/2 the distance specified by an Extent property value to a CSS dimensioned attribute.
static void renderToStyle(nextapp.echo2.webrender.output.CssStyle cssStyle, java.lang.String cssAttribute, nextapp.echo2.app.Extent extent)
          Renders an Extent property to the given CSS style.
static java.lang.String renderUnits(int units)
          Renders the given Extent units constant into a CSS unit suffix.
static nextapp.echo2.app.Extent toExtent(java.lang.String extentString)
          Creates an Extent from the given CSS dimensioned attribute value.
static int toPixels(nextapp.echo2.app.Extent extent, int defaultPixels)
          Attempts to convert a given Extent to a pixel value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isZeroLength

public static boolean isZeroLength(nextapp.echo2.app.Extent extent)
Determines if the given Extent is of zero length. This method interprets null Extents to be of zero length.

Parameters:
extent - the extent
Returns:
true if the extent is of zero length

renderCssAttributePixelValue

public static final java.lang.String renderCssAttributePixelValue(nextapp.echo2.app.Extent extent)
Attempts to render a given Extent to a pixel CSS attribute value. Returns null if the the extent can not be represented by a pixel value.

Parameters:
extent - the property value
Returns:
the CSS attribute value

renderCssAttributePixelValue

public static final java.lang.String renderCssAttributePixelValue(nextapp.echo2.app.Extent extent,
                                                                  java.lang.String invalidValue)
Attempts to render a given Extent to a pixel CSS attribute value. Returns the specified invalidValue if the specified Extent is not valid.

Parameters:
extent - the property value
Returns:
the CSS attribute value to return if the provided value is not a valid pixel value

renderCssAttributeValue

public static final java.lang.String renderCssAttributeValue(nextapp.echo2.app.Extent extent)
Renders an Extent property value to a CSS dimensioned attribute value.

Parameters:
extent - the property value
Returns:
the CSS attribute value

renderCssAttributeValueHalf

public static final java.lang.String renderCssAttributeValueHalf(nextapp.echo2.app.Extent extent)
Renders 1/2 the distance specified by an Extent property value to a CSS dimensioned attribute. For example, an extent that would normally render as "3px" would be rendered as "1.5px" by this method.

Parameters:
extent - the property value
Returns:
the CSS attribute value

renderToStyle

public static final void renderToStyle(nextapp.echo2.webrender.output.CssStyle cssStyle,
                                       java.lang.String cssAttribute,
                                       nextapp.echo2.app.Extent extent)
Renders an Extent property to the given CSS style. Null property values are ignored.

Parameters:
cssStyle - the target CssStyle
cssAttribute - the CSS attribute name, e.g., "width" or "height".
extent - the property value

renderUnits

public static final java.lang.String renderUnits(int units)
Renders the given Extent units constant into a CSS unit suffix.

Parameters:
units - the Extent units constant value
Returns:
the CSS unit suffix

toExtent

public static final nextapp.echo2.app.Extent toExtent(java.lang.String extentString)
Creates an Extent from the given CSS dimensioned attribute value.

Parameters:
extentString - the CSS dimensioned attribute value
Returns:
an equivalent Extent, or null if the input is not valid.

toPixels

public static final int toPixels(nextapp.echo2.app.Extent extent,
                                 int defaultPixels)
Attempts to convert a given Extent to a pixel value. Returns defaultPixels if the conversion is not possible.

Parameters:
extent - the Extent to convert
defaultPixels - the pixel value to return if conversion is impossible.
Returns:
the value of the extent in pixels

NextApp Echo2
v2.1.1