1 5 package org.exoplatform.faces.core.component.model; 6 7 import java.io.IOException ; 8 import java.util.ResourceBundle ; 9 import javax.faces.context.ResponseWriter ; 10 import javax.faces.context.FacesContext; 11 import javax.faces.component.UIComponent; 12 import org.exoplatform.faces.core.component.UIGrid; 13 14 20 public class ComponentCell extends Cell { 21 private UIComponent component_ ; 22 23 public ComponentCell(UIComponent parent, UIComponent comp) { 24 component_ = comp ; 25 parent.getChildren().add(comp) ; 26 } 27 28 public void setComponent(UIComponent parent, UIComponent comp) { 29 component_ = comp ; 30 parent.getChildren().add(comp) ; 31 } 32 33 public void render(ResponseWriter w, ResourceBundle res, UIGrid uiGrid, String cellTag) throws IOException { 34 w.write('<');w.write(cellTag) ; 35 if(attributes_ != null) { 36 int size = attributes_.size() ; 37 for(int i = 0; i < size ; i++) { 38 Cell.Attribute attr = (Cell.Attribute) attributes_.get(i) ; 39 w.write(' ');w.write(attr.name_);w.write("='");w.write(attr.value_);w.write('\'') ; 40 } 41 } 42 FacesContext context = FacesContext.getCurrentInstance() ; 43 w.write('>') ; 44 component_.encodeBegin(context) ; 45 component_.encodeChildren(context) ; 46 component_.encodeEnd(context) ; 47 w.write("</");w.write(cellTag);w.write(">") ; 48 } 49 } 50 | Popular Tags |