Class Component.StyleDictionary

  • All Implemented Interfaces:
    java.lang.Iterable<java.lang.String>, Dictionary<java.lang.String,​java.lang.Object>
    Enclosing class:
    Component

    public final class Component.StyleDictionary
    extends java.lang.Object
    implements Dictionary<java.lang.String,​java.lang.Object>, java.lang.Iterable<java.lang.String>
    Style dictionary implementation.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsKey​(java.lang.String key)
      Tests the existence of a key in the dictionary.
      boolean containsKey​(Style key)  
      java.lang.Object copy​(Style key, Dictionary<java.lang.String,​java.lang.Object> source)
      Copy the named style from one style dictionary to this one.
      java.lang.Object get​(java.lang.String key)
      Retrieves the value for the given key.
      java.lang.Object get​(Style key)  
      boolean getBoolean​(Style key)  
      java.awt.Color getColor​(Style key)  
      java.awt.Font getFont​(Style key)  
      int getInt​(Style key)  
      java.lang.Class<?> getType​(java.lang.String key)  
      java.lang.Class<?> getType​(Style key)  
      boolean isReadOnly​(java.lang.String key)  
      boolean isReadOnly​(Style key)  
      java.util.Iterator<java.lang.String> iterator()  
      java.lang.Object put​(java.lang.String key, java.lang.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.
      java.lang.Object put​(Style key, java.lang.Object value)  
      java.lang.Object remove​(java.lang.String key)
      Not supported here.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Method Detail

      • get

        public java.lang.Object get​(Style key)
      • get

        public java.lang.Object get​(java.lang.String key)
        Description copied from interface: Dictionary
        Retrieves the value for the given key.
        Specified by:
        get in interface Dictionary<java.lang.String,​java.lang.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 Dictionary.containsKey(K) to distinguish between these two cases.
      • getColor

        public java.awt.Color getColor​(Style key)
      • getFont

        public java.awt.Font getFont​(Style key)
      • getInt

        public int getInt​(Style key)
      • getBoolean

        public boolean getBoolean​(Style key)
      • put

        public java.lang.Object put​(Style key,
                                    java.lang.Object value)
      • put

        public java.lang.Object put​(java.lang.String key,
                                    java.lang.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 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<java.lang.String,​java.lang.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)
      • copy

        public java.lang.Object copy​(Style key,
                                     Dictionary<java.lang.String,​java.lang.Object> source)
        Copy the named style from one style dictionary to this one.
        Parameters:
        key - Style value to be copied.
        source - The source to copy from.
        Returns:
        The previous value in the target dictionary (but note the caveats from the put(String,Object) method.
      • remove

        @UnsupportedOperation
        public java.lang.Object remove​(java.lang.String key)
        Not supported here.
        Specified by:
        remove in interface Dictionary<java.lang.String,​java.lang.Object>
        Parameters:
        key - The key whose mapping is to be removed.
        Returns:
        The value that was removed.
        Throws:
        java.lang.UnsupportedOperationException - always.
      • containsKey

        public boolean containsKey​(Style key)
      • containsKey

        public boolean containsKey​(java.lang.String key)
        Description copied from interface: Dictionary
        Tests the existence of a key in the dictionary.
        Specified by:
        containsKey in interface Dictionary<java.lang.String,​java.lang.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​(Style key)
      • isReadOnly

        public boolean isReadOnly​(java.lang.String key)
      • getType

        public java.lang.Class<?> getType​(Style key)
      • getType

        public java.lang.Class<?> getType​(java.lang.String key)
      • iterator

        public java.util.Iterator<java.lang.String> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.String>