1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\r
4 * * ===========================================================================
\r
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * * ===========================================================================
\r
7 * * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * * you may not use this file except in compliance with the License.
\r
9 * * You may obtain a copy of the License at
\r
11 * * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * * Unless required by applicable law or agreed to in writing, software
\r
14 * * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * * See the License for the specific language governing permissions and
\r
17 * * limitations under the License.
\r
18 * * ============LICENSE_END====================================================
\r
20 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
22 ******************************************************************************/
\r
23 package org.onap.aaf.xgen.html;
\r
25 import java.io.Writer;
\r
27 import org.onap.aaf.xgen.Mark;
\r
29 public class HTML5Gen extends HTMLGen {
\r
30 public HTML5Gen(Writer w) {
\r
35 public HTMLGen html(String ... attrib) {
\r
36 //forward.println("<!DOCTYPE html>");
\r
37 incr("html",attrib);
\r
42 public Mark head() {
\r
43 Mark head = new Mark("head");
\r
44 incr(head).directive("meta","charset=utf-8");
\r
49 public Mark body(String ... attrs) {
\r
50 Mark body = new Mark("body");
\r
51 incr(body,"body",attrs);
\r
57 public HTML5Gen charset(String charset) {
\r
58 forward.append("<meta charset=\"");
\r
59 forward.append(charset);
\r
60 forward.append("\">");
\r
66 public Mark header(String ... attribs) {
\r
67 Mark mark = new Mark("header");
\r
68 incr(mark, mark.comment, attribs);
\r
73 public Mark footer(String ... attribs) {
\r
74 Mark mark = new Mark("footer");
\r
75 incr(mark, mark.comment, attribs);
\r
80 public Mark section(String ... attribs) {
\r
81 Mark mark = new Mark("section");
\r
82 incr(mark, mark.comment,attribs);
\r
87 public Mark article(String ... attribs) {
\r
88 Mark mark = new Mark("article");
\r
89 incr(mark, mark.comment,attribs);
\r
94 public Mark aside(String ... attribs) {
\r
95 Mark mark = new Mark("aside");
\r
96 incr(mark, mark.comment,attribs);
\r
101 public Mark nav(String ... attribs) {
\r
102 Mark mark = new Mark("nav");
\r
103 incr(mark, mark.comment,attribs);
\r
109 // protected void importCSS(Imports imports) {
\r
110 // if(imports.css.size() == 1) {
\r
111 // cssInline(imports.css.get(0));
\r
113 // for(String str : imports.css) {
\r
114 // forward.print("<link rel=\"stylesheet\" href=\"");
\r
115 // forward.print(imports.themePath(null));
\r
116 // forward.print(str);
\r
117 // forward.println("\">");
\r
124 public void chromeFrame() {
\r
125 this.textCR(0,"<!--[if IE]>");
\r
126 Mark mark = new Mark();
\r
127 this.leaf(mark, "script","type=text/javascript","src=http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js")
\r
129 this.incr(mark, "style")
\r
130 .textCR(0,".chromeFrameInstallDefaultStyle {")
\r
131 .textCR(1,"width: 100%; /* default is 800px * /")
\r
132 .textCR(1,"border: 5px solid blue;")
\r
136 this.incr(mark,"div","id=prompt"); // auto comment would break IE specific Script
\r
137 // "if IE without GCF, prompt goes here"
\r
138 this.text("Please load this plugin to run ClientSide Websockets")
\r
141 this.incr(mark, "script")
\r
142 .textCR(0, "// The conditional ensures that this code will only execute in IE,")
\r
143 .textCR(0, "// Therefore we can use the IE-specific attachEvent without worry")
\r
144 .textCR(0, "window.attachEvent('onload', function() {")
\r
145 .textCR(1,"CFInstall.check({")
\r
146 .textCR(2,"mode: 'inline', // the default")
\r
147 .textCR(2,"node: 'prompt'")
\r
152 this.textCR(0,"<![endif]-->");
\r