1:
37:
38: package ;
39:
40: import ;
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46:
47:
52: public class DomHTMLTableSectionElement
53: extends DomHTMLElement
54: implements HTMLTableSectionElement
55: {
56:
57: protected DomHTMLTableSectionElement(DomHTMLDocument owner,
58: String namespaceURI,
59: String name)
60: {
61: super(owner, namespaceURI, name);
62: }
63:
64: public String getAlign()
65: {
66: return getHTMLAttribute("align");
67: }
68:
69: public void setAlign(String align)
70: {
71: setHTMLAttribute("align", align);
72: }
73:
74: public String getCh()
75: {
76: return getHTMLAttribute("char");
77: }
78:
79: public void setCh(String ch)
80: {
81: setHTMLAttribute("char", ch);
82: }
83:
84: public String getChOff()
85: {
86: return getHTMLAttribute("charoff");
87: }
88:
89: public void setChOff(String chOff)
90: {
91: setHTMLAttribute("charoff", chOff);
92: }
93:
94: public String getVAlign()
95: {
96: return getHTMLAttribute("valign");
97: }
98:
99: public void setVAlign(String vAlign)
100: {
101: setHTMLAttribute("valign", vAlign);
102: }
103:
104: public HTMLCollection getRows()
105: {
106: DomHTMLCollection ret =
107: new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this);
108: ret.addNodeName("tr");
109: ret.evaluate();
110: return ret;
111: }
112:
113: public HTMLElement insertRow(int index)
114: {
115: Node ref = getRow(index);
116: Node row = getOwnerDocument().createElement("tr");
117: if (ref == null)
118: {
119: appendChild(row);
120: }
121: else
122: {
123: insertBefore(row, ref);
124: }
125: return (HTMLElement) row;
126: }
127:
128: public void deleteRow(int index)
129: {
130: Node ref = getRow(index);
131: if (ref == null)
132: {
133: throw new DomDOMException(DOMException.INDEX_SIZE_ERR);
134: }
135: removeChild(ref);
136: }
137:
138: Node getRow(final int index)
139: {
140: int i = 0;
141: for (Node ctx = getFirstChild(); ctx != null;
142: ctx = ctx.getNextSibling())
143: {
144: String name = ctx.getLocalName();
145: if (name == null)
146: {
147: name = ctx.getNodeName();
148: }
149: if (!"tr".equalsIgnoreCase(name))
150: {
151: continue;
152: }
153: if (index == i)
154: {
155: return ctx;
156: }
157: i++;
158: }
159: return null;
160: }
161:
162: }