KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > weather > component > model > ImageCell


1 /**
2  * Jun 17, 2004, 11:14:24 AM
3  * @author: Fran�ois MORON
4  * @email: francois.moron@rd.francetelecom.com
5  *
6  * */

7
8 package org.exoplatform.portlets.weather.component.model;
9
10 import java.io.IOException JavaDoc;
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 JavaDoc src_ ;
20   private String JavaDoc alt_ ;
21   
22   public ImageCell(String JavaDoc src) {
23     src_ = src ;
24     alt_ = "";
25   }
26
27   public ImageCell(String JavaDoc src, String JavaDoc alt) {
28    src_ = src ;
29    alt_ = alt;
30  }
31   public ImageCell setSrc(String JavaDoc src) {
32     src_ = src ;
33     return this ;
34   }
35
36   public ImageCell setAlt(String JavaDoc alt) {
37     alt_ = alt ;
38     return this ;
39   }
40
41   public void render(ResponseWriter w, UIGrid uiGrid, String JavaDoc cellTag) throws IOException JavaDoc {
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 JavaDoc cellTag) throws IOException JavaDoc {
49     render(w, uiGrid, cellTag);
50   }
51 }
Popular Tags