1 29 30 package com.caucho.xtpdoc; 31 32 import javax.xml.stream.XMLStreamException; 33 import javax.xml.stream.XMLStreamWriter; 34 import java.io.IOException ; 35 import java.io.PrintWriter ; 36 import java.util.ArrayList ; 37 import java.util.logging.Logger ; 38 39 public abstract class ContainerNode implements ContentItem { 40 private static Logger log = Logger.getLogger(ContainerNode.class.getName()); 41 42 private Document _document; 43 private ArrayList <ContentItem> _items = new ArrayList <ContentItem>(); 44 45 public ContainerNode(Document document) 46 { 47 _document = document; 48 } 49 50 public Document getDocument() 51 { 52 return _document; 53 } 54 55 protected void addItem(ContentItem item) 56 { 57 _items.add(item); 58 } 59 60 protected ArrayList <ContentItem> getItems() 61 { 62 return _items; 63 } 64 65 public void writeHtml(XMLStreamWriter out) 66 throws XMLStreamException 67 { 68 for (ContentItem item : _items) 69 item.writeHtml(out); 70 } 71 72 public void writeLaTeXTop(PrintWriter out) 73 throws IOException 74 { 75 for (ContentItem item : _items) 76 item.writeLaTeXTop(out); 77 } 78 79 public void writeLaTeX(PrintWriter out) 80 throws IOException 81 { 82 for (ContentItem item : _items) 83 item.writeLaTeX(out); 84 } 85 86 public void writeLaTeXEnclosed(PrintWriter out) 87 throws IOException 88 { 89 for (ContentItem item : _items) 90 item.writeLaTeXEnclosed(out); 91 } 92 } 93 | Popular Tags |