1 5 package org.exoplatform.text.template.xhtml; 6 7 import java.io.IOException ; 8 import java.io.Writer ; 9 import java.util.ResourceBundle ; 10 import org.exoplatform.Constants; 11 import org.exoplatform.commons.utils.ExpressionUtil; 12 import org.exoplatform.text.template.DataHandler; 13 18 public class Button extends Text { 19 private String parameters_ = ""; 20 21 public Button(String value) { 22 super(value) ; 23 } 24 25 public Button addParameter(String name, String value) { 26 parameters_ += Constants.AMPERSAND + name + "=" + value ; 27 return this ; 28 } 29 30 public void render(XhtmlDataHandlerManager manager, 31 ResourceBundle res, Writer w) throws IOException { 32 DataHandler dh = manager.getDataHandler(dataHandlerType_) ; 33 String baseURL = manager.getBaseURL() ; 34 w.write("<a"); 35 if (cssClass_ != null) { 36 w.write(" class='"); w.write(cssClass_); w.write("'"); 37 } 38 w.write(" HREF='"); w.write(baseURL); w.write(parameters_); w.write("'>"); 39 w.write(ExpressionUtil.getExpressionValue(res,resolveValueAsString(data_ ,dh, res))); 40 w.write("</a>"); 41 } 42 } 43 | Popular Tags |