AT&T 2.0.19 Code drop, stage 1
[aaf/authz.git] / misc / xgen / src / main / java / org / onap / aaf / misc / xgen / html / HTML4Gen.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 HTML4Gen extends HTMLGen {
29         private final static String DOCTYPE = 
30                 /*
31                 "<!DOCTYPE HTML PUBLIC " +
32                 "\"-//W3C//DTD HTML 4.01 Transitional//EN\" " +
33                 "\"http://www.w3.org/TR/html3/loose.dtd\">";
34                 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"" +
35                 " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
36                 */
37                 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"" +
38                 " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
39
40         public HTML4Gen(Writer w) {
41                 super(w);
42         }
43
44         @Override
45         public HTMLGen html(String ... attrib) {
46                 forward.println(DOCTYPE);
47                 return incr("html","xmlns=http://www.w3.org/1999/xhtml","xml:lang=en","lang=en");
48                 
49         }
50
51         @Override
52         public Mark head() {
53                 Mark head = new Mark("head");
54                 incr(head);
55                 return head;
56         }
57
58         @Override
59         public Mark body(String ... attrs) {
60                 Mark body = new Mark("body");
61                 incr(body,"body",attrs);
62                 return body;
63         }
64         
65         @Override
66         public HTML4Gen charset(String charset) {
67                 forward.append("<meta http-equiv=\"Content-type\" content=\"text.hml; charset=");
68                 forward.append(charset);
69                 forward.append("\">");
70                 prettyln(forward);
71                 return this;
72         }
73
74         @Override
75         public Mark header(String ... attribs) {
76                 String[] a = new String[attribs.length+1];
77                 a[0]="header";
78                 System.arraycopy(attribs, 0, a, 1, attribs.length);
79                 return divID(a);
80         }
81
82         @Override
83         public Mark footer(String ... attribs) {
84                 String[] a = new String[attribs.length+1];
85                 a[0]="footer";
86                 System.arraycopy(attribs, 0, a, 1, attribs.length);
87                 return divID(a);
88         }
89
90         @Override
91         public Mark section(String ... attribs) {
92                 String[] a = new String[attribs.length+1];
93                 a[0]="section";
94                 System.arraycopy(attribs, 0, a, 1, attribs.length);
95                 return divID(a);
96         }
97
98         @Override
99         public Mark article(String ... attribs) {
100                 String[] a = new String[attribs.length+1];
101                 a[0]="attrib";
102                 System.arraycopy(attribs, 0, a, 1, attribs.length);
103                 return divID(a);
104         }
105
106         @Override
107         public Mark aside(String ... attribs) {
108                 String[] a = new String[attribs.length+1];
109                 a[0]="aside";
110                 System.arraycopy(attribs, 0, a, 1, attribs.length);
111                 return divID(a);
112         }
113
114         @Override
115         public Mark nav(String ... attribs) {
116                 String[] a = new String[attribs.length+1];
117                 a[0]="nav";
118                 System.arraycopy(attribs, 0, a, 1, attribs.length);
119                 return divID(a);
120         }
121
122 //      @Override
123 //      protected void importCSS(Imports imports) {
124 //              if(imports.css.size()==1) {
125 //                      cssInline(imports.css.get(0));
126 //              } else {
127 //                      text("<style type=\"text/css\">");
128 //                      prettyln(forward);
129 //                      forward.inc();
130 //                      for(String str : imports.css) {
131 //                              forward.print("@import url(\"");
132 //                              forward.print(imports.themePath(null));
133 //                              forward.print(str);
134 //                              forward.print("\");");
135 //                              prettyln(forward);
136 //                      }
137 //                      forward.dec();
138 //                      forward.print("</style>");
139 //                      prettyln(forward);
140 //              }
141 //      }
142         
143 }