]> gerrit.simantics Code Review - simantics/platform.git/blob
08e4232ce7adc815fd4806b14500421680ecd683
[simantics/platform.git] /
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";
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";
27                                         break;
28                                 case LARGE:
29                                         hTag = "h2";
30                                         break;
31                                 case MEDIUM:
32                                         hTag = "h3";
33                                         break;
34                                 case SMALL:
35                                         hTag = "h4";
36                                         break;
37                                 case TINY:
38                                         hTag = "h5";
39                                         break;
40                                 default:
41                                         break;
42                                 }
43                         }
44                         writer.os.println("<"+hTag +">" + line.getLine() + "</"+hTag+">");
45                 }
46                 writer.nextPage();
47                 
48         }
49         
50         @Override
51         public String getId() {
52                 return null;
53         }
54
55 }