KickJava   Java API By Example, From Geeks To Geeks.

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


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.io.IOException JavaDoc;
8 import java.util.ArrayList JavaDoc;
9 import java.util.List JavaDoc;
10 import java.util.ResourceBundle JavaDoc;
11
12 import javax.faces.context.ResponseWriter;
13 import org.exoplatform.faces.core.component.UIGrid;
14
15 /**
16  * Jun 30, 2004
17  * @author: Tuan Nguyen
18  * @email: tuan08@users.sourceforge.net
19  * @version: $Id: ActionColumn.java,v 1.4 2004/07/02 04:41:04 tuan08 Exp $
20  */

21 public class ActionColumn extends Column {
22   private List JavaDoc buttons_ ;
23     
24     public ActionColumn(String JavaDoc header, String JavaDoc fieldName) {
25         super(header, fieldName) ;
26     buttons_ = new ArrayList JavaDoc(3) ;
27   }
28   
29   public ActionColumn add(Button button) {
30     buttons_.add(button) ;
31     return this ;
32   }
33   
34   public ActionColumn add(boolean activate, Button button) {
35     if(!activate) {
36       button.setActivate(false) ;
37     }
38     buttons_.add(button) ;
39     return this ;
40   }
41   
42   public void render(ResponseWriter w, ResourceBundle JavaDoc res,
43       UIGrid uiParent, DataHandler dhandler) throws IOException JavaDoc {
44     if(clazz_ == null) {
45       w.write("<td>");
46     } else {
47       w.write("<td class='"); w.write(clazz_); w.write("'>");
48     }
49     for(int i = 0; i < buttons_.size(); i++) {
50       Button button = (Button)buttons_.get(i);
51       button.render(w, res, uiParent, dhandler.getData(fieldName_)) ;
52     }
53     w.write("</td>") ;
54   }
55 }
Popular Tags