org.ajax4jsf.util.style
Class CSSFormat

java.lang.Object
  extended by org.ajax4jsf.util.style.CSSFormat

public class CSSFormat
extends java.lang.Object

Simple utility class for CSS style formatting Current version isn't thread-safe and doesn't provide any validation Usage is simle CSSFormat format = new CSSFormat(); format.add("background-position", "top left"); format.addURL("background-image", "/images/corner.gif"); responseWriter.writeAttribute("style", format, null);

Author:
Maksim Kaszynski

Constructor Summary
CSSFormat()
          Constructs an empty CSSFormat object
CSSFormat(java.lang.String property, java.lang.String value)
          Constructs CSSFormat object and fills it with given parameters
 
Method Summary
 CSSFormat add(java.lang.String property, java.lang.String value)
          Adds property.
 CSSFormat addURL(java.lang.String property, java.lang.String url)
          adds a property with URL value given value is wrapped in url() clause
 java.lang.String concatenate(java.lang.String separator)
          Concatenates all properties with their values to produce CSS output
static java.lang.String propertyValue(java.lang.String property, java.lang.String value)
          Formats property-value pair in CSS fashion
 java.lang.String toString()
          Concatenates all properties with their values to produce single-line CSS output
static java.lang.String url(java.lang.String url)
          Surrounds given URL with url()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CSSFormat

public CSSFormat()
Constructs an empty CSSFormat object


CSSFormat

public CSSFormat(java.lang.String property,
                 java.lang.String value)
Constructs CSSFormat object and fills it with given parameters

Parameters:
property -
value -
Method Detail

url

public static java.lang.String url(java.lang.String url)
Surrounds given URL with url()

Parameters:
url -
Returns:

propertyValue

public static java.lang.String propertyValue(java.lang.String property,
                                             java.lang.String value)
Formats property-value pair in CSS fashion

Parameters:
property -
value -
Returns:

add

public CSSFormat add(java.lang.String property,
                     java.lang.String value)
Adds property. If such property already exists, its value is replaced with new one

Parameters:
property -
value -
Returns:
itself

addURL

public CSSFormat addURL(java.lang.String property,
                        java.lang.String url)
adds a property with URL value given value is wrapped in url() clause

Parameters:
property -
url -
Returns:
itself

toString

public java.lang.String toString()
Concatenates all properties with their values to produce single-line CSS output

Overrides:
toString in class java.lang.Object

concatenate

public java.lang.String concatenate(java.lang.String separator)
Concatenates all properties with their values to produce CSS output

Parameters:
separator - - custom string to be inserted between properties
Returns:


Copyright © 2010. All Rights Reserved.