View Javadoc

1   package pl.aislib.text.html.table;
2   
3   import pl.aislib.text.html.attrs.AttributesSet;
4   import pl.aislib.text.html.attrs.CDataAttribute;
5   import pl.aislib.text.html.attrs.EnumeratedAttribute;
6   
7   /***
8    * Represents HTML <tt>table</tt> element.
9    * Defines 
10   * <ul>
11   * <li>attributes inherited from {@link AbstractTableObject}</li>
12   * <li>and following attributes:
13   *   <ul>
14   *     <li>bgcolor</li>
15   *     <li>border</li>
16   *     <li>cellpadding</li>
17   *     <li>cellspacing</li>
18   *     <li>frame</li>
19   *     <li>rules</li>
20   *     <li>summary</li>
21   *     <li>width</li>
22   *   </ul>
23   * </li>
24   * <li>any content</li> 
25   * </ul>
26   * </p>
27   * @author <a href="mailto:warlock@ais.pl?subject=AISLIB - Table">Michal Jastak</a>
28   * @version $Revision: 1.2 $
29   * @since AISLIB 0.2
30   */
31  public class Table extends AbstractTableObject {
32  
33    /***
34     * Constructor.
35     */
36    public Table() {
37      super("table");
38      AttributesSet attrs = new AttributesSet();
39      try {
40        attrs.add(new CDataAttribute("bgcolor"));
41        attrs.add(new CDataAttribute("border"));
42        attrs.add(new CDataAttribute("cellpadding"));
43        attrs.add(new CDataAttribute("cellspacing"));
44  
45        EnumeratedAttribute enAttr = new EnumeratedAttribute("frame");
46        enAttr.addAllowedValue("above");
47        enAttr.addAllowedValue("below");
48        enAttr.addAllowedValue("border");
49        enAttr.addAllowedValue("box");
50        enAttr.addAllowedValue("hsides");
51        enAttr.addAllowedValue("lhs");
52        enAttr.addAllowedValue("rhs");
53        enAttr.addAllowedValue("void");
54        enAttr.addAllowedValue("vsides");
55        attrs.add(enAttr);
56  
57        enAttr = new EnumeratedAttribute("rules");
58        enAttr.addAllowedValue("all");
59        enAttr.addAllowedValue("cols");
60        enAttr.addAllowedValue("groups");
61        enAttr.addAllowedValue("none");
62        enAttr.addAllowedValue("rows");
63        attrs.add(enAttr);
64  
65        attrs.add(new CDataAttribute("summary"));
66        attrs.add(new CDataAttribute("width"));
67  
68      } catch (ClassNotFoundException cnfe) {
69        ; // nop
70      }
71      addAttributesSet(attrs);
72    }
73    
74  } // class