1 5 package org.exoplatform.faces.core.component.model; 6 7 import java.io.IOException ; 8 import java.util.ArrayList ; 9 import java.util.List ; 10 import java.util.ResourceBundle ; 11 12 import javax.faces.context.ResponseWriter; 13 import org.exoplatform.faces.core.component.UIGrid; 14 15 21 public class ActionColumn extends Column { 22 private List buttons_ ; 23 24 public ActionColumn(String header, String fieldName) { 25 super(header, fieldName) ; 26 buttons_ = new ArrayList (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 res, 43 UIGrid uiParent, DataHandler dhandler) throws IOException { 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 |