1 5 package org.exoplatform.faces.core.component.model; 6 7 import java.io.IOException ; 8 import java.util.ResourceBundle ; 9 10 import javax.faces.context.ResponseWriter; 11 import org.exoplatform.faces.core.component.UIGrid; 12 import org.exoplatform.commons.utils.ExpressionUtil ; 13 19 20 public class LabelCell extends Cell { 21 private String for_ ; 22 private String accesskey_ ; 23 24 public LabelCell(String value) { 25 super(value) ; 26 } 27 28 public LabelCell setLabel(String value) { 29 value_ = value ; 30 return this ; 31 } 32 33 public LabelCell setFor(String value) { 34 for_ = value ; 35 return this ; 36 } 37 38 public LabelCell setAccesskey(String value) { 39 accesskey_ = value ;; 40 return this ; 41 } 42 43 public void render(ResponseWriter w, ResourceBundle res,UIGrid uiGrid, String cellTag) throws IOException { 44 w.write('<'); w.write(cellTag) ; 45 if(attributes_ != null) { 46 int size = attributes_.size() ; 47 for(int i = 0; i < size ; i++) { 48 Cell.Attribute attr = (Cell.Attribute) attributes_.get(i) ; 49 w.write(' '); w.write(attr.name_); w.write("=\""); w.write(attr.value_); w.write('\"') ; 50 } 51 } 52 w.write('>') ; 53 w.write("<label") ; 54 if (for_ != null) { 55 w.write(" for='"); w.write(for_); w.write("'") ; 56 } 57 if (accesskey_ != null) { 58 w.write(" accesskey='"); w.write(accesskey_); w.write("'") ; 59 } 60 w.write(">") ; 61 w.write(ExpressionUtil.getExpressionValue(res,value_)) ; 62 w.write("</label></"); w.write(cellTag); w.write(">") ; 63 } 64 } | Popular Tags |