1 29 30 package com.caucho.jsp.java; 31 32 import com.caucho.jsp.JspParseException; 33 import com.caucho.util.CharBuffer; 34 import com.caucho.vfs.WriteStream; 35 36 import java.io.IOException ; 37 import java.util.ArrayList ; 38 39 42 public class JspText extends JspNode { 43 private ArrayList <JspNode> _children = new ArrayList <JspNode>(); 44 45 public JspText() 46 { 47 } 48 49 52 public JspNode addText(String text) 53 { 54 JspNode node = new StaticText(_gen, text, this); 55 56 _children.add(node); 57 58 return node; 59 } 60 61 64 public void addChild(JspNode node) 65 throws JspParseException 66 { 67 if (node.getTagName().equals("resin-c:out")) 68 _children.add(node); 69 else 70 super.addChild(node); 71 } 72 73 76 82 83 86 92 93 96 public boolean isStatic() 97 { 98 for (int i = 0; i < _children.size(); i++) 99 if (! _children.get(i).isStatic()) 100 return false; 101 102 103 return true; 104 } 105 106 109 public void getStaticText(CharBuffer cb) 110 { 111 for (int i = 0; i < _children.size(); i++) 112 _children.get(i).getStaticText(cb); 113 } 114 115 118 public boolean isWhitespace() 119 { 120 for (int i = 0; i < _children.size(); i++) { 121 JspNode child = _children.get(i); 122 123 if (! (child instanceof StaticText)) 124 return false; 125 126 if (! ((StaticText) child).isWhitespace()) 127 return false; 128 } 129 130 return true; 131 } 132 133 138 public void printXml(WriteStream os) 139 throws IOException 140 { 141 os.print("<jsp:text"); 142 printJspId(os); 143 os.print(">"); 144 145 for (int i = 0; i < _children.size(); i++) 146 _children.get(i).printXml(os); 147 148 os.print("</jsp:text>"); 149 } 150 151 154 public void generateStartLocation(JspJavaWriter out) 155 throws IOException 156 { 157 } 158 159 164 public void generate(JspJavaWriter out) 165 throws Exception 166 { 167 for (int i = 0; i < _children.size(); i++) 168 _children.get(i).generate(out); 169 } 170 171 176 public void generateStatic(JspJavaWriter out) 177 throws Exception 178 { 179 for (int i = 0; i < _children.size(); i++) 180 _children.get(i).generateStatic(out); 181 } 182 } 183 | Popular Tags |