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 ActionCell extends Cell { 22 private List buttons_ ; 23 24 public ActionCell() { 25 buttons_ = new ArrayList (3) ; 26 } 27 28 public ActionCell add(Button button) { 29 buttons_.add(button) ; 30 return this ; 31 } 32 33 public ActionCell add(boolean activate, Button button) { 34 if(!activate) { 35 button.setActivate(false) ; 36 } 37 buttons_.add(button) ; 38 return this ; 39 } 40 41 public void render(ResponseWriter w, ResourceBundle res, UIGrid uiGrid, String cellTag) throws IOException { 42 w.write("<td") ; 43 if(attributes_ != null) { 44 int size = attributes_.size() ; 45 for(int i = 0; i < size ; i++) { 46 Cell.Attribute attr = (Cell.Attribute) attributes_.get(i) ; 47 w.write(' '); w.write(attr.name_); w.write("='"); w.write(attr.value_);w.write('\'') ; 48 } 49 } 50 w.write('>') ; 51 for(int i = 0; i < buttons_.size(); i++) { 52 Button button = (Button)buttons_.get(i); 53 button.render(w, res, uiGrid) ; 54 } 55 w.write("</td>") ; 56 } 57 } | Popular Tags |