1 5 package org.exoplatform.faces.core.renderer.html; 6 7 import java.io.IOException ; 8 import javax.faces.context.ResponseWriter; 9 import org.exoplatform.faces.core.component.UIExoComponent; 10 import org.exoplatform.faces.core.component.model.Parameter; 11 16 public class LinkRenderer { 17 public void renderSelect(ResponseWriter w, UIExoComponent component, 18 String text, Parameter[] params) throws IOException { 19 render(w, component, text, "select-link", params, null) ; 20 } 21 22 public void render(ResponseWriter w, UIExoComponent component, 23 String text, Parameter[] params) throws IOException { 24 render(w, component, text, "link", params, null) ; 25 } 26 27 public void render(ResponseWriter w, UIExoComponent component, 28 String text, String clazz, Parameter[] params) throws IOException { 29 render(w, component, text, clazz, params, null) ; 30 } 31 32 public void render(ResponseWriter w, UIExoComponent component, 33 String text, String clazz, Parameter[] params, 34 String tooltip) throws IOException { 35 w.write("<a"); 36 if(clazz != null) { 37 w.write(" class='"); w.write(clazz); w.write("'"); 38 } 39 w.write(" HREF='"); 40 w.write(component.getBaseURL()); 41 for (int i = 0; i < params.length; i++) { 42 w.write("&"); 43 w.write(params[i].getName()); 44 w.write('='); 45 w.write(params[i].getValue()); 46 } 47 w.write("'"); 48 if (tooltip == null || tooltip.length() == 0) { 49 w.write(">"); 50 } else { 51 w.write(" alt='"); w.write(tooltip); w.write("'"); 52 w.write(" title='"); w.write(tooltip); w.write("'>"); 53 } 54 writeText(w, text) ; 55 w.write("</a>"); 56 } 57 58 protected void writeText(ResponseWriter w, String text) throws IOException { 59 w.write(text); 60 } 61 } | Popular Tags |