KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.exoplatform.text.template.DataHandler;
11 /**
12  * @author Tuan Nguyen (tuan08@users.sourceforge.net)
13  * @since Feb 1, 2005
14  * @version $Id$
15  */

16 public class Div extends Text {
17   
18   public Div() {
19     super(null) ;
20   }
21   
22   public Div(String JavaDoc text) {
23     super(text) ;
24   }
25   
26   public void render(XhtmlDataHandlerManager manager,
27                      ResourceBundle JavaDoc res, Writer JavaDoc w) throws IOException JavaDoc {
28     if(cssClass_ == null ) {
29       w.write("<div>") ;
30     } else {
31       w.write("<div class='") ; w.write(cssClass_); w.write("'>") ;
32     }
33     if(data_ != null) {
34       DataHandler dh = manager.getDataHandler(dataHandlerType_) ;
35       w.write(resolveValueAsString(data_ ,dh, res)) ;
36     }
37     if(children_.length > 0) {
38       for(int i = 0 ; i < children_.length; i++) {
39         children_[i].render(manager, res, w) ;
40       }
41     }
42     w.write("</div>") ;
43   }
44   
45 }
Popular Tags