KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > text > template > xhtml > Table


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.text.template.xhtml;
6
7 import java.io.IOException JavaDoc;
8 import java.io.Writer JavaDoc;
9 import java.util.ResourceBundle JavaDoc;
10 /**
11  * @author Tuan Nguyen (tuan08@users.sourceforge.net)
12  * @since Feb 1, 2005
13  * @version $Id$
14  */

15 public class Table extends Element {
16   
17   public Table() { }
18   
19   public Element add(Element element) {
20     if(element instanceof Row ||
21        element instanceof Rows) {
22       return super.add(element) ;
23     }
24     throw new RuntimeException JavaDoc("expect element type of Row or Rows") ;
25   }
26   
27   public void render(XhtmlDataHandlerManager manager,
28                      ResourceBundle JavaDoc res, Writer JavaDoc w) throws IOException JavaDoc {
29     if(cssClass_ == null) {
30       w.write("<table>") ;
31     } else {
32       w.write("<table class='") ; w.write(cssClass_); w.write("'>") ;
33     }
34     for(int i = 0 ; i < children_.length; i++) {
35       children_[i].render(manager, res, w) ;
36     }
37     w.write("</table>") ;
38   }
39 }
Popular Tags