]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTitlePage.java
Externalize org.simantics.document.linking.ui
[simantics/platform.git] / bundles / org.simantics.document.linking.ui / src / org / simantics / document / linking / report / html / HTMLTitlePage.java
1 package org.simantics.document.linking.report.html;
2
3 import java.util.List;
4
5 import org.simantics.document.linking.report.DocumentLine;
6 import org.simantics.document.linking.report.DocumentTitlePage;
7 import org.simantics.document.linking.report.Document.TextSize;
8
9
10 public class HTMLTitlePage extends DocumentTitlePage implements HTMLElement{
11         
12         HTMLDocument writer;
13         public HTMLTitlePage(HTMLDocument writer) {
14                 this.writer = writer;
15         }
16         
17         @Override
18         public void writeTitle(List<DocumentLine> lines) throws Exception {
19                 writer.nextPage();
20                 for (DocumentLine line : lines) {
21                         String hTag = "h4"; //$NON-NLS-1$
22                         if (line.getHints().containsKey(TextSize.class)) {
23                                 TextSize size = (TextSize)line.getHints().get(TextSize.class);
24                                 switch (size) {
25                                 case HUGE:
26                                         hTag = "h1"; //$NON-NLS-1$
27                                         break;
28                                 case LARGE:
29                                         hTag = "h2"; //$NON-NLS-1$
30                                         break;
31                                 case MEDIUM:
32                                         hTag = "h3"; //$NON-NLS-1$
33                                         break;
34                                 case SMALL:
35                                         hTag = "h4"; //$NON-NLS-1$
36                                         break;
37                                 case TINY:
38                                         hTag = "h5"; //$NON-NLS-1$
39                                         break;
40                                 default:
41                                         break;
42                                 }
43                         }
44                         writer.os.println("<"+hTag +">" + line.getLine() + "</"+hTag+">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
45                 }
46                 writer.nextPage();
47                 
48         }
49         
50         @Override
51         public String getId() {
52                 return null;
53         }
54
55 }