KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > faces > core > component > model > Row


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.faces.core.component.model;
6
7 import java.util.List JavaDoc ;
8 import java.util.ArrayList JavaDoc ;
9 import java.util.ResourceBundle JavaDoc ;
10 import java.io.IOException JavaDoc ;
11 import javax.faces.context.ResponseWriter ;
12 import org.exoplatform.faces.core.component.UIGrid;
13
14 /**
15  * Wed, Dec 22, 2003 @ 23:14
16  * @author: Tuan Nguyen
17  * @email: tuan08@users.sourceforge.net
18  * @version: $Id: Row.java,v 1.4 2004/07/01 14:20:50 tuan08 Exp $
19  */

20 public class Row implements HtmlFragment {
21   protected List JavaDoc cells_ ;
22   protected String JavaDoc clazz_ ;
23   protected boolean visible_ ;
24
25   public Row() {
26     cells_ = new ArrayList JavaDoc() ;
27     visible_ = true ;
28   }
29   
30   public Row add(Cell cell) {
31     cells_.add(cell) ;
32     return this ;
33   }
34   
35   public boolean isVisible() { return visible_ ; }
36   public Row setVisible(boolean b) {
37     visible_ = b ;
38     return this ;
39   }
40   
41   final public List JavaDoc getCells() { return cells_ ; }
42
43   public String JavaDoc getClazz() { return clazz_ ; }
44   public Row setClazz(String JavaDoc clazz) {
45     clazz_ = clazz ;
46     return this ;
47   }
48
49   public void render(ResponseWriter w, ResourceBundle JavaDoc res, UIGrid uiParent) throws IOException JavaDoc {
50     if(!visible_) return ;
51     w.write("<tr") ;
52     if(clazz_ != null) {
53       w.write(" class=\"");w.write(clazz_);w.write("\"") ;
54     }
55     w.write(">\n") ;
56     for (int i = 0 ; i < cells_.size() ; i++) {
57       Cell cell = (Cell) cells_.get(i) ;
58       cell.render(w, res, uiParent , "td") ;
59     }
60     w.write("</tr>\n") ;
61   }
62
63 }
Popular Tags