1 5 package org.exoplatform.faces.core.component.model; 6 7 import java.io.IOException ; 8 import java.util.ResourceBundle ; 9 import javax.faces.context.ResponseWriter; 10 import org.exoplatform.Constants; 11 import org.exoplatform.faces.core.component.UIGrid; 12 13 19 public class LinkColumn extends Column { 20 private String fieldId_ ; 21 protected String parameters_ = ""; 22 23 public LinkColumn(String header, String fieldName, String fieldId) { 24 super(header, fieldName) ; 25 fieldId_ = fieldId ; 26 } 27 28 public LinkColumn addParameter(Parameter[] params) { 29 StringBuffer b = new StringBuffer () ; 30 for(int i = 0; i < params.length; i++) { 31 b.append(Constants.AMPERSAND); 32 b.append(params[i].getName()).append('=').append(params[i].getValue()); 33 } 34 parameters_ = b.toString() ; 35 return this ; 36 } 37 38 public void render(ResponseWriter w, ResourceBundle res, 39 UIGrid uiParent, DataHandler dhandler) throws IOException { 40 if(clazz_ == null) { 41 w.write("<td>"); 42 } else { 43 w.write("<td class='"); w.write(clazz_); w.write("'>"); 44 } 45 String baseURL = uiParent.getBaseURL() ; 46 w.write("<a"); 47 if (clazz_ != null) { 48 w.write(" class='"); w.write(clazz_); w.write("'"); 49 } 50 w.write(" HREF='"); w.write(baseURL); w.write(parameters_) ; 51 w.write(Constants.AMPERSAND + "objectId="); w.write(dhandler.getData(fieldId_)) ; 52 w.write("'>"); 53 w.write(dhandler.getData(fieldName_)); 54 w.write("</a>"); 55 w.write("</td>") ; 56 } 57 } | Popular Tags |