8168688: javadoc top left frame should display all modules while in module mode
authorbpatel
Thu, 08 Dec 2016 12:46:59 -0800
changeset 42494 8c5efe520e34
parent 42493 bd4496aee145
child 42495 f4aca3ff3766
8168688: javadoc top left frame should display all modules while in module mode Reviewed-by: jjg
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java
langtools/test/jdk/javadoc/doclet/testModules/TestModules.java
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java	Wed Dec 07 05:58:43 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java	Thu Dec 08 12:46:59 2016 -0800
@@ -117,12 +117,12 @@
         HtmlTree rightContainerDiv = new HtmlTree(HtmlTag.DIV);
         leftContainerDiv.addStyle(HtmlStyle.leftContainer);
         rightContainerDiv.addStyle(HtmlStyle.rightContainer);
-        if (noOfPackages <= 1) {
-            addAllClassesFrameTag(leftContainerDiv);
+        if (configuration.showModules && configuration.modules.size() > 1) {
+            addAllModulesFrameTag(leftContainerDiv);
         } else if (noOfPackages > 1) {
             addAllPackagesFrameTag(leftContainerDiv);
-            addAllClassesFrameTag(leftContainerDiv);
         }
+        addAllClassesFrameTag(leftContainerDiv);
         addClassFrameTag(rightContainerDiv);
         HtmlTree mainContainer = HtmlTree.DIV(HtmlStyle.mainContainer, leftContainerDiv);
         mainContainer.addContent(rightContainerDiv);
@@ -130,6 +130,18 @@
     }
 
     /**
+     * Add the IFRAME tag for the frame that lists all modules.
+     *
+     * @param contentTree to which the information will be added
+     */
+    private void addAllModulesFrameTag(Content contentTree) {
+        HtmlTree frame = HtmlTree.IFRAME(DocPaths.MODULE_OVERVIEW_FRAME.getPath(),
+                "packageListFrame", configuration.getText("doclet.All_Modules"));
+        HtmlTree leftTop = HtmlTree.DIV(HtmlStyle.leftTop, frame);
+        contentTree.addContent(leftTop);
+    }
+
+    /**
      * Add the IFRAME tag for the frame that lists all packages.
      *
      * @param contentTree the content tree to which the information will be added
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Wed Dec 07 05:58:43 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Thu Dec 08 12:46:59 2016 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766
+ * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766 8168688
  * @summary Test modules support in javadoc.
  * @author bpatel
  * @library ../lib
@@ -56,6 +56,7 @@
         checkModuleClickThrough(true);
         checkModuleFilesAndLinks(true);
         checkModulesInSearch(true);
+        checkOverviewFrame(true);
     }
 
     /**
@@ -76,6 +77,7 @@
         checkModuleClickThrough(true);
         checkModuleFilesAndLinks(true);
         checkModulesInSearch(true);
+        checkOverviewFrame(true);
     }
 
     /**
@@ -92,6 +94,7 @@
         checkNoDescription(true);
         checkModuleLink();
         checkModuleFilesAndLinks(true);
+        checkOverviewFrame(true);
     }
 
     /**
@@ -108,6 +111,7 @@
         checkHtml5NoDescription(true);
         checkModuleLink();
         checkModuleFilesAndLinks(true);
+        checkOverviewFrame(true);
     }
 
     /**
@@ -123,6 +127,7 @@
         checkModuleClickThrough(false);
         checkModuleFilesAndLinks(false);
         checkModulesInSearch(false);
+        checkOverviewFrame(false);
     }
 
     /**
@@ -137,6 +142,7 @@
         checkHtml5OverviewSummaryPackages();
         checkModuleFilesAndLinks(false);
         checkModulesInSearch(false);
+        checkOverviewFrame(false);
     }
 
     /**
@@ -179,6 +185,7 @@
                 "testpkgmdl1");
         checkExit(Exit.OK);
         checkModuleFilesAndLinks(true);
+        checkNegatedOverviewFrame();
     }
 
     /**
@@ -620,4 +627,18 @@
         checkOutput("module2-summary.html", false,
                 "@AnnotationTypeUndocumented");
 }
+
+    void checkOverviewFrame(boolean found) {
+        checkOutput("index.html", !found,
+                "<iframe src=\"overview-frame.html\" name=\"packageListFrame\" title=\"All Packages\"></iframe>");
+        checkOutput("index.html", found,
+                "<iframe src=\"module-overview-frame.html\" name=\"packageListFrame\" title=\"All Modules\"></iframe>");
 }
+
+    void checkNegatedOverviewFrame() {
+        checkOutput("index.html", false,
+                "<iframe src=\"overview-frame.html\" name=\"packageListFrame\" title=\"All Packages\"></iframe>");
+        checkOutput("index.html", false,
+                "<iframe src=\"module-overview-frame.html\" name=\"packageListFrame\" title=\"All Modules\"></iframe>");
+    }
+}