/[classpath]/classpath/gnu/xml/dom/html2/DomHTMLTableElement.java
ViewVC logotype

Diff of /classpath/gnu/xml/dom/html2/DomHTMLTableElement.java

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

revision 1.1.2.1 by gnu_andrew, Sun Mar 13 14:38:33 2005 UTC revision 1.1.2.2 by gnu_andrew, Wed Mar 23 21:00:04 2005 UTC
# Line 37  exception statement from your version. * Line 37  exception statement from your version. *
37    
38  package gnu.xml.dom.html2;  package gnu.xml.dom.html2;
39    
40    import gnu.xml.dom.DomDOMException;
41    import org.w3c.dom.DOMException;
42    import org.w3c.dom.Node;
43  import org.w3c.dom.html2.HTMLCollection;  import org.w3c.dom.html2.HTMLCollection;
44  import org.w3c.dom.html2.HTMLElement;  import org.w3c.dom.html2.HTMLElement;
45  import org.w3c.dom.html2.HTMLTableCaptionElement;  import org.w3c.dom.html2.HTMLTableCaptionElement;
# Line 61  public class DomHTMLTableElement Line 64  public class DomHTMLTableElement
64    
65    public HTMLTableCaptionElement getCaption()    public HTMLTableCaptionElement getCaption()
66    {    {
67      // TODO      return (HTMLTableCaptionElement) getChildElement("caption");
     return null;  
68    }    }
69    
70    public void setCaption(HTMLTableCaptionElement caption)    public void setCaption(HTMLTableCaptionElement caption)
71    {    {
72      // TODO      HTMLTableCaptionElement ref = getCaption();
73        if (ref == null)
74          {
75            appendChild(caption);
76          }
77        else
78          {
79            replaceChild(caption, ref);
80          }
81    }    }
82        
83    public HTMLTableSectionElement getTHead()    public HTMLTableSectionElement getTHead()
84    {    {
85      // TODO      return (HTMLTableSectionElement) getChildElement("thead");
     return null;  
86    }    }
87    
88    public void setTHead(HTMLTableSectionElement tHead)    public void setTHead(HTMLTableSectionElement tHead)
89    {    {
90      // TODO      HTMLTableSectionElement ref = getTHead();
91        if (ref == null)
92          {
93            appendChild(tHead);
94          }
95        else
96          {
97            replaceChild(tHead, ref);
98          }
99    }    }
100    
101    public HTMLTableSectionElement getTFoot()    public HTMLTableSectionElement getTFoot()
102    {    {
103      // TODO      return (HTMLTableSectionElement) getChildElement("tfoot");
     return null;  
104    }    }
105    
106    public void setTFoot(HTMLTableSectionElement tFoot)    public void setTFoot(HTMLTableSectionElement tFoot)
107    {    {
108      // TODO      HTMLTableSectionElement ref = getTFoot();
109        if (ref == null)
110          {
111            appendChild(tFoot);
112          }
113        else
114          {
115            replaceChild(tFoot, ref);
116          }
117    }    }
118    
119    public HTMLCollection getRows()    public HTMLCollection getRows()
# Line 202  public class DomHTMLTableElement Line 226  public class DomHTMLTableElement
226    
227    public HTMLElement createTHead()    public HTMLElement createTHead()
228    {    {
229      // TODO      HTMLTableSectionElement ref = getTHead();
230      return null;      if (ref == null)
231          {
232            return (HTMLElement) getOwnerDocument().createElement("thead");
233          }
234        else
235          {
236            return ref;
237          }
238    }    }
239    
240    public void deleteTHead()    public void deleteTHead()
241    {    {
242      // TODO      HTMLTableSectionElement ref = getTHead();
243        if (ref != null)
244          {
245            removeChild(ref);
246          }
247    }    }
248    
249    public HTMLElement createTFoot()    public HTMLElement createTFoot()
250    {    {
251      // TODO      HTMLTableSectionElement ref = getTFoot();
252      return null;      if (ref == null)
253          {
254            return (HTMLElement) getOwnerDocument().createElement("tfoot");
255          }
256        else
257          {
258            return ref;
259          }
260    }    }
261    
262    public void deleteTFoot()    public void deleteTFoot()
263    {    {
264      // TODO      HTMLTableSectionElement ref = getTFoot();
265        if (ref != null)
266          {
267            removeChild(ref);
268          }
269    }    }
270    
271    public HTMLElement createCaption()    public HTMLElement createCaption()
272    {    {
273      // TODO      HTMLTableCaptionElement ref = getCaption();
274      return null;      if (ref == null)
275          {
276            return (HTMLElement) getOwnerDocument().createElement("caption");
277          }
278        else
279          {
280            return ref;
281          }
282    }    }
283    
284    public void deleteCaption()    public void deleteCaption()
285    {    {
286      // TODO      HTMLTableCaptionElement ref = getCaption();
287        if (ref != null)
288          {
289            removeChild(ref);
290          }
291    }    }
292    
293    public HTMLElement insertRow(int index)    public HTMLElement insertRow(int index)
294    {    {
295      // TODO      Node ref = getRow(index);
296      return null;      Node row = getOwnerDocument().createElement("tr");
297        if (ref == null)
298          {
299            Node tbody = getChildElement("tbody");
300            if (tbody == null)
301              {
302                tbody = getOwnerDocument().createElement("tfoot");
303                appendChild(tbody);
304              }
305            tbody.appendChild(row);
306          }
307        else
308          {
309            ref.getParentNode().insertBefore(row, ref);
310          }
311        return (HTMLElement) row;
312    }    }
313    
314    public void deleteRow(int index)    public void deleteRow(int index)
315    {    {
316      // TODO      Node ref = getRow(index);
317        if (ref == null)
318          {
319            throw new DomDOMException(DOMException.INDEX_SIZE_ERR);
320          }
321        ref.getParentNode().removeChild(ref);
322      }
323    
324      Node getRow(final int index)
325      {
326        int i = 0;
327        Node thead = getChildElement("thead");
328        if (thead != null)
329          {
330            for (Node ctx = thead.getFirstChild(); ctx != null;
331                 ctx = ctx.getNextSibling())
332              {
333                if (!"tr".equalsIgnoreCase(ctx.getLocalName()))
334                  {
335                    continue;
336                  }
337                if (index == i)
338                  {
339                    return ctx;
340                  }
341                i++;
342              }
343          }
344        Node tbody = getChildElement("tbody");
345        if (tbody == null)
346          {
347            tbody = this;
348          }
349        for (Node ctx = tbody.getFirstChild(); ctx != null;
350             ctx = ctx.getNextSibling())
351          {
352            if (!"tr".equalsIgnoreCase(ctx.getLocalName()))
353              {
354                continue;
355              }
356            if (index == i)
357              {
358                return ctx;
359              }
360            i++;
361          }
362        Node tfoot = getChildElement("tfoot");
363        if (tfoot != null)
364          {
365            for (Node ctx = tfoot.getFirstChild(); ctx != null;
366                 ctx = ctx.getNextSibling())
367              {
368                if (!"tr".equalsIgnoreCase(ctx.getLocalName()))
369                  {
370                    continue;
371                  }
372                if (index == i)
373                  {
374                    return ctx;
375                  }
376                i++;
377              }
378          }
379        return null;
380    }    }
381      
382  }  }
383    

Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.1.2.2

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