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("<h2>Table of Contents</h2>");
16 tocTable = new HTMLTable(writer, os, false);
17 tocTable.setHeaderVisible(false);
18 tocTable.setLinesVisible(false);
19 tocTable.addColumn("Name", 1.0);
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);
27 //os.println("<a href=\"#" + e.getId() + "\">" + label + "</a><br>");
28 tocTable.writeRow("<a href=\"#" + e.getId() + "\">" + label + "</a><br>");
31 public void close() throws Exception{
38 public String getId() {