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>&lt;html&gt;
023 *       &lt;head&gt;
024 *          &lt;style&gt;
025 *             <xv>CSS styles and links to stylesheets</xv>
026 *          &lt;/style&gt;
027 *          &lt;script&gt;
028 *             <xv>Javascript</xv>
029 *          &lt;/script&gt;
030 *       &lt;/head&gt;
031 *       &lt;body&gt;
032 *          &lt;header&gt;
033 *             &lt;h1&gt;<xv>Page title</xv>&lt;/h1&gt;
034 *             &lt;h2&gt;<xv>Page description</xv>&lt;/h2&gt;
035 *             <xv>Arbitrary page branding</xv>
036 *          &lt;/header&gt;
037 *          &lt;nav&gt;
038 *             <xv>Page links</xv>
039 *          &lt;/nav&gt;
040 *          &lt;aside&gt;
041 *             <xv>Side-bar page links</xv>
042 *          &lt;/aside&gt;
043 *          &lt;article&gt;
044 *             <xv>Contents of serialized object</xv>
045 *          &lt;/article&gt;
046 *          &lt;footer&gt;
047 *             <xv>Footer message</xv>
048 *          &lt;/footer&gt;
049 *       &lt;/body&gt;
050 *    &lt;/html&gt;</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>&lt;head&gt;</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}