author | jjg |
Mon, 22 Aug 2016 16:32:40 -0700 | |
changeset 40587 | 1c355ea550ed |
parent 40303 | 96a1226aca18 |
child 45157 | f5f796453339 |
permissions | -rw-r--r-- |
36526 | 1 |
/* |
2 |
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
package jdk.javadoc.internal.doclets.formats.html; |
|
27 |
||
28 |
import java.util.Map; |
|
29 |
import java.util.Set; |
|
30 |
||
31 |
import javax.lang.model.element.ModuleElement; |
|
32 |
import javax.lang.model.element.PackageElement; |
|
33 |
||
34 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; |
|
35 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
|
36 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
|
37 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
|
38 |
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml; |
|
39 |
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
|
40 |
import jdk.javadoc.internal.doclets.toolkit.Content; |
|
40587 | 41 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
36526 | 42 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
43 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
|
44 |
||
45 |
/** |
|
46 |
* Generate the module index for the left-hand frame in the generated output. |
|
47 |
* A click on the module name in this frame will update the page in the top |
|
48 |
* left hand frame with the listing of packages of the clicked module. |
|
49 |
* |
|
50 |
* <p><b>This is NOT part of any supported API. |
|
51 |
* If you write code that depends on this, you do so at your own risk. |
|
52 |
* This code and its internal interfaces are subject to change or |
|
53 |
* deletion without notice.</b> |
|
54 |
* |
|
55 |
* @author Bhavesh Patel |
|
56 |
*/ |
|
57 |
public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter { |
|
58 |
||
59 |
/** |
|
60 |
* Construct the ModuleIndexFrameWriter object. |
|
61 |
* |
|
62 |
* @param configuration the configuration object |
|
63 |
* @param filename Name of the module index file to be generated. |
|
64 |
*/ |
|
65 |
public ModuleIndexFrameWriter(ConfigurationImpl configuration, |
|
40587 | 66 |
DocPath filename) { |
36526 | 67 |
super(configuration, filename); |
68 |
} |
|
69 |
||
70 |
/** |
|
71 |
* Generate the module index file named "module-overview-frame.html". |
|
40587 | 72 |
* @throws DocFileIOException |
36526 | 73 |
* @param configuration the configuration object |
74 |
*/ |
|
40587 | 75 |
public static void generate(ConfigurationImpl configuration) throws DocFileIOException { |
36526 | 76 |
DocPath filename = DocPaths.MODULE_OVERVIEW_FRAME; |
40587 | 77 |
ModuleIndexFrameWriter modulegen = new ModuleIndexFrameWriter(configuration, filename); |
78 |
modulegen.buildModuleIndexFile("doclet.Window_Overview", false); |
|
36526 | 79 |
} |
80 |
||
81 |
/** |
|
82 |
* {@inheritDoc} |
|
83 |
*/ |
|
84 |
protected void addModulesList(Map<ModuleElement, Set<PackageElement>> modules, String text, |
|
85 |
String tableSummary, Content body) { |
|
86 |
Content heading = HtmlTree.HEADING(HtmlConstants.MODULE_HEADING, true, |
|
40303 | 87 |
contents.modulesLabel); |
36526 | 88 |
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN)) |
89 |
? HtmlTree.MAIN(HtmlStyle.indexContainer, heading) |
|
90 |
: HtmlTree.DIV(HtmlStyle.indexContainer, heading); |
|
91 |
HtmlTree ul = new HtmlTree(HtmlTag.UL); |
|
40303 | 92 |
ul.setTitle(contents.modulesLabel); |
36526 | 93 |
for (ModuleElement mdle: modules.keySet()) { |
94 |
ul.addContent(getModuleLink(mdle)); |
|
95 |
} |
|
96 |
htmlTree.addContent(ul); |
|
97 |
body.addContent(htmlTree); |
|
98 |
} |
|
99 |
||
100 |
/** |
|
101 |
* Returns each module name as a separate link. |
|
102 |
* |
|
40229
09f4478d07e5
8154817: Fix the click-through navigation for modules
bpatel
parents:
36526
diff
changeset
|
103 |
* @param mdle the module being documented |
36526 | 104 |
* @return content for the module link |
105 |
*/ |
|
106 |
protected Content getModuleLink(ModuleElement mdle) { |
|
107 |
Content moduleLinkContent; |
|
40229
09f4478d07e5
8154817: Fix the click-through navigation for modules
bpatel
parents:
36526
diff
changeset
|
108 |
Content mdlLabel = new StringContent(mdle.getQualifiedName()); |
09f4478d07e5
8154817: Fix the click-through navigation for modules
bpatel
parents:
36526
diff
changeset
|
109 |
moduleLinkContent = getModuleFramesHyperLink(mdle, mdlLabel, "packageListFrame"); |
36526 | 110 |
Content li = HtmlTree.LI(moduleLinkContent); |
111 |
return li; |
|
112 |
} |
|
113 |
||
114 |
/** |
|
115 |
* {@inheritDoc} |
|
116 |
*/ |
|
117 |
protected void addNavigationBarHeader(Content body) { |
|
118 |
Content headerContent; |
|
119 |
if (configuration.packagesheader.length() > 0) { |
|
120 |
headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader)); |
|
121 |
} else { |
|
122 |
headerContent = new RawHtml(replaceDocRootDir(configuration.header)); |
|
123 |
} |
|
124 |
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, |
|
125 |
HtmlStyle.bar, headerContent); |
|
126 |
body.addContent(heading); |
|
127 |
} |
|
128 |
||
129 |
/** |
|
130 |
* Do nothing as there is no overview information in this page. |
|
131 |
*/ |
|
132 |
protected void addOverviewHeader(Content body) { |
|
133 |
} |
|
134 |
||
135 |
/** |
|
136 |
* Adds "All Classes" link for the top of the left-hand frame page to the |
|
137 |
* documentation tree. |
|
138 |
* |
|
139 |
* @param ul the Content object to which the all classes link should be added |
|
140 |
*/ |
|
141 |
protected void addAllClassesLink(Content ul) { |
|
142 |
Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME, |
|
40303 | 143 |
contents.allClassesLabel, "", "packageFrame"); |
36526 | 144 |
Content li = HtmlTree.LI(linkContent); |
145 |
ul.addContent(li); |
|
146 |
} |
|
147 |
||
148 |
/** |
|
149 |
* Adds "All Packages" link for the top of the left-hand frame page to the |
|
150 |
* documentation tree. |
|
151 |
* |
|
152 |
* @param ul the Content object to which the all packages link should be added |
|
153 |
*/ |
|
154 |
protected void addAllPackagesLink(Content ul) { |
|
155 |
Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME, |
|
40303 | 156 |
contents.allPackagesLabel, "", "packageListFrame"); |
36526 | 157 |
Content li = HtmlTree.LI(linkContent); |
158 |
ul.addContent(li); |
|
159 |
} |
|
160 |
||
161 |
/** |
|
162 |
* {@inheritDoc} |
|
163 |
*/ |
|
164 |
protected void addNavigationBarFooter(Content body) { |
|
40303 | 165 |
Content p = HtmlTree.P(Contents.SPACE); |
36526 | 166 |
body.addContent(p); |
167 |
} |
|
168 |
||
169 |
protected void addModulePackagesList(Map<ModuleElement, Set<PackageElement>> modules, String text, |
|
170 |
String tableSummary, Content body, ModuleElement mdle) { |
|
171 |
} |
|
172 |
} |