org.wings.style
Class CSSAttributeSet

java.lang.Object
  extended by org.wings.style.CSSAttributeSet
All Implemented Interfaces:
Serializable, Cloneable, Renderable
Direct Known Subclasses:
CSSStyle

public class CSSAttributeSet
extends Object
implements Renderable, Serializable, Cloneable

A straightforward implementation of CSSPropertySet using a hash map.

Author:
Holger Engels
See Also:
Serialized Form

Field Summary
static CSSAttributeSet EMPTY_ATTRIBUTESET
          Empty immutable attribute set.
 
Constructor Summary
CSSAttributeSet()
          Creates a new, empty atribute set.
CSSAttributeSet(CSSAttributeSet source)
          Creates a new attribute set based on a supplied set of attributes.
CSSAttributeSet(CSSProperty cssProperty, String cssPropertyValue)
           
 
Method Summary
 void clear()
           
 Object clone()
          Clones a set of attributes.
 boolean contains(CSSProperty name)
          Tells whether a given attribute is defined.
 boolean equals(Object o)
           
 String get(CSSProperty property)
          Gets the value of an css property.
 int hashCode()
           
 boolean isEmpty()
          Checks whether the set of attributes is empty.
 Map<CSSProperty,String> properties()
          Gets the Set of defined CSS property names.
 String put(CSSProperty name, String value)
          Adds an attribute to the list.
 boolean putAll(CSSAttributeSet attributes)
          Adds a set of attributes to the list.
 String remove(CSSProperty name)
          Removes an attribute from the list.
 int size()
          Gets a count of the number of attributes.
 String toString()
          Converts the attribute set to a String.
 void write(Device d)
          Write style definition to the device
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_ATTRIBUTESET

public static final CSSAttributeSet EMPTY_ATTRIBUTESET
Empty immutable attribute set.

Constructor Detail

CSSAttributeSet

public CSSAttributeSet()
Creates a new, empty atribute set.


CSSAttributeSet

public CSSAttributeSet(CSSProperty cssProperty,
                       String cssPropertyValue)

CSSAttributeSet

public CSSAttributeSet(CSSAttributeSet source)
Creates a new attribute set based on a supplied set of attributes.

Parameters:
source - the set of attributes
Method Detail

isEmpty

public final boolean isEmpty()
Checks whether the set of attributes is empty.

Returns:
true if the set is empty else false

size

public final int size()
Gets a count of the number of attributes.

Returns:
the count

clear

public final void clear()

contains

public final boolean contains(CSSProperty name)
Tells whether a given attribute is defined.

Parameters:
name - the attribute name
Returns:
true if the attribute is defined

properties

public final Map<CSSProperty,String> properties()
Gets the Set of defined CSS property names.

Returns:
A set of CSSProperty for which this CSSAttributeSet contains a value.

get

public final String get(CSSProperty property)
Gets the value of an css property.

Parameters:
property - the attribute property
Returns:
the value

put

public String put(CSSProperty name,
                  String value)
Adds an attribute to the list.

Parameters:
name - the attribute name
value - the attribute value

putAll

public boolean putAll(CSSAttributeSet attributes)
Adds a set of attributes to the list.

Parameters:
attributes - the set of attributes to add

remove

public String remove(CSSProperty name)
Removes an attribute from the list.

Parameters:
name - the attribute name
Returns:
The previous value for this CSS property

clone

public Object clone()
Clones a set of attributes.

Overrides:
clone in class Object
Returns:
the new set of attributes

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

write

public void write(Device d)
           throws IOException
Write style definition to the device

Specified by:
write in interface Renderable
Throws:
IOException

toString

public String toString()
Converts the attribute set to a String.

Overrides:
toString in class Object
Returns:
the string


wingS Swings ;-)