8190824: Eliminate HtmlDocWriter
authorjjg
Thu, 16 Nov 2017 15:21:04 -0800
changeset 47852 90e0110a05f6
parent 47851 6a9bb4f77d50
child 47853 3e345eba9255
8190824: Eliminate HtmlDocWriter Reviewed-by: bpatel, ksrini
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.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/HtmlDocletWriter.java	Thu Nov 16 15:17:47 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Thu Nov 16 15:21:04 2017 -0800
@@ -67,12 +67,10 @@
 import com.sun.source.doctree.TextTree;
 import com.sun.source.util.SimpleDocTreeVisitor;
 
-import jdk.javadoc.internal.doclets.formats.html.markup.Comment;
 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
 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.HtmlConstants;
-import jdk.javadoc.internal.doclets.formats.html.markup.HtmlDocWriter;
 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;
@@ -118,7 +116,7 @@
  * @author Robert Field
  * @author Bhavesh Patel (Modified)
  */
-public class HtmlDocletWriter extends HtmlDocWriter {
+public class HtmlDocletWriter {
 
     /**
      * Relative path from the file getting generated to the destination
@@ -191,10 +189,10 @@
     /**
      * Constructor to construct the HtmlStandardWriter object.
      *
-     * @param path File to be generated.
+     * @param configuration the configuration for this doclet
+     * @param path the file to be generated.
      */
     public HtmlDocletWriter(HtmlConfiguration configuration, DocPath path) {
-        super(configuration, path);
         this.configuration = configuration;
         this.contents = configuration.contents;
         this.messages = configuration.messages;
@@ -204,6 +202,9 @@
         this.path = path;
         this.pathToRoot = path.parent().invert();
         this.filename = path.basename();
+
+        messages.notice("doclet.Generating_0",
+            DocFile.createFileForOutput(configuration, path).getPath());
     }
 
     /**
@@ -1204,6 +1205,18 @@
     }
 
     /**
+     * Get the enclosed name of the package
+     *
+     * @param te  TypeElement
+     * @return the name
+     */
+    public String getEnclosingPackageName(TypeElement te) {
+
+        PackageElement encl = configuration.utils.containingPackage(te);
+        return (encl.isUnnamed()) ? "" : (encl.getQualifiedName() + ".");
+    }
+
+    /**
      * Add the class link, with only class name as the strong link and prefixing
      * plain package name.
      *
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java	Thu Nov 16 15:17:47 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java	Thu Nov 16 15:21:04 2017 -0800
@@ -31,6 +31,7 @@
 import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.PackageElement;
 
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
@@ -40,6 +41,7 @@
 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.DocLink;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 
@@ -111,6 +113,17 @@
         return li;
     }
 
+    private Content getModuleFramesHyperLink(ModuleElement mdle, Content label, String target) {
+        DocLink mdlLink = new DocLink(DocPaths.moduleFrame(mdle));
+        DocLink mtFrameLink = new DocLink(DocPaths.moduleTypeFrame(mdle));
+        DocLink cFrameLink = new DocLink(DocPaths.moduleSummary(mdle));
+        HtmlTree anchor = HtmlTree.A(mdlLink.toString(), label);
+        String onclickStr = "updateModuleFrame('" + mtFrameLink + "','" + cFrameLink + "');";
+        anchor.addAttr(HtmlAttr.TARGET, target);
+        anchor.addAttr(HtmlAttr.ONCLICK, onclickStr);
+        return anchor;
+    }
+
     /**
      * {@inheritDoc}
      */
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java	Thu Nov 16 15:17:47 2017 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.javadoc.internal.doclets.formats.html.markup;
-
-import javax.lang.model.element.ModuleElement;
-import javax.lang.model.element.PackageElement;
-import javax.lang.model.element.TypeElement;
-
-import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
-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.DocLink;
-import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
-import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-
-
-/**
- * Class for the Html Format Code Generation specific to JavaDoc.
- * This Class contains methods related to the Html Code Generation which
- * are used by the Sub-Classes in the package jdk.javadoc.internal.tool.standard.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- *
- * @author Atul M Dambalkar
- * @author Robert Field
- */
-public abstract class HtmlDocWriter {
-
-    private final HtmlConfiguration configuration;
-
-    /**
-     * Constructor.
-     *
-     * @param configuration the configuration for this doclet
-     * @param filename the path for the output file
-     */
-    public HtmlDocWriter(HtmlConfiguration configuration, DocPath filename) {
-        this.configuration = configuration;
-        Messages messages = configuration.getMessages();
-        messages.notice("doclet.Generating_0",
-            DocFile.createFileForOutput(configuration, filename).getPath());
-    }
-
-    public Content getModuleFramesHyperLink(ModuleElement mdle, Content label, String target) {
-        DocLink mdlLink = new DocLink(DocPaths.moduleFrame(mdle));
-        DocLink mtFrameLink = new DocLink(DocPaths.moduleTypeFrame(mdle));
-        DocLink cFrameLink = new DocLink(DocPaths.moduleSummary(mdle));
-        HtmlTree anchor = HtmlTree.A(mdlLink.toString(), label);
-        String onclickStr = "updateModuleFrame('" + mtFrameLink + "','" + cFrameLink + "');";
-        anchor.addAttr(HtmlAttr.TARGET, target);
-        anchor.addAttr(HtmlAttr.ONCLICK, onclickStr);
-        return anchor;
-    }
-
-    /**
-     * Get the enclosed name of the package
-     *
-     * @param te  TypeElement
-     * @return the name
-     */
-    public String getEnclosingPackageName(TypeElement te) {
-
-        PackageElement encl = configuration.utils.containingPackage(te);
-        return (encl.isUnnamed()) ? "" : (encl.getQualifiedName() + ".");
-    }
-}