1 17 18 package org.objectweb.jac.aspects.gui.web; 19 20 import org.objectweb.jac.core.rtti.FieldItem; 21 import org.objectweb.jac.util.Strings; 22 import java.io.PrintWriter ; 23 24 public class TextViewer extends AbstractFieldView 25 implements HTMLViewer 26 { 27 Object value; 28 29 public TextViewer(Object value, Object substance, FieldItem field) { 30 super(substance,field); 31 setValue(value); 32 } 33 34 public void setValue(Object value) { 35 this.value = value; 36 } 37 38 public void genHTML(PrintWriter out) { 39 String text = null; 40 if (value!=null) { 41 text = Strings.replace(value.toString(), "\n\r", "<br>"); 42 text = Strings.replace(text, "\n", "<br>"); 43 } 44 out.print("<p>"+(value!=null?text:"")+"</p>"); 45 } 46 } 47 | Popular Tags |