KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > faces > core > component > UIHtmlTextArea


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;
6
7 import java.io.IOException JavaDoc ;
8 import javax.faces.context.FacesContext;
9 import javax.faces.context.ResponseWriter;
10 /**
11
12  * Wed, Dec 22, 2003 @ 23:14
13
14  * @author: Tuan Nguyen
15
16  * @email: tuan08@users.sourceforge.net
17
18  * @version: $Id: UIHtmlTextArea.java,v 1.5 2004/08/17 00:13:28 tuan08 Exp $
19
20  */

21 public class UIHtmlTextArea extends UIStringInput {
22   private String JavaDoc width_ ;
23   private String JavaDoc height_ ;
24   private boolean setFormScript_ ;
25
26   public UIHtmlTextArea(String JavaDoc name, String JavaDoc text, String JavaDoc width, String JavaDoc height) {
27     super(name, text) ;
28     width_ = width ;
29     height_ = height ;
30     setFormScript_ = false ;
31   }
32
33   public void encodeBegin(FacesContext context) throws IOException JavaDoc {
34     ResponseWriter w = context.getResponseWriter() ;
35     String JavaDoc value = value_ ;
36     if (value == null) value = "" ;
37     w.write("<textarea id='"); w.write(name_); w.write("'") ;
38     w.write(" name='"); w.write(name_); w.write("'") ;
39     if (getClazz() != null) {
40       w.write(" class='"); w.write(getClazz()); w.write("'") ;
41     }
42     w.write('>') ;
43     w.write(value) ;
44     w.write("</textarea>") ;
45     if(!setFormScript_) {
46       UISimpleForm uiForm = (UISimpleForm) getParent() ;
47       uiForm.setEnhancedScript(name_ , width_ , height_) ;
48       setFormScript_ = true ;
49     }
50   }
51 }
Popular Tags