org.apache.pivot.wtk
Class Component.StyleDictionary

java.lang.Object
  extended by org.apache.pivot.wtk.Component.StyleDictionary
All Implemented Interfaces:
Iterable<String>, Dictionary<String,Object>
Enclosing class:
Component

public final class Component.StyleDictionary
extends Object
implements Dictionary<String,Object>, Iterable<String>

Style dictionary implementation.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Dictionary
Dictionary.Pair<K,V>
 
Method Summary
 boolean containsKey(String key)
          Tests the existence of a key in the dictionary.
 Object get(String key)
          Retrieves the value for the given key.
 Class<?> getType(String key)
           
 boolean isReadOnly(String key)
           
 Iterator<String> iterator()
           
 Object put(String key, Object value)
          Stores the supplied value for the specified style.
 Object remove(String key)
          Removes a key/value pair from the map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public Object get(String key)
Description copied from interface: Dictionary
Retrieves the value for the given key.

Specified by:
get in interface Dictionary<String,Object>
Parameters:
key - The key whose value is to be returned.
Returns:
The value corresponding to key, or null if the key does not exist. Will also return null if the key refers to a null value. Use containsKey() to distinguish between these two cases.

put

public Object put(String key,
                  Object value)
Stores the supplied value for the specified style.

NOTE The current implementation always returns null due to the use of BeanAdapter to set the the new value. (BeanAdapter does not look up the previous value for performance reasons)

This also means that the logic determining whether to fire the the event differs from other Pivot event firing code. The event will be fired each time this method is executed, regardless of whether the new value differs from the old value or not.

This behaviour may change in the future so should not be relied upon.

Specified by:
put in interface Dictionary<String,Object>
Parameters:
key - Style whose value will be overwritten
value - Value to be stored
Returns:
The previous value of the specified style (See note above)
See Also:
BeanAdapter.put(String, Object)

remove

public Object remove(String key)
Description copied from interface: Dictionary
Removes a key/value pair from the map.

Specified by:
remove in interface Dictionary<String,Object>
Parameters:
key - The key whose mapping is to be removed.
Returns:
The value that was removed.

containsKey

public boolean containsKey(String key)
Description copied from interface: Dictionary
Tests the existence of a key in the dictionary.

Specified by:
containsKey in interface Dictionary<String,Object>
Parameters:
key - The key whose presence in the dictionary is to be tested.
Returns:
true if the key exists in the dictionary; false, otherwise.

isReadOnly

public boolean isReadOnly(String key)

getType

public Class<?> getType(String key)

iterator

public Iterator<String> iterator()
Specified by:
iterator in interface Iterable<String>