1 package org.simantics.document.linking.report.html;
3 import org.simantics.document.linking.report.DocumentElement;
4 import org.simantics.document.linking.report.TableOfContents;
7 public class HTMLTocElement extends HTMLStreamElement implements TableOfContents {
13 public HTMLTocElement(HTMLDocument writer) throws Exception{
15 this.os.println(Messages.HTMLTocElement_TocHeading);
16 tocTable = new HTMLTable(writer, os, false);
17 tocTable.setHeaderVisible(false);
18 tocTable.setLinesVisible(false);
19 tocTable.addColumn("Name", 1.0); //$NON-NLS-1$
23 public void addTocElement(String label, DocumentElement element) throws Exception{
24 HTMLElement e = (HTMLElement)element;
25 if (e.getId() == null)
26 throw new IllegalArgumentException("Element has no id " + element); //$NON-NLS-1$
27 //os.println("<a href=\"#" + e.getId() + "\">" + label + "</a><br>");
28 tocTable.writeRow("<a href=\"#" + e.getId() + "\">" + label + "</a><br>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
31 public void close() throws Exception{
33 os.print("<br>"); //$NON-NLS-1$
38 public String getId() {
39 return "toc"; //$NON-NLS-1$