001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.html; 014 015/** 016 * Defines the interface for rendering the contents of an HTML page produced by the {@link HtmlDocSerializer} 017 * serializer. 018 * 019 * <p> 020 * The HTML doc serializer produces the following document structure with the typical contents: 021 * <p class='bcode w800'> 022 * <xt><html> 023 * <head> 024 * <style> 025 * <xv>CSS styles and links to stylesheets</xv> 026 * </style> 027 * <script> 028 * <xv>Javascript</xv> 029 * </script> 030 * </head> 031 * <body> 032 * <header> 033 * <h1><xv>Page title</xv></h1> 034 * <h2><xv>Page description</xv></h2> 035 * <xv>Arbitrary page branding</xv> 036 * </header> 037 * <nav> 038 * <xv>Page links</xv> 039 * </nav> 040 * <aside> 041 * <xv>Side-bar page links</xv> 042 * </aside> 043 * <article> 044 * <xv>Contents of serialized object</xv> 045 * </article> 046 * <footer> 047 * <xv>Footer message</xv> 048 * </footer> 049 * </body> 050 * </html></xt> 051 * </p> 052 * 053 * <p> 054 * This interface allows you to control how these sections get rendered. 055 */ 056public interface HtmlDocTemplate { 057 058 /** 059 * Renders the contents of the <code><xt><head></xt></code> element. 060 * 061 * @param session The current serializer session. 062 * @param w The writer being written to. 063 * @param o The object being serialized. 064 * @throws Exception Any exception can be thrown. 065 */ 066 public void writeTo(HtmlDocSerializerSession session, HtmlWriter w, Object o) throws Exception; 067 068 /** 069 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 070 */ 071 @SuppressWarnings("javadoc") 072 @Deprecated 073 public void head(HtmlDocSerializerSession session, HtmlWriter w, Object o) throws Exception; 074 075 /** 076 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 077 */ 078 @SuppressWarnings("javadoc") 079 @Deprecated 080 public void style(HtmlDocSerializerSession session, HtmlWriter w, Object o) throws Exception; 081 082 /** 083 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 084 */ 085 @SuppressWarnings("javadoc") 086 @Deprecated 087 public void script(HtmlDocSerializerSession session, HtmlWriter w, Object o) throws Exception; 088 089 /** 090 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 091 */ 092 @SuppressWarnings("javadoc") 093 @Deprecated 094 public void body(HtmlDocSerializerSession session, HtmlWriter w, Object o) throws Exception; 095 096 /** 097 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 098 */ 099 @SuppressWarnings("javadoc") 100 @Deprecated 101 public void header(HtmlDocSerializerSession session, HtmlWriter w, Object o) throws Exception; 102 103 /** 104 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 105 */ 106 @SuppressWarnings("javadoc") 107 @Deprecated 108 public void nav(HtmlDocSerializerSession session, HtmlWriter w, Object o) throws Exception; 109 110 /** 111 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 112 */ 113 @SuppressWarnings("javadoc") 114 @Deprecated 115 public void article(HtmlDocSerializerSession session, HtmlWriter w, Object o) throws Exception; 116 117 /** 118 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 119 */ 120 @SuppressWarnings("javadoc") 121 @Deprecated 122 public void aside(HtmlDocSerializerSession session, HtmlWriter w, Object o) throws Exception; 123 124 /** 125 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 126 */ 127 @SuppressWarnings("javadoc") 128 @Deprecated 129 public void footer(HtmlDocSerializerSession session, HtmlWriter w, Object o) throws Exception; 130 131 /** 132 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 133 */ 134 @SuppressWarnings("javadoc") 135 @Deprecated 136 public boolean hasStyle(HtmlDocSerializerSession session); 137 138 /** 139 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 140 */ 141 @SuppressWarnings("javadoc") 142 @Deprecated 143 public boolean hasScript(HtmlDocSerializerSession session); 144 145 /** 146 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 147 */ 148 @SuppressWarnings("javadoc") 149 @Deprecated 150 public boolean hasHeader(HtmlDocSerializerSession session); 151 152 /** 153 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 154 */ 155 @SuppressWarnings("javadoc") 156 @Deprecated 157 public boolean hasNav(HtmlDocSerializerSession session); 158 159 /** 160 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 161 */ 162 @SuppressWarnings("javadoc") 163 @Deprecated 164 public boolean hasAside(HtmlDocSerializerSession session); 165 166 /** 167 * @deprecated Use {@link #writeTo(HtmlDocSerializerSession, HtmlWriter, Object)} 168 */ 169 @SuppressWarnings("javadoc") 170 @Deprecated 171 public boolean hasFooter(HtmlDocSerializerSession session); 172}