1 58 package org.apache.ecs; 59 60 import java.io.OutputStream ; 61 import java.io.PrintWriter ; 62 import java.io.Serializable ; 63 import org.apache.ecs.xhtml.html; 64 import org.apache.ecs.xhtml.body; 65 import org.apache.ecs.xhtml.title; 66 import org.apache.ecs.xhtml.head; 67 import org.apache.ecs.xhtml.frameset; 68 import org.apache.ecs.xhtml.noframes; 69 70 79 public class XhtmlFrameSetDocument implements Serializable ,Cloneable 80 { 81 82 private html html; 84 private head head; 85 86 private body body; 87 88 private title title; 89 90 private frameset frameset; 91 92 private noframes noframes; 93 94 95 private String codeset = null; 96 97 private Doctype doctype = null; 98 99 { 100 html = new html(); 101 head = new head(); 102 title = new title(); 103 frameset = new frameset(); 104 noframes = new noframes(); 105 body = new body(); 106 107 head.addElement(title); 108 html.addElement(head); 109 html.addElement(frameset); 110 html.addElement(noframes); 111 noframes.addElement(body); 112 } 113 114 117 public XhtmlFrameSetDocument() 118 { 119 } 120 121 124 public XhtmlFrameSetDocument(String codeset) 125 { 126 setCodeset(codeset); 127 } 128 129 132 public html getHtml() 133 { 134 return(html); 135 } 136 137 140 public XhtmlFrameSetDocument setHtml(html set_html) 141 { 142 this.html = set_html; 143 return(this); 144 } 145 146 149 public head getHead() 150 { 151 return(head); 152 } 153 154 157 public XhtmlFrameSetDocument setHead(head set_head) 158 { 159 this.head = set_head; 160 return(this); 161 } 162 163 167 public XhtmlFrameSetDocument appendHead(Element value) 168 { 169 head.addElement(value); 170 return(this); 171 } 172 173 177 public XhtmlFrameSetDocument appendHead(String value) 178 { 179 head.addElement(value); 180 return(this); 181 } 182 183 186 public frameset getFrameSet() 187 { 188 return(frameset); 189 } 190 191 194 public XhtmlFrameSetDocument setHead(frameset set_frameset) 195 { 196 this.frameset = set_frameset; 197 return(this); 198 } 199 200 204 public XhtmlFrameSetDocument appendFrameSet(Element value) 205 { 206 frameset.addElement(value); 207 return(this); 208 } 209 210 214 public XhtmlFrameSetDocument appendFrameSet(String value) 215 { 216 frameset.addElement(value); 217 return(this); 218 } 219 222 public body getBody() 223 { 224 return(body); 225 } 226 227 230 public XhtmlFrameSetDocument setBody(body set_body) 231 { 232 this.body = set_body; 233 return(this); 234 } 235 236 240 public XhtmlFrameSetDocument appendBody(Element value) 241 { 242 body.addElement(value); 243 return(this); 244 } 245 246 250 public XhtmlFrameSetDocument appendBody(String value) 251 { 252 body.addElement(value); 253 return(this); 254 } 255 256 259 public title getTitle() 260 { 261 return(title); 262 } 263 264 267 public XhtmlFrameSetDocument setTitle(title set_title) 268 { 269 this.title = set_title; 270 return(this); 271 } 272 273 277 public XhtmlFrameSetDocument appendTitle(Element value) 278 { 279 title.addElement(value); 280 return(this); 281 } 282 283 287 public XhtmlFrameSetDocument appendTitle(String value) 288 { 289 title.addElement(value); 290 return(this); 291 } 292 293 296 public void setCodeset ( String codeset ) 297 { 298 this.codeset = codeset; 299 } 300 301 306 public String getCodeset() 307 { 308 return this.codeset; 309 } 310 311 314 public void output(OutputStream out) 315 { 316 if (doctype != null) 317 { 318 doctype.output(out); 319 try 320 { 321 out.write('\n'); 322 } 323 catch ( Exception e) 324 {} 325 } 326 html.output(out); 328 } 329 330 333 public void output(PrintWriter out) 334 { 335 if (doctype != null) 336 { 337 doctype.output(out); 338 try 339 { 340 out.write('\n'); 341 } 342 catch ( Exception e) 343 {} 344 } 345 html.output(out); 347 } 348 349 352 public final String toString() 353 { 354 StringBuffer sb = new StringBuffer (); 355 if ( getCodeset() != null ) 356 { 357 if (doctype != null) 358 sb.append (doctype.toString(getCodeset())); 359 sb.append (html.toString(getCodeset())); 360 return (sb.toString()); 361 } 362 else 363 { 364 if (doctype != null) 365 sb.append (doctype.toString()); 366 sb.append (html.toString()); 367 return(sb.toString()); 368 } 369 } 370 371 374 public final String toString(String codeset) 375 { 376 StringBuffer sb = new StringBuffer (); 377 if (doctype != null) 378 sb.append (doctype.toString(getCodeset())); 379 sb.append (html.toString(getCodeset())); 380 return(sb.toString()); 381 } 382 383 386 public Object clone() 387 { 388 return(html.clone()); 389 } 390 391 394 public Doctype getDoctype() 395 { 396 return(doctype); 397 } 398 399 402 public XhtmlFrameSetDocument setDoctype(Doctype set_doctype) 403 { 404 this.doctype = set_doctype; 405 return(this); 406 } 407 408 } 409 | Popular Tags |