1 18 19 package org.objectweb.jac.aspects.gui.web; 20 21 import java.io.PrintWriter ; 22 import org.objectweb.jac.core.rtti.FieldItem; 23 import org.objectweb.jac.aspects.gui.Unit; 24 25 28 public class TextEditor extends AbstractFieldEditor 29 implements HTMLEditor 30 { 31 public TextEditor(Object substance, FieldItem field) { 32 super(substance,field); 33 } 34 35 37 public void genHTML(PrintWriter out) { 38 String sizeSpec = ""; 39 if (height!=null && height.unit==Unit.EM) 40 sizeSpec += " rows=\""+(int)height.value+"\""; 41 if (width!=null && width.unit==Unit.EX) 42 sizeSpec += " cols=\""+(int)width.value+"\""; 43 String style = ""; 44 if (height!=null && height.unit!=Unit.EM) 45 style += "height:"+height+";"; 46 if (width!=null && width.unit!=Unit.EX) 47 style += "width:"+width+";"; 48 49 out.print("<TEXTAREA"+sizeSpec+(style.length()!=0 ? " style=\""+style+"\"" : "")+ 50 " class=\"editor\""+ 51 " name=\""+label+"\""); 52 printAttributes(out); 53 out.println(">"); 54 out.print((value==null ? "" : value.toString()) +"</TEXTAREA>"); 55 } 56 57 protected boolean doReadValue(Object parameter) { 58 setValue((String )parameter); 59 return true; 60 } 61 } 62 63 | Popular Tags |