/[classpath]/classpath/javax/swing/text/html/CSS.java
ViewVC logotype

Diff of /classpath/javax/swing/text/html/CSS.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by rabbit78, Fri Sep 9 20:33:55 2005 UTC revision 1.2 by smarothy, Tue Sep 27 02:38:21 2005 UTC
# Line 34  or based on this library.  If you modify Line 34  or based on this library.  If you modify
34  this exception to your version of the library, but you are not  this exception to your version of the library, but you are not
35  obligated to do so.  If you do not wish to do so, delete this  obligated to do so.  If you do not wish to do so, delete this
36  exception statement from your version. */  exception statement from your version. */
37    
38  package javax.swing.text.html;  package javax.swing.text.html;
39    
40    import java.util.HashMap;
41    
42  /**  /**
43   * Provides CSS attributes to be used by the HTML view classes. The constants   * Provides CSS attributes to be used by the HTML view classes. The constants
44   * defined here are used as keys for text attributes for use in   * defined here are used as keys for text attributes for use in
# Line 45  package javax.swing.text.html; Line 48  package javax.swing.text.html;
48   */   */
49  public class CSS  public class CSS
50  {  {
51      /**
52       * Returns an array of all CSS attributes.
53       *
54       * @return All available CSS.Attribute objects.
55       */
56      public static CSS.Attribute[] getAllAttributeKeys()
57      {
58        Object[] src = Attribute.attributeMap.values().toArray();
59        CSS.Attribute[] dst = new CSS.Attribute[ src.length ];
60        System.arraycopy(src, 0, dst, 0, src.length);
61        return dst;
62      }
63    
64      /**
65       * Returns an a given CSS attribute.
66       *
67       * @param name - The name of the attribute.
68       * @return The CSS attribute with the given name, or <code>null</code> if
69       * no attribute with that name exists.
70       */
71      public static CSS.Attribute getAttribute(String name)
72      {
73        return (CSS.Attribute)Attribute.attributeMap.get( name );
74      }
75    
76    public static final class Attribute    public static final class Attribute
77    {    {
# Line 377  public class CSS Line 404  public class CSS
404      String defaultValue;      String defaultValue;
405    
406      /**      /**
407         * A HashMap of all attributes.
408         */
409        static HashMap attributeMap;
410    
411        /**
412       * Creates a new Attribute instance with the specified values.       * Creates a new Attribute instance with the specified values.
413       *       *
414       * @param attr the attribute string       * @param attr the attribute string
# Line 388  public class CSS Line 420  public class CSS
420        attStr = attr;        attStr = attr;
421        isInherited = inherited;        isInherited = inherited;
422        defaultValue = def;        defaultValue = def;
423          if( attributeMap == null)
424            attributeMap = new HashMap();
425          attributeMap.put( attr, this );
426      }      }
427    
428      /**      /**

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26