AT&T 2.0.19 Code drop, stage 1
[aaf/authz.git] / misc / xgen / src / main / java / org / onap / aaf / misc / xgen / html / HTML5Gen.java
1 /**
2  * ============LICENSE_START====================================================
3  * org.onap.aaf
4  * ===========================================================================
5  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6  * ===========================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END====================================================
19  *
20  */
21
22 package org.onap.aaf.misc.xgen.html;
23
24 import java.io.Writer;
25
26 import org.onap.aaf.misc.xgen.Mark;
27
28 public class HTML5Gen extends HTMLGen {
29         public HTML5Gen(Writer w) {
30                 super(w);
31         }
32
33         @Override
34         public HTMLGen html(String ... attrib) {
35                 //forward.println("<!DOCTYPE html>");
36                 incr("html",attrib);
37                 return this;
38         }
39         
40         @Override
41         public Mark head() {
42                 Mark head = new Mark("head");
43                 incr(head).directive("meta","charset=utf-8");
44                 return head;
45         }
46
47         @Override
48         public Mark body(String ... attrs) {
49                 Mark body = new Mark("body");
50                 incr(body,"body",attrs);
51                 //chromeFrame();
52                 return body;
53         }
54         
55         @Override
56         public HTML5Gen charset(String charset) {
57                 forward.append("<meta charset=\"");
58                 forward.append(charset);
59                 forward.append("\">");
60                 prettyln(forward);
61                 return this;
62         }
63
64         @Override
65         public Mark header(String ... attribs) {
66                 Mark mark = new Mark("header");
67                 incr(mark, mark.comment, attribs);
68                 return mark;
69         }
70
71         @Override
72         public Mark footer(String ... attribs) {
73                 Mark mark = new Mark("footer");
74                 incr(mark, mark.comment, attribs);
75                 return mark;
76         }
77
78         @Override
79         public Mark section(String ... attribs) {
80                 Mark mark = new Mark("section");
81                 incr(mark, mark.comment,attribs);
82                 return mark;
83         }
84
85         @Override
86         public Mark article(String ... attribs) {
87                 Mark mark = new Mark("article");
88                 incr(mark, mark.comment,attribs);
89                 return mark;
90         }
91
92         @Override
93         public Mark aside(String ... attribs) {
94                 Mark mark = new Mark("aside");
95                 incr(mark, mark.comment,attribs);
96                 return mark;
97         }
98
99         @Override
100         public Mark nav(String ... attribs) {
101                 Mark mark = new Mark("nav");
102                 incr(mark, mark.comment,attribs);
103                 return mark;
104         }
105         
106
107 //      @Override
108 //      protected void importCSS(Imports imports) {
109 //              if(imports.css.size() == 1) {
110 //                      cssInline(imports.css.get(0));
111 //              } else {
112 //                      for(String str : imports.css) {
113 //                              forward.print("<link rel=\"stylesheet\" href=\"");
114 //                              forward.print(imports.themePath(null));
115 //                              forward.print(str);
116 //                              forward.println("\">");
117 //                      }
118 //              }
119 //      }
120 //
121
122         /*
123         public void chromeFrame() {
124                 this.textCR(0,"<!--[if IE]>");
125                 Mark mark = new Mark();
126                 this.leaf(mark, "script","type=text/javascript","src=http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js")
127                         .end(mark);
128                 this.incr(mark, "style")
129                         .textCR(0,".chromeFrameInstallDefaultStyle {")
130                         .textCR(1,"width: 100%; /* default is 800px * /")
131                         .textCR(1,"border: 5px solid blue;")
132                         .textCR(0,"}")
133                         .end(mark);
134
135                 this.incr(mark,"div","id=prompt"); // auto comment would break IE specific Script
136                 // "if IE without GCF, prompt goes here"
137                 this.text("Please load this plugin to run ClientSide Websockets")
138                         .end(mark);
139
140                 this.incr(mark, "script")
141                         .textCR(0, "// The conditional ensures that this code will only execute in IE,")
142                                 .textCR(0, "// Therefore we can use the IE-specific attachEvent without worry")
143                                 .textCR(0, "window.attachEvent('onload', function() {")
144                                 .textCR(1,"CFInstall.check({")
145                                         .textCR(2,"mode: 'inline', // the default")
146                                         .textCR(2,"node: 'prompt'")
147                                 .textCR(1, "});")
148                         .textCR(0, "});")
149                         .end(mark);
150                         
151                 this.textCR(0,"<![endif]-->");
152         }
153         */
154
155 }