2 * ============LICENSE_START====================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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====================================================
22 package org.onap.aaf.misc.xgen.html;
24 import java.io.Writer;
26 import org.onap.aaf.misc.xgen.Mark;
28 public class HTML5Gen extends HTMLGen {
29 public HTML5Gen(Writer w) {
34 public HTMLGen html(String ... attrib) {
35 //forward.println("<!DOCTYPE html>");
42 Mark head = new Mark("head");
43 incr(head).directive("meta","charset=utf-8");
48 public Mark body(String ... attrs) {
49 Mark body = new Mark("body");
50 incr(body,"body",attrs);
56 public HTML5Gen charset(String charset) {
57 forward.append("<meta charset=\"");
58 forward.append(charset);
59 forward.append("\">");
65 public Mark header(String ... attribs) {
66 Mark mark = new Mark("header");
67 incr(mark, mark.comment, attribs);
72 public Mark footer(String ... attribs) {
73 Mark mark = new Mark("footer");
74 incr(mark, mark.comment, attribs);
79 public Mark section(String ... attribs) {
80 Mark mark = new Mark("section");
81 incr(mark, mark.comment,attribs);
86 public Mark article(String ... attribs) {
87 Mark mark = new Mark("article");
88 incr(mark, mark.comment,attribs);
93 public Mark aside(String ... attribs) {
94 Mark mark = new Mark("aside");
95 incr(mark, mark.comment,attribs);
100 public Mark nav(String ... attribs) {
101 Mark mark = new Mark("nav");
102 incr(mark, mark.comment,attribs);
108 // protected void importCSS(Imports imports) {
109 // if(imports.css.size() == 1) {
110 // cssInline(imports.css.get(0));
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("\">");
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")
128 this.incr(mark, "style")
129 .textCR(0,".chromeFrameInstallDefaultStyle {")
130 .textCR(1,"width: 100%; /* default is 800px * /")
131 .textCR(1,"border: 5px solid blue;")
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")
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'")
151 this.textCR(0,"<![endif]-->");