8188578: move printFramesDocument from HtmlDocWriter to FrameOutputWriter
authorjjg
Fri, 06 Oct 2017 18:40:33 -0700
changeset 47321 da60bce4fc9f
parent 47320 8b09673f7ede
child 47322 d94b2c6e26a9
8188578: move printFramesDocument from HtmlDocWriter to FrameOutputWriter Reviewed-by: ksrini
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java	Fri Oct 06 20:54:37 2017 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java	Fri Oct 06 18:40:33 2017 -0700
@@ -25,11 +25,15 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
+import jdk.javadoc.internal.doclets.formats.html.markup.Comment;
+import jdk.javadoc.internal.doclets.formats.html.markup.DocType;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlDocument;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
+import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
@@ -110,15 +114,41 @@
             body.addContent(frame);
         }
         if (configuration.windowtitle.length() > 0) {
-            printFramesDocument(configuration.windowtitle, configuration,
-                    body);
+            printFramesDocument(configuration.windowtitle, body);
         } else {
-            printFramesDocument(configuration.getText("doclet.Generated_Docs_Untitled"),
-                    configuration, body);
+            printFramesDocument(configuration.getText("doclet.Generated_Docs_Untitled"), body);
         }
     }
 
     /**
+     * Print the frames version of the Html file header.
+     * Called only when generating an HTML frames file.
+     *
+     * @param title Title of this HTML document
+     * @param body the body content tree to be added to the HTML document
+     * @throws DocFileIOException if there is an error writing the frames document
+     */
+    private void printFramesDocument(String title, HtmlTree body) throws DocFileIOException {
+        Content htmlDocType = configuration.isOutputHtml5()
+                ? DocType.HTML5
+                : DocType.TRANSITIONAL;
+        Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
+        Content head = new HtmlTree(HtmlTag.HEAD);
+        head.addContent(getGeneratedBy(!configuration.notimestamp));
+        Content windowTitle = HtmlTree.TITLE(new StringContent(title));
+        head.addContent(windowTitle);
+        Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE, configuration.charset);
+        head.addContent(meta);
+        head.addContent(getStyleSheetProperties(configuration));
+        head.addContent(getFramesJavaScript());
+        Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
+                head, body);
+        Content htmlDocument = new HtmlDocument(htmlDocType,
+                htmlComment, htmlTree);
+        write(htmlDocument);
+    }
+
+    /**
      * Get the frame sizes and their contents.
      *
      * @return a content tree for the frame details
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java	Fri Oct 06 20:54:37 2017 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java	Fri Oct 06 18:40:33 2017 -0700
@@ -37,7 +37,6 @@
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
-import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
@@ -310,36 +309,6 @@
     }
 
     /**
-     * Print the frames version of the Html file header.
-     * Called only when generating an HTML frames file.
-     *
-     * @param title Title of this HTML document
-     * @param configuration the configuration object
-     * @param body the body content tree to be added to the HTML document
-     * @throws DocFileIOException if there is an error writing the frames document
-     */
-    public void printFramesDocument(String title, HtmlConfiguration configuration,
-            HtmlTree body) throws DocFileIOException {
-        Content htmlDocType = configuration.isOutputHtml5()
-                ? DocType.HTML5
-                : DocType.TRANSITIONAL;
-        Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
-        Content head = new HtmlTree(HtmlTag.HEAD);
-        head.addContent(getGeneratedBy(!configuration.notimestamp));
-        Content windowTitle = HtmlTree.TITLE(new StringContent(title));
-        head.addContent(windowTitle);
-        Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE, configuration.charset);
-        head.addContent(meta);
-        head.addContent(getStyleSheetProperties(configuration));
-        head.addContent(getFramesJavaScript());
-        Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
-                head, body);
-        Content htmlDocument = new HtmlDocument(htmlDocType,
-                htmlComment, htmlTree);
-        write(htmlDocument);
-    }
-
-    /**
      * Returns a link to the stylesheet file.
      *
      * @param configuration the configuration for this doclet