jdk/src/share/classes/javax/swing/text/html/parser/Element.java
changeset 18764 12a1993f109b
parent 5506 202f599c92aa
child 21278 ef8a3a2a72f2
equal deleted inserted replaced
18763:5d31d298e4d4 18764:12a1993f109b
    26 package javax.swing.text.html.parser;
    26 package javax.swing.text.html.parser;
    27 
    27 
    28 import java.util.Hashtable;
    28 import java.util.Hashtable;
    29 import java.util.BitSet;
    29 import java.util.BitSet;
    30 import java.io.*;
    30 import java.io.*;
       
    31 import sun.awt.AppContext;
    31 
    32 
    32 /**
    33 /**
    33  * An element as described in a DTD using the ELEMENT construct.
    34  * An element as described in a DTD using the ELEMENT construct.
    34  * This is essentiall the description of a tag. It describes the
    35  * This is essentiall the description of a tag. It describes the
    35  * type, content model, attributes, attribute types etc. It is used
    36  * type, content model, attributes, attribute types etc. It is used
    49     public BitSet exclusions;
    50     public BitSet exclusions;
    50     public int type = ANY;
    51     public int type = ANY;
    51     public ContentModel content;
    52     public ContentModel content;
    52     public AttributeList atts;
    53     public AttributeList atts;
    53 
    54 
    54     static int maxIndex = 0;
       
    55 
       
    56     /**
    55     /**
    57      * A field to store user data. Mostly used to store
    56      * A field to store user data. Mostly used to store
    58      * style sheets.
    57      * style sheets.
    59      */
    58      */
    60     public Object data;
    59     public Object data;
    66      * Create a new element.
    65      * Create a new element.
    67      */
    66      */
    68     Element(String name, int index) {
    67     Element(String name, int index) {
    69         this.name = name;
    68         this.name = name;
    70         this.index = index;
    69         this.index = index;
    71         maxIndex = Math.max(maxIndex, index);
    70         if (index > getMaxIndex()) {
       
    71             AppContext.getAppContext().put(MAX_INDEX_KEY, index);
       
    72         }
       
    73     }
       
    74 
       
    75     private static final Object MAX_INDEX_KEY = new Object();
       
    76 
       
    77     static int getMaxIndex() {
       
    78         Integer value = (Integer) AppContext.getAppContext().get(MAX_INDEX_KEY);
       
    79         return (value != null)
       
    80                 ? value.intValue()
       
    81                 : 0;
    72     }
    82     }
    73 
    83 
    74     /**
    84     /**
    75      * Get the name of the element.
    85      * Get the name of the element.
    76      */
    86      */