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 37 public class ViewFileLink implements ContentItem { 38 private String _file; 39 private Document _document; 40 41 public ViewFileLink(Document document) 42 { 43 _document = document; 44 } 45 46 public void setFile(String file) 47 { 48 _file = file; 49 } 50 51 public void writeHtml(XMLStreamWriter out) 52 throws XMLStreamException 53 { 54 String cp = _document.getContextPath(); 55 56 out.writeStartElement("a"); 57 out.writeAttribute("href", "viewfile?file=" + _file); 58 out.writeCharacters(_file); 59 out.writeEndElement(); } 61 62 public void writeLaTeX(PrintWriter out) 63 throws IOException 64 { 65 out.print("\\href{" + _file + "}{" + _file + "}"); 66 } 67 68 public void writeLaTeXEnclosed(PrintWriter out) 69 throws IOException 70 { 71 writeLaTeX(out); 72 } 73 74 public void writeLaTeXTop(PrintWriter out) 75 throws IOException 76 { 77 writeLaTeX(out); 78 } 79 } 80 | Popular Tags |