1 5 package org.exoplatform.portlets.communication.sms.renderer.html; 6 7 import java.io.IOException ; 8 import java.util.List ; 9 import java.util.ResourceBundle ; 10 11 import javax.faces.component.UIComponent; 12 import javax.faces.context.FacesContext; 13 import javax.faces.context.ResponseWriter; 14 import org.exoplatform.faces.core.component.model.Row; 15 import org.exoplatform.faces.core.renderer.html.HtmlBasicRenderer; 16 import org.exoplatform.portlets.communication.sms.component.UISmsMonitor; 17 18 19 23 public class SmsMonitorRenderer extends HtmlBasicRenderer { 24 25 public void encodeBegin(FacesContext context, UIComponent component) throws IOException { 26 super.encodeBegin(context, component); 27 UISmsMonitor uiMonitor = (UISmsMonitor) component; 28 uiMonitor.updateCounter(); 29 } 30 31 public void encodeChildren(FacesContext context, UIComponent component) throws IOException { 32 ResponseWriter w = context.getResponseWriter(); 33 UISmsMonitor uiMonitor = (UISmsMonitor) component; 34 ResourceBundle res = getApplicationResourceBundle(context.getExternalContext()) ; 35 String clazz = uiMonitor.getClazz(); 36 w.write("<div align='center'>"); 37 w.write("<table"); 38 if (clazz != null) { 39 w.write(" class='"); 40 w.write(clazz); 41 w.write("'"); 42 } 43 w.write(">\n"); 44 List rows = uiMonitor.getRows(); 45 for (int i = 0; i < rows.size(); i++) { 46 Row row = (Row) rows.get(i); 47 row.render(w,res, uiMonitor); 48 } 49 w.write("</table>"); 50 w.write("</div>"); 51 } 52 53 } | Popular Tags |