KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > faces > core > component > model > LabelCell


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.faces.core.component.model;
6
7 import java.io.IOException JavaDoc;
8 import java.util.ResourceBundle JavaDoc;
9
10 import javax.faces.context.ResponseWriter;
11 import org.exoplatform.faces.core.component.UIGrid;
12 import org.exoplatform.commons.utils.ExpressionUtil ;
13 /**
14  * Wed, Dec 22, 2003 @ 23:14
15  * @author: Tuan Nguyen
16  * @email: tuan08@users.sourceforge.net
17  * @version: $Id: LabelCell.java,v 1.5 2004/06/30 19:52:01 tuan08 Exp $
18  */

19
20 public class LabelCell extends Cell {
21   private String JavaDoc for_ ;
22   private String JavaDoc accesskey_ ;
23
24   public LabelCell(String JavaDoc value) {
25     super(value) ;
26   }
27
28   public LabelCell setLabel(String JavaDoc value) {
29     value_ = value ;
30     return this ;
31   }
32
33   public LabelCell setFor(String JavaDoc value) {
34     for_ = value ;
35     return this ;
36   }
37
38   public LabelCell setAccesskey(String JavaDoc value) {
39     accesskey_ = value ;;
40     return this ;
41   }
42
43   public void render(ResponseWriter w, ResourceBundle JavaDoc res,UIGrid uiGrid, String JavaDoc cellTag) throws IOException JavaDoc {
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