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.text.template.DataBindingValue; 11 import org.exoplatform.text.template.DataHandler; 12 17 public class Cell extends Text { 18 protected String attributes_ ; 19 20 public Cell(String value) { 21 super(value) ; 22 } 23 24 public Cell addArribute(String name, String value) { 25 if(attributes_ == null) attributes_ = "" ; 26 attributes_ += " " + name + "='" + value +"'" ; 27 return this ; 28 } 29 30 public void render(XhtmlDataHandlerManager manager, 31 ResourceBundle res, Writer w) throws IOException { 32 w.write("<td") ; 33 if(cssClass_ != null) { 34 w.write(" class='") ;w.write(cssClass_); w.write("'") ; 35 } 36 if(cssStyle_ != null) { 37 w.write(" style='") ;w.write(cssStyle_); w.write("'") ; 38 } 39 if(attributes_ != null) { 40 w.write(attributes_) ; 41 } 42 w.write(">"); 43 if(data_ != null) { 44 DataHandler dh = manager.getDataHandler(dataHandlerType_) ; 45 if(formater_ != null) { 46 formater_.format(w, dh.getValue((DataBindingValue)data_)) ; 47 } else { 48 w.write(resolveValueAsString(data_ ,dh, res)) ; 49 } 50 } 51 if(children_.length > 0) { 52 for(int i = 0 ; i < children_.length; i++) { 53 children_[i].render(manager, res, w) ; 54 } 55 } 56 w.write("</td>") ; 57 } 58 59 } | Popular Tags |