1 20 package org.enhydra.barracuda.core.comp; 21 22 import java.util.*; 23 24 import org.apache.log4j.*; 25 import org.w3c.dom.*; 26 import org.w3c.dom.html.*; 27 28 import org.enhydra.barracuda.core.comp.renderer.*; 29 import org.enhydra.barracuda.core.comp.renderer.html.*; 30 import org.enhydra.barracuda.core.comp.renderer.xml.*; 31 import org.enhydra.barracuda.core.util.dom.DOMUtil; 32 import org.enhydra.barracuda.core.view.*; 33 import org.enhydra.barracuda.plankton.*; 34 import org.enhydra.barracuda.plankton.data.*; 35 36 37 50 public class BText extends BComponent { 51 52 protected static final Logger logger = Logger.getLogger(BText.class.getName()); 54 55 protected String text = null; 57 protected boolean allowMarkupInText = false; 59 63 public BText() {} 64 65 77 public BText(String text) { 78 this(text, null); 79 } 80 81 93 BText(String text, View view) { 94 if (text!=null) this.setText(text); 95 if (view!=null) this.addView(view); 96 } 97 98 99 103 static { 104 HTMLRendererFactory rfHTML = new HTMLRendererFactory(); 105 installRendererFactory(rfHTML, BText.class, HTMLElement.class); 106 installRendererFactory(rfHTML, BText.class, HTMLDocument.class); 107 112 XMLRendererFactory rfXML = new XMLRendererFactory(); 113 installRendererFactory(rfXML, BText.class, Node.class); 114 } 115 116 119 static class HTMLRendererFactory implements RendererFactory { 120 public Renderer getInstance() {return new HTMLTextRenderer();} 121 } 122 123 126 static class XMLRendererFactory implements RendererFactory { 127 public Renderer getInstance() {return new XMLTextRenderer();} 128 } 129 130 131 137 public void setText(String itext) { 138 text = itext; 139 invalidate(); 140 } 141 142 147 public String getText() { 148 return text; 149 } 150 151 156 public void setAllowMarkupInText(boolean val) { 157 allowMarkupInText = val; 158 invalidate(); 159 } 160 161 166 public boolean allowMarkupInText() { 167 return allowMarkupInText; 168 } 169 170 178 193 196 public String toString() { 197 return text; 198 } 199 200 } | Popular Tags |