1 7 8 package org.exoplatform.portlets.weather.component.model; 9 10 import java.io.IOException ; 11 12 import javax.faces.context.ResponseWriter; 13 import org.exoplatform.faces.core.component.UIGrid; 14 import org.exoplatform.faces.core.component.model.Cell; 15 16 17 18 public class ImageCell extends Cell { 19 private String src_ ; 20 private String alt_ ; 21 22 public ImageCell(String src) { 23 src_ = src ; 24 alt_ = ""; 25 } 26 27 public ImageCell(String src, String alt) { 28 src_ = src ; 29 alt_ = alt; 30 } 31 public ImageCell setSrc(String src) { 32 src_ = src ; 33 return this ; 34 } 35 36 public ImageCell setAlt(String alt) { 37 alt_ = alt ; 38 return this ; 39 } 40 41 public void render(ResponseWriter w, UIGrid uiGrid, String cellTag) throws IOException { 42 w.write('<'); w.write(cellTag) ; 43 w.write('>') ; 44 w.write("<img SRC=\""); w.write(src_); w.write("\" alt=\""); w.write(alt_); w.write("\"/>"); 45 w.write("</") ; w.write(cellTag) ; w.write(">\n") ; 46 } 47 48 public void renderXhtmlMP(ResponseWriter w,UIGrid uiGrid, String cellTag) throws IOException { 49 render(w, uiGrid, cellTag); 50 } 51 } | Popular Tags |