net.sf.jolene.html
Class Styles

java.lang.Object
  extended by net.sf.jolene.html.Styles
All Implemented Interfaces:
ICollection, IStyles

public final class Styles
extends java.lang.Object
implements IStyles

Class to manage a style string.

Since:
Aug 3, 2008 6:09:50 PM
Author:
Dan Howard

Constructor Summary
Styles()
          Default style constructor
Styles(java.lang.String styles)
          Construct a style object passing in formatted style string.
 
Method Summary
 void clear()
          Clears the styles.
 java.lang.String getStyle(java.lang.String key)
          Get a style based on a style name.
 boolean hasStyle(java.lang.String key)
          Indicates if a style exists.
 java.util.Set<java.lang.String> keySet()
          Returns a set of style keys from the Style.
 java.lang.String removeStyle(java.lang.String key)
          Removes a style from the Style object.
 void resetStyles(java.lang.String style)
          Sets the style based on the formatted style string, clearing all exisiting styles first.
 java.lang.String setStyle(java.lang.String key, java.lang.String value)
          Set a style on the Style object.
 void setStyles(java.lang.String style)
          Sets styles on the Style object based on a formatted style string.
 java.lang.String toString()
          Renders this Style as a style string.
 java.util.Collection<java.lang.String> values()
          Returns a Collection of Style values.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Styles

public Styles()
Default style constructor


Styles

public Styles(java.lang.String styles)
Construct a style object passing in formatted style string.

Parameters:
styles - formatted style string.
Method Detail

getStyle

public java.lang.String getStyle(java.lang.String key)
Get a style based on a style name.

Specified by:
getStyle in interface IStyles
Parameters:
key - case insensitive style name.
Returns:
String value for the specified style.

hasStyle

public boolean hasStyle(java.lang.String key)
Indicates if a style exists.

Specified by:
hasStyle in interface IStyles
Parameters:
key - case instensitive style key name.
Returns:
true if the style exists in the string.

keySet

public java.util.Set<java.lang.String> keySet()
Returns a set of style keys from the Style.

Specified by:
keySet in interface ICollection
Returns:
set of style keys from the Style.

removeStyle

public java.lang.String removeStyle(java.lang.String key)
Removes a style from the Style object.

Specified by:
removeStyle in interface IStyles
Parameters:
key - Style key name to remove.
Returns:
previous value associated with specified key, or null if there was no mapping for key.

clear

public void clear()
Clears the styles.

Specified by:
clear in interface ICollection

setStyle

public java.lang.String setStyle(java.lang.String key,
                                 java.lang.String value)
Set a style on the Style object.

Specified by:
setStyle in interface IStyles
Parameters:
key - Style key name.
value - Style value.
Returns:
previous value associated with specified key, or null if there was no mapping for key.

setStyles

public void setStyles(java.lang.String style)
Sets styles on the Style object based on a formatted style string. Expects the string to be in style format.

Specified by:
setStyles in interface IStyles
Parameters:
style - string in a format like azimuth:behind;background:aliceblue;background-color:aquamarine;border-bottom-style:solid;clip:auto;border-top-width:medium;

resetStyles

public void resetStyles(java.lang.String style)
Sets the style based on the formatted style string, clearing all exisiting styles first.

Specified by:
resetStyles in interface IStyles
Parameters:
style - string in a format like azimuth:behind;background:aliceblue;background-color:aquamarine;border-bottom-style:solid;clip:auto;border-top-width:medium;

values

public java.util.Collection<java.lang.String> values()
Returns a Collection of Style values.

Returns:
Collection of Style values.

toString

public java.lang.String toString()
Renders this Style as a style string.

Overrides:
toString in class java.lang.Object
Returns:
a string formatted for a style attribute.