1 5 package org.exoplatform.portlets.rss.renderer.html; 6 7 import javax.faces.component.UIComponent; 8 import javax.faces.context.FacesContext; 9 import javax.faces.context.ResponseWriter; 10 import org.exoplatform.faces.FacesConstants; 11 import org.exoplatform.faces.core.component.model.Parameter; 12 import org.exoplatform.faces.core.renderer.html.HtmlBasicRenderer; 13 import org.exoplatform.portlets.rss.component.*; 14 import java.io.IOException ; 15 import java.util.ResourceBundle ; 16 17 21 public class RssRenderer extends HtmlBasicRenderer { 22 23 private static Parameter[] updatePortletParams = 24 { new Parameter(FacesConstants.ACTION , UIRss.UPDATE_ACTION) }; 25 26 final public void encodeBegin( FacesContext context, UIComponent component ) throws IOException { 27 ResponseWriter w = context.getResponseWriter() ; 28 String baseURL = context.getExternalContext().encodeActionURL(null) ; 29 ResourceBundle res = getApplicationResourceBundle(context.getExternalContext()) ; 30 UIRss uiRss = (UIRss) component ; 31 Channel channel = uiRss.getChannel() ; 32 Item[] items = channel.getItems() ; 33 w.write("<div class='UIRss'>") ; 34 w. write("<div class='title'>"); 35 w. write(channel.getTitle()); 36 w. write("</div>"); 37 w. write("<div class='body'>"); 38 w. write("<ul>"); 39 for (int i = 0; i < items.length ; i++ ) { 40 w. write("<li style='text-align: justify'>") ; 41 w. write("<a HREF='" +items[i].getLink() + "'>"); 42 w. write(items[i].getTitle()); 43 w. write("</a>") ; 44 w. write("<div class='description'>") ; 45 w. write(items[i].getDescription()) ; 46 w. write("</div>"); 47 w. write("</li>"); 48 } 49 w. write("</ul>"); 50 w. write("</div>"); 51 w. write("<div class='footer'>"); 52 linkRenderer_.render(w, uiRss, res.getString("UIRss.img.reload-icon"),updatePortletParams); 53 w. write("</div>"); 54 w.write("</div>"); 55 } 56 } | Popular Tags |