mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8215599: Remove support for javadoc "frames" mode
Reviewed-by: jjg
This commit is contained in:
parent
0eadf53694
commit
2ace3e69e6
95 changed files with 162 additions and 3619 deletions
|
@ -44,9 +44,7 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
|||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
|
||||
/**
|
||||
* Abstract class to generate the module overview files in
|
||||
* Frame and Non-Frame format. This will be sub-classed to
|
||||
* generate module-overview-frame.html as well as module-overview-summary.html.
|
||||
* Abstract class to generate the module overview files.
|
||||
*
|
||||
* <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.
|
||||
|
@ -118,19 +116,16 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
|
|||
String tableSummary, Content main, ModuleElement mdle);
|
||||
|
||||
/**
|
||||
* Generate and prints the contents in the module index file. Call appropriate
|
||||
* methods from the sub-class in order to generate Frame or Non
|
||||
* Frame format.
|
||||
* Generate and prints the contents in the module index file.
|
||||
*
|
||||
* @param title the title of the window
|
||||
* @param description the content for the description META tag
|
||||
* @param includeScript boolean set true if windowtitle script is to be included
|
||||
* @throws DocFileIOException if there is a problem building the module index file
|
||||
*/
|
||||
protected void buildModuleIndexFile(String title, String description, boolean includeScript)
|
||||
protected void buildModuleIndexFile(String title, String description)
|
||||
throws DocFileIOException {
|
||||
String windowOverview = resources.getText(title);
|
||||
Content body = getBody(includeScript, getWindowTitle(windowOverview));
|
||||
Content body = getBody(getWindowTitle(windowOverview));
|
||||
Content header = HtmlTree.HEADER();
|
||||
addNavigationBarHeader(header);
|
||||
Content main = HtmlTree.MAIN();
|
||||
|
@ -149,20 +144,17 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Generate and prints the contents in the module packages index file. Call appropriate
|
||||
* methods from the sub-class in order to generate Frame or Non
|
||||
* Frame format.
|
||||
* Generate and prints the contents in the module packages index file.
|
||||
*
|
||||
* @param title the title of the window.
|
||||
* @param description the content for the description META tag
|
||||
* @param includeScript boolean set true if windowtitle script is to be included
|
||||
* @param mdle the name of the module being documented
|
||||
* @throws DocFileIOException if there is an exception building the module packages index file
|
||||
*/
|
||||
protected void buildModulePackagesIndexFile(String title, String description,
|
||||
boolean includeScript, ModuleElement mdle) throws DocFileIOException {
|
||||
ModuleElement mdle) throws DocFileIOException {
|
||||
String windowOverview = resources.getText(title);
|
||||
Content body = getBody(includeScript, getWindowTitle(windowOverview));
|
||||
Content body = getBody(getWindowTitle(windowOverview));
|
||||
Content header = HtmlTree.HEADER();
|
||||
addNavigationBarHeader(header);
|
||||
Content main = HtmlTree.MAIN();
|
||||
|
@ -188,7 +180,7 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
|
|||
protected void addOverview(Content main) { }
|
||||
|
||||
/**
|
||||
* Adds the frame or non-frame module index to the documentation tree.
|
||||
* Adds the module index to the documentation tree.
|
||||
*
|
||||
* @param header the document tree to which the navigational links will be added
|
||||
* @param main the document tree to which the modules list will be added
|
||||
|
@ -201,7 +193,7 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds the frame or non-frame module packages index to the documentation tree.
|
||||
* Adds the module packages index to the documentation tree.
|
||||
*
|
||||
* @param header the document tree to which the navigational links will be added
|
||||
* @param main the document tree to which the module packages list will be added
|
||||
|
@ -226,13 +218,6 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
|
|||
*/
|
||||
protected void addIndexContents(Collection<ModuleElement> modules, String text,
|
||||
String tableSummary, Content header, Content main) {
|
||||
HtmlTree htmlTree = HtmlTree.NAV();
|
||||
htmlTree.setStyle(HtmlStyle.indexNav);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
addAllClassesLink(ul);
|
||||
addAllPackagesLink(ul);
|
||||
htmlTree.add(ul);
|
||||
header.add(htmlTree);
|
||||
addModulesList(main);
|
||||
}
|
||||
|
||||
|
@ -248,14 +233,6 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
|
|||
*/
|
||||
protected void addModulePackagesIndexContents(String text,
|
||||
String tableSummary, Content header, Content main, ModuleElement mdle) {
|
||||
HtmlTree htmlTree = HtmlTree.NAV();
|
||||
htmlTree.setStyle(HtmlStyle.indexNav);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
addAllClassesLink(ul);
|
||||
addAllPackagesLink(ul);
|
||||
addAllModulesLink(ul);
|
||||
htmlTree.add(ul);
|
||||
header.add(htmlTree);
|
||||
addModulePackagesList(modules, text, tableSummary, main, mdle);
|
||||
}
|
||||
|
||||
|
@ -273,25 +250,4 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
|
|||
body.add(div);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Do nothing. This will be overridden in ModuleIndexFrameWriter.
|
||||
*
|
||||
* @param div the document tree to which the all classes link will be added
|
||||
*/
|
||||
protected void addAllClassesLink(Content div) { }
|
||||
|
||||
/**
|
||||
* Do nothing. This will be overridden in ModuleIndexFrameWriter.
|
||||
*
|
||||
* @param div the document tree to which the all packages link will be added
|
||||
*/
|
||||
protected void addAllPackagesLink(Content div) { }
|
||||
|
||||
/**
|
||||
* Do nothing. This will be overridden in ModulePackageIndexFrameWriter.
|
||||
*
|
||||
* @param div the document tree to which the all modules link will be added
|
||||
*/
|
||||
protected void addAllModulesLink(Content div) { }
|
||||
}
|
||||
|
|
|
@ -40,9 +40,8 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
|||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
|
||||
/**
|
||||
* Abstract class to generate the overview files in
|
||||
* Frame and Non-Frame format. This will be sub-classed by to
|
||||
* generate overview-frame.html as well as overview-summary.html.
|
||||
* Abstract class to generate the overview files. This will be sub-classed to
|
||||
* generate overview-summary.html.
|
||||
*
|
||||
* <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.
|
||||
|
@ -103,19 +102,16 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
|
|||
protected abstract void addPackagesList(Content main);
|
||||
|
||||
/**
|
||||
* Generate and prints the contents in the package index file. Call appropriate
|
||||
* methods from the sub-class in order to generate Frame or Non
|
||||
* Frame format.
|
||||
* Generate and prints the contents in the package index file.
|
||||
*
|
||||
* @param title the title of the window
|
||||
* @param description the content for the description META tag
|
||||
* @param includeScript boolean set true if windowtitle script is to be included
|
||||
* @throws DocFileIOException if there is a problem building the package index file
|
||||
*/
|
||||
protected void buildPackageIndexFile(String title, String description, boolean includeScript)
|
||||
protected void buildPackageIndexFile(String title, String description)
|
||||
throws DocFileIOException {
|
||||
String windowOverview = resources.getText(title);
|
||||
Content body = getBody(includeScript, getWindowTitle(windowOverview));
|
||||
Content body = getBody(getWindowTitle(windowOverview));
|
||||
Content header = HtmlTree.HEADER();
|
||||
addNavigationBarHeader(header);
|
||||
Content main = HtmlTree.MAIN();
|
||||
|
@ -140,7 +136,7 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
|
|||
protected void addOverview(Content main) { }
|
||||
|
||||
/**
|
||||
* Adds the frame or non-frame package index to the documentation tree.
|
||||
* Adds the package index to the documentation tree.
|
||||
*
|
||||
* @param header the document tree to which the navigation links will be added
|
||||
* @param main the document tree to which the packages list will be added
|
||||
|
|
|
@ -1,169 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2019, 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;
|
||||
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
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.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Generate the file with list of all the classes in this run. This page will be
|
||||
* used in the left-hand bottom frame, when "All Classes" link is clicked in
|
||||
* the left-hand top frame. The name of the generated file is
|
||||
* "allclasses-frame.html".
|
||||
*
|
||||
* <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 Doug Kramer
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class AllClassesFrameWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* Index of all the classes.
|
||||
*/
|
||||
protected IndexBuilder indexbuilder;
|
||||
|
||||
/**
|
||||
* BR tag to be used within a document tree.
|
||||
*/
|
||||
final HtmlTree BR = new HtmlTree(HtmlTag.BR);
|
||||
|
||||
/**
|
||||
* Construct AllClassesFrameWriter object. Also initializes the indexbuilder
|
||||
* variable in this class.
|
||||
* @param configuration The current configuration
|
||||
* @param filename Path to the file which is getting generated.
|
||||
* @param indexbuilder Unicode based Index from {@link IndexBuilder}
|
||||
*/
|
||||
public AllClassesFrameWriter(HtmlConfiguration configuration,
|
||||
DocPath filename, IndexBuilder indexbuilder) {
|
||||
super(configuration, filename);
|
||||
this.indexbuilder = indexbuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create AllClassesFrameWriter object. Then use it to generate the
|
||||
* "allclasses-frame.html" file. Generate the file in the current or the
|
||||
* destination directory.
|
||||
*
|
||||
* @param configuration the configuration for this javadoc run
|
||||
* @throws DocFileIOException
|
||||
*/
|
||||
public static void generate(HtmlConfiguration configuration,
|
||||
IndexBuilder indexBuilder) throws DocFileIOException {
|
||||
if (configuration.frames) {
|
||||
generate(configuration, indexBuilder, DocPaths.ALLCLASSES_FRAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
private static void generate(HtmlConfiguration configuration, IndexBuilder indexBuilder,
|
||||
DocPath fileName, boolean wantFrames) throws DocFileIOException {
|
||||
AllClassesFrameWriter allclassgen = new AllClassesFrameWriter(configuration,
|
||||
fileName, indexBuilder);
|
||||
allclassgen.buildAllClassesFile(wantFrames);
|
||||
allclassgen = new AllClassesFrameWriter(configuration,
|
||||
fileName, indexBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print all the classes in the file.
|
||||
* @param wantFrames True if we want frames.
|
||||
*/
|
||||
protected void buildAllClassesFile(boolean wantFrames) throws DocFileIOException {
|
||||
String label = resources.getText("doclet.All_Classes");
|
||||
Content body = getBody(false, getWindowTitle(label));
|
||||
Content htmlTree = HtmlTree.MAIN();
|
||||
Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING,
|
||||
HtmlStyle.bar, contents.allClassesLabel);
|
||||
htmlTree.add(heading);
|
||||
Content ul = new HtmlTree(HtmlTag.UL);
|
||||
// Generate the class links and add it to the tdFont tree.
|
||||
addAllClasses(ul, wantFrames);
|
||||
HtmlTree div = HtmlTree.DIV(HtmlStyle.indexContainer, ul);
|
||||
htmlTree.add(div);
|
||||
body.add(htmlTree);
|
||||
printHtmlDocument(null, "all classes (frame)", body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the sorted index of all the classes and add all the classes to the
|
||||
* content list.
|
||||
*
|
||||
* @param content HtmlTree content to which all classes information will be added
|
||||
* @param wantFrames True if we want frames.
|
||||
*/
|
||||
protected void addAllClasses(Content content, boolean wantFrames) {
|
||||
for (Character unicode : indexbuilder.index()) {
|
||||
addContents(indexbuilder.getMemberList(unicode), wantFrames, content);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a list of classes, generate links for each class or interface.
|
||||
* If the class kind is interface, print it in the italics font. Also all
|
||||
* links should target the right-hand frame. If clicked on any class name
|
||||
* in this page, appropriate class page should get opened in the right-hand
|
||||
* frame.
|
||||
*
|
||||
* @param classlist Sorted list of classes.
|
||||
* @param wantFrames True if we want frames.
|
||||
* @param content HtmlTree content to which the links will be added
|
||||
*/
|
||||
protected void addContents(Iterable<? extends Element> classlist, boolean wantFrames,
|
||||
Content content) {
|
||||
for (Element element : classlist) {
|
||||
TypeElement typeElement = (TypeElement)element;
|
||||
if (!utils.isCoreClass(typeElement)) {
|
||||
continue;
|
||||
}
|
||||
Content label = interfaceName(typeElement, false);
|
||||
Content linkContent;
|
||||
if (wantFrames) {
|
||||
linkContent = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.ALL_CLASSES_FRAME, typeElement).label(label).target("classFrame"));
|
||||
} else {
|
||||
linkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, typeElement).label(label));
|
||||
}
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
content.add(li);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -63,7 +63,7 @@ public class AllClassesIndexWriter extends HtmlDocletWriter {
|
|||
private final Navigation navBar;
|
||||
|
||||
/**
|
||||
* Construct AllClassesFrameWriter object. Also initializes the indexbuilder variable in this
|
||||
* Construct AllClassesIndexWriter object. Also initializes the indexbuilder variable in this
|
||||
* class.
|
||||
*
|
||||
* @param configuration The current configuration
|
||||
|
@ -101,7 +101,7 @@ public class AllClassesIndexWriter extends HtmlDocletWriter {
|
|||
*/
|
||||
protected void buildAllClassesFile() throws DocFileIOException {
|
||||
String label = resources.getText("doclet.All_Classes");
|
||||
HtmlTree bodyTree = getBody(true, getWindowTitle(label));
|
||||
HtmlTree bodyTree = getBody(getWindowTitle(label));
|
||||
HtmlTree header = HtmlTree.HEADER();
|
||||
addTop(header);
|
||||
navBar.setUserHeader(getUserHeaderFooter(true));
|
||||
|
|
|
@ -83,7 +83,7 @@ public class AllPackagesIndexWriter extends HtmlDocletWriter {
|
|||
*/
|
||||
protected void buildAllPackagesFile() throws DocFileIOException {
|
||||
String label = resources.getText("doclet.All_Packages");
|
||||
HtmlTree bodyTree = getBody(true, getWindowTitle(label));
|
||||
HtmlTree bodyTree = getBody(getWindowTitle(label));
|
||||
HtmlTree header = HtmlTree.HEADER();
|
||||
addTop(header);
|
||||
navBar.setUserHeader(getUserHeaderFooter(true));
|
||||
|
|
|
@ -84,7 +84,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
|||
*/
|
||||
@Override
|
||||
public Content getHeader(String header) {
|
||||
HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getSimpleName(annotationType)));
|
||||
HtmlTree bodyTree = getBody(getWindowTitle(utils.getSimpleName(annotationType)));
|
||||
HtmlTree htmlTree = HtmlTree.HEADER();
|
||||
addTop(htmlTree);
|
||||
Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(annotationType),
|
||||
|
|
|
@ -434,7 +434,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
|||
String clname = utils.getFullyQualifiedName(typeElement);
|
||||
String title = resources.getText("doclet.Window_ClassUse_Header",
|
||||
cltype, clname);
|
||||
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
|
||||
HtmlTree bodyTree = getBody(getWindowTitle(title));
|
||||
HtmlTree htmlTree = HtmlTree.HEADER();
|
||||
addTop(htmlTree);
|
||||
Content mdleLinkContent = getModuleLink(utils.elementUtils.getModuleOf(typeElement),
|
||||
|
|
|
@ -105,7 +105,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||
*/
|
||||
@Override
|
||||
public Content getHeader(String header) {
|
||||
HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getSimpleName(typeElement)));
|
||||
HtmlTree bodyTree = getBody(getWindowTitle(utils.getSimpleName(typeElement)));
|
||||
HtmlTree htmlTree = HtmlTree.HEADER();
|
||||
addTop(htmlTree);
|
||||
Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(typeElement),
|
||||
|
|
|
@ -105,7 +105,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
|
|||
@Override
|
||||
public Content getHeader() {
|
||||
String label = resources.getText("doclet.Constants_Summary");
|
||||
HtmlTree bodyTree = getBody(true, getWindowTitle(label));
|
||||
HtmlTree bodyTree = getBody(getWindowTitle(label));
|
||||
HtmlTree htmlTree = HtmlTree.HEADER();
|
||||
addTop(htmlTree);
|
||||
navBar.setUserHeader(getUserHeaderFooter(true));
|
||||
|
|
|
@ -369,7 +369,7 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
|
|||
*/
|
||||
public HtmlTree getHeader() {
|
||||
String title = resources.getText("doclet.Window_Deprecated_List");
|
||||
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
|
||||
HtmlTree bodyTree = getBody(getWindowTitle(title));
|
||||
HtmlTree htmlTree = HtmlTree.HEADER();
|
||||
addTop(htmlTree);
|
||||
navBar.setUserHeader(getUserHeaderFooter(true));
|
||||
|
|
|
@ -179,7 +179,7 @@ public class DocFilesHandlerImpl implements DocFilesHandler {
|
|||
Content localTagsContent = docletWriter.commentTagsToContent(null, dfElement, localTags, false);
|
||||
|
||||
String title = getWindowTitle(docletWriter, dfElement).trim();
|
||||
HtmlTree htmlContent = docletWriter.getBody(true, title);
|
||||
HtmlTree htmlContent = docletWriter.getBody(title);
|
||||
docletWriter.addTop(htmlContent);
|
||||
PackageElement pkg = (PackageElement) element;
|
||||
this.navBar = new Navigation(pkg, configuration, docletWriter.fixedNavDiv,
|
||||
|
|
|
@ -1,272 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2019, 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;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Head;
|
||||
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.Script;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
||||
|
||||
/**
|
||||
* Generate the documentation in the Html "frame" format in the browser. The
|
||||
* generated documentation will have two or three frames depending upon the
|
||||
* number of packages on the command line. In general there will be three frames
|
||||
* in the output, a left-hand top frame will have a list of all packages with
|
||||
* links to target left-hand bottom frame. The left-hand bottom frame will have
|
||||
* the particular package contents or the all-classes list, where as the single
|
||||
* right-hand frame will have overview or package summary or class file. Also
|
||||
* take care of browsers which do not support Html frames.
|
||||
*
|
||||
* <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
|
||||
*/
|
||||
public class FrameOutputWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* Number of packages specified on the command line.
|
||||
*/
|
||||
int noOfPackages;
|
||||
|
||||
/**
|
||||
* Constructor to construct FrameOutputWriter object.
|
||||
*
|
||||
* @param configuration for this run
|
||||
* @param filename File to be generated.
|
||||
*/
|
||||
public FrameOutputWriter(HtmlConfiguration configuration, DocPath filename) {
|
||||
super(configuration, filename);
|
||||
noOfPackages = configuration.packages.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct FrameOutputWriter object and then use it to generate the Html
|
||||
* file which will have the description of all the frames in the
|
||||
* documentation. The name of the generated file is "index.html" which is
|
||||
* the default first file for Html documents.
|
||||
* @param configuration the configuration for this doclet
|
||||
* @throws DocFileIOException if there is a problem generating the frame file
|
||||
*/
|
||||
public static void generate(HtmlConfiguration configuration) throws DocFileIOException {
|
||||
FrameOutputWriter framegen = new FrameOutputWriter(configuration, DocPaths.INDEX);
|
||||
framegen.generateFrameFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the constants in the "index.html" file. Print the frame details
|
||||
* as well as warning if browser is not supporting the Html frames.
|
||||
* @throws DocFileIOException if there is a problem generating the frame file
|
||||
*/
|
||||
protected void generateFrameFile() throws DocFileIOException {
|
||||
Content frame = getFrameDetails();
|
||||
HtmlTree body = new HtmlTree(HtmlTag.BODY);
|
||||
body.put(HtmlAttr.CLASS, "frames");
|
||||
body.put(HtmlAttr.ONLOAD, "loadFrames()");
|
||||
String topFilePath = configuration.topFile.getPath();
|
||||
Script script = new Script(
|
||||
"\nif (targetPage == \"\" || targetPage == \"undefined\")\n" +
|
||||
" window.location.replace(")
|
||||
.appendStringLiteral(topFilePath, '\'')
|
||||
.append(");\n");
|
||||
body.add(script.asContent());
|
||||
Content noScript = HtmlTree.NOSCRIPT(contents.noScriptMessage);
|
||||
body.add(noScript);
|
||||
HtmlTree main = HtmlTree.MAIN(frame);
|
||||
body.add(main);
|
||||
if (configuration.windowtitle.length() > 0) {
|
||||
printFramesDocument(configuration.windowtitle, body);
|
||||
} else {
|
||||
printFramesDocument(resources.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 htmlComment = contents.newPage;
|
||||
Head head = new Head(path, configuration.docletVersion)
|
||||
.setTimestamp(!configuration.notimestamp)
|
||||
.setTitle(title)
|
||||
.setDescription("frames")
|
||||
.setGenerator(getGenerator(getClass()))
|
||||
.setCharset(configuration.charset)
|
||||
.setStylesheets(configuration.getMainStylesheet(), configuration.getAdditionalStylesheets())
|
||||
.addDefaultScript(false)
|
||||
.addScript(getFramesScript());
|
||||
|
||||
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head.toContent(), body);
|
||||
HtmlDocument htmlDocument = new HtmlDocument(htmlComment, htmlTree);
|
||||
htmlDocument.write(DocFile.createFileForOutput(configuration, path));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the frame sizes and their contents.
|
||||
*
|
||||
* @return a content tree for the frame details
|
||||
*/
|
||||
protected Content getFrameDetails() {
|
||||
HtmlTree leftContainerDiv = new HtmlTree(HtmlTag.DIV);
|
||||
HtmlTree rightContainerDiv = new HtmlTree(HtmlTag.DIV);
|
||||
leftContainerDiv.setStyle(HtmlStyle.leftContainer);
|
||||
rightContainerDiv.setStyle(HtmlStyle.rightContainer);
|
||||
if (configuration.showModules && configuration.modules.size() > 1) {
|
||||
addAllModulesFrameTag(leftContainerDiv);
|
||||
} else if (noOfPackages > 1) {
|
||||
addAllPackagesFrameTag(leftContainerDiv);
|
||||
}
|
||||
addAllClassesFrameTag(leftContainerDiv);
|
||||
addClassFrameTag(rightContainerDiv);
|
||||
HtmlTree mainContainer = HtmlTree.DIV(HtmlStyle.mainContainer, leftContainerDiv);
|
||||
mainContainer.add(rightContainerDiv);
|
||||
return mainContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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", resources.getText("doclet.All_Modules"));
|
||||
HtmlTree leftTop = HtmlTree.DIV(HtmlStyle.leftTop, frame);
|
||||
contentTree.add(leftTop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the IFRAME tag for the frame that lists all packages.
|
||||
*
|
||||
* @param contentTree the content tree to which the information will be added
|
||||
*/
|
||||
private void addAllPackagesFrameTag(Content contentTree) {
|
||||
HtmlTree frame = HtmlTree.IFRAME(DocPaths.OVERVIEW_FRAME.getPath(),
|
||||
"packageListFrame", resources.getText("doclet.All_Packages"));
|
||||
HtmlTree leftTop = HtmlTree.DIV(HtmlStyle.leftTop, frame);
|
||||
contentTree.add(leftTop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the IFRAME tag for the frame that lists all classes.
|
||||
*
|
||||
* @param contentTree the content tree to which the information will be added
|
||||
*/
|
||||
private void addAllClassesFrameTag(Content contentTree) {
|
||||
HtmlTree frame = HtmlTree.IFRAME(DocPaths.ALLCLASSES_FRAME.getPath(),
|
||||
"packageFrame", resources.getText("doclet.All_classes_and_interfaces"));
|
||||
HtmlTree leftBottom = HtmlTree.DIV(HtmlStyle.leftBottom, frame);
|
||||
contentTree.add(leftBottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the IFRAME tag for the frame that describes the class in detail.
|
||||
*
|
||||
* @param contentTree the content tree to which the information will be added
|
||||
*/
|
||||
private void addClassFrameTag(Content contentTree) {
|
||||
HtmlTree frame = HtmlTree.IFRAME(configuration.topFile.getPath(), "classFrame",
|
||||
resources.getText("doclet.Package_class_and_interface_descriptions"));
|
||||
frame.setStyle(HtmlStyle.rightIframe);
|
||||
contentTree.add(frame);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a content tree for the SCRIPT tag for the main page(index.html).
|
||||
*
|
||||
* @return a content for the SCRIPT tag
|
||||
*/
|
||||
protected Script getFramesScript() {
|
||||
return new Script("\n" +
|
||||
" tmpTargetPage = \"\" + window.location.search;\n" +
|
||||
" if (tmpTargetPage != \"\" && tmpTargetPage != \"undefined\")\n" +
|
||||
" tmpTargetPage = tmpTargetPage.substring(1);\n" +
|
||||
" if (tmpTargetPage.indexOf(\":\") != -1 || (tmpTargetPage != \"\" && !validURL(tmpTargetPage)))\n" +
|
||||
" tmpTargetPage = \"undefined\";\n" +
|
||||
" targetPage = tmpTargetPage;\n" +
|
||||
" function validURL(url) {\n" +
|
||||
" try {\n" +
|
||||
" url = decodeURIComponent(url);\n" +
|
||||
" }\n" +
|
||||
" catch (error) {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" var pos = url.indexOf(\".html\");\n" +
|
||||
" if (pos == -1 || pos != url.length - 5)\n" +
|
||||
" return false;\n" +
|
||||
" var allowNumber = false;\n" +
|
||||
" var allowSep = false;\n" +
|
||||
" var seenDot = false;\n" +
|
||||
" for (var i = 0; i < url.length - 5; i++) {\n" +
|
||||
" var ch = url.charAt(i);\n" +
|
||||
" if ('a' <= ch && ch <= 'z' ||\n" +
|
||||
" 'A' <= ch && ch <= 'Z' ||\n" +
|
||||
" ch == '$' ||\n" +
|
||||
" ch == '_' ||\n" +
|
||||
" ch.charCodeAt(0) > 127) {\n" +
|
||||
" allowNumber = true;\n" +
|
||||
" allowSep = true;\n" +
|
||||
" } else if ('0' <= ch && ch <= '9'\n" +
|
||||
" || ch == '-') {\n" +
|
||||
" if (!allowNumber)\n" +
|
||||
" return false;\n" +
|
||||
" } else if (ch == '/' || ch == '.') {\n" +
|
||||
" if (!allowSep)\n" +
|
||||
" return false;\n" +
|
||||
" allowNumber = false;\n" +
|
||||
" allowSep = false;\n" +
|
||||
" if (ch == '.')\n" +
|
||||
" seenDot = true;\n" +
|
||||
" if (ch == '/' && seenDot)\n" +
|
||||
" return false;\n" +
|
||||
" } else {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" return true;\n" +
|
||||
" }\n" +
|
||||
" function loadFrames() {\n" +
|
||||
" if (targetPage != \"\" && targetPage != \"undefined\")\n" +
|
||||
" top.classFrame.location = top.targetPage;\n" +
|
||||
" }\n");
|
||||
}
|
||||
}
|
|
@ -87,7 +87,7 @@ public class HelpWriter extends HtmlDocletWriter {
|
|||
*/
|
||||
protected void generateHelpFile() throws DocFileIOException {
|
||||
String title = resources.getText("doclet.Window_Help_title");
|
||||
HtmlTree body = getBody(true, getWindowTitle(title));
|
||||
HtmlTree body = getBody(getWindowTitle(title));
|
||||
HtmlTree htmlTree = HtmlTree.HEADER();
|
||||
addTop(htmlTree);
|
||||
navBar.setUserHeader(getUserHeaderFooter(true));
|
||||
|
@ -132,8 +132,7 @@ public class HelpWriter extends HtmlDocletWriter {
|
|||
? "doclet.help.overview.modules.body"
|
||||
: "doclet.help.overview.packages.body";
|
||||
Content overviewLink = links.createLink(
|
||||
DocPaths.overviewSummary(configuration.frames),
|
||||
resources.getText("doclet.Overview"));
|
||||
DocPaths.INDEX, resources.getText("doclet.Overview"));
|
||||
Content overviewBody = contents.getContent(overviewKey, overviewLink);
|
||||
Content overviewPara = HtmlTree.P(overviewBody);
|
||||
htmlTree.add(overviewPara);
|
||||
|
@ -299,18 +298,6 @@ public class HelpWriter extends HtmlDocletWriter {
|
|||
ul.add(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
|
||||
}
|
||||
|
||||
// Frames
|
||||
if (configuration.frames) {
|
||||
Content frameHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
|
||||
contents.getContent("doclet.help.frames.head"));
|
||||
htmlTree = HtmlTree.SECTION(frameHead);
|
||||
Content framesBody = contents.getContent("doclet.help.frames.body");
|
||||
Content framePara = HtmlTree.P(framesBody);
|
||||
htmlTree.add(framePara);
|
||||
|
||||
ul.add(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
|
||||
}
|
||||
|
||||
// Serialized Form
|
||||
Content sHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
|
||||
contents.serializedForm);
|
||||
|
|
|
@ -196,12 +196,6 @@ public class HtmlConfiguration extends BaseConfiguration {
|
|||
*/
|
||||
public boolean createoverview = false;
|
||||
|
||||
/**
|
||||
* Specifies whether or not frames should be generated.
|
||||
* Defaults to false; can be set to true by --frames; can be set to false by --no-frames; last one wins.
|
||||
*/
|
||||
public boolean frames = false;
|
||||
|
||||
/**
|
||||
* Collected set of doclint options
|
||||
*/
|
||||
|
@ -375,7 +369,7 @@ public class HtmlConfiguration extends BaseConfiguration {
|
|||
return;
|
||||
}
|
||||
if (createoverview) {
|
||||
topFile = DocPaths.overviewSummary(frames);
|
||||
topFile = DocPaths.INDEX;
|
||||
} else {
|
||||
if (showModules) {
|
||||
topFile = DocPath.empty.resolve(docPaths.moduleSummary(modules.first()));
|
||||
|
@ -640,21 +634,6 @@ public class HtmlConfiguration extends BaseConfiguration {
|
|||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "--frames") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
reporter.print(WARNING, resources.getText("doclet.Frames_specified", helpfile));
|
||||
frames = true;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Option(resources, "--no-frames") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
frames = false;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Hidden(resources, "-packagesheader", 1) {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
|
@ -749,6 +728,13 @@ public class HtmlConfiguration extends BaseConfiguration {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new XOption(resources, "--no-frames") {
|
||||
@Override
|
||||
public boolean process(String opt, List<String> args) {
|
||||
reporter.print(WARNING, resources.getText("doclet.NoFrames_specified"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
Set<Doclet.Option> oset = new TreeSet<>();
|
||||
|
|
|
@ -144,13 +144,6 @@ public class HtmlDoclet extends AbstractDoclet {
|
|||
DeprecatedListWriter.generate(configuration);
|
||||
}
|
||||
|
||||
AllClassesFrameWriter.generate(configuration,
|
||||
new IndexBuilder(configuration, nodeprecated, true));
|
||||
|
||||
if (configuration.frames) {
|
||||
FrameOutputWriter.generate(configuration);
|
||||
}
|
||||
|
||||
if (configuration.createoverview) {
|
||||
if (configuration.showModules) {
|
||||
ModuleIndexWriter.generate(configuration);
|
||||
|
@ -173,12 +166,10 @@ public class HtmlDoclet extends AbstractDoclet {
|
|||
}
|
||||
}
|
||||
|
||||
if (!configuration.frames) {
|
||||
if (configuration.createoverview) {
|
||||
IndexRedirectWriter.generate(configuration, DocPaths.OVERVIEW_SUMMARY, DocPaths.INDEX);
|
||||
} else {
|
||||
IndexRedirectWriter.generate(configuration);
|
||||
}
|
||||
if (configuration.createoverview) {
|
||||
IndexRedirectWriter.generate(configuration, DocPaths.OVERVIEW_SUMMARY, DocPaths.INDEX);
|
||||
} else {
|
||||
IndexRedirectWriter.generate(configuration);
|
||||
}
|
||||
|
||||
if (configuration.helpfile.isEmpty() && !configuration.nohelp) {
|
||||
|
@ -273,15 +264,8 @@ public class HtmlDoclet extends AbstractDoclet {
|
|||
@Override // defined by AbstractDoclet
|
||||
protected void generateModuleFiles() throws DocletException {
|
||||
if (configuration.showModules) {
|
||||
if (configuration.frames && configuration.modules.size() > 1) {
|
||||
ModuleIndexFrameWriter.generate(configuration);
|
||||
}
|
||||
List<ModuleElement> mdles = new ArrayList<>(configuration.modulePackages.keySet());
|
||||
for (ModuleElement mdle : mdles) {
|
||||
if (configuration.frames && configuration.modules.size() > 1) {
|
||||
ModulePackageIndexFrameWriter.generate(configuration, mdle);
|
||||
ModuleFrameWriter.generate(configuration, mdle);
|
||||
}
|
||||
AbstractBuilder moduleSummaryBuilder =
|
||||
configuration.getBuilderFactory().getModuleSummaryBuilder(mdle);
|
||||
moduleSummaryBuilder.build();
|
||||
|
@ -295,18 +279,12 @@ public class HtmlDoclet extends AbstractDoclet {
|
|||
@Override // defined by AbstractDoclet
|
||||
protected void generatePackageFiles(ClassTree classtree) throws DocletException {
|
||||
Set<PackageElement> packages = configuration.packages;
|
||||
if (packages.size() > 1 && configuration.frames) {
|
||||
PackageIndexFrameWriter.generate(configuration);
|
||||
}
|
||||
List<PackageElement> pList = new ArrayList<>(packages);
|
||||
for (PackageElement pkg : pList) {
|
||||
// if -nodeprecated option is set and the package is marked as
|
||||
// deprecated, do not generate the package-summary.html, package-frame.html
|
||||
// and package-tree.html pages for that package.
|
||||
if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
|
||||
if (configuration.frames) {
|
||||
PackageFrameWriter.generate(configuration, pkg);
|
||||
}
|
||||
AbstractBuilder packageSummaryBuilder =
|
||||
configuration.getBuilderFactory().getPackageSummaryBuilder(pkg);
|
||||
packageSummaryBuilder.build();
|
||||
|
|
|
@ -202,6 +202,7 @@ public class HtmlDocletWriter {
|
|||
this.pathToRoot = path.parent().invert();
|
||||
this.filename = path.basename();
|
||||
this.docPaths = configuration.docPaths;
|
||||
this.mainBodyScript = new Script();
|
||||
|
||||
messages.notice("doclet.Generating_0",
|
||||
DocFile.createFileForOutput(configuration, path).getPath());
|
||||
|
@ -374,47 +375,6 @@ public class HtmlDocletWriter {
|
|||
return new TagletWriterImpl(this, isFirstSentence, inSummary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Package link, with target frame.
|
||||
*
|
||||
* @param pkg The link will be to the "package-summary.html" page for this package
|
||||
* @param target name of the target frame
|
||||
* @param label tag for the link
|
||||
* @return a content for the target package link
|
||||
*/
|
||||
public Content getTargetPackageLink(PackageElement pkg, String target,
|
||||
Content label) {
|
||||
return links.createLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), label, "", target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Module Package link, with target frame.
|
||||
*
|
||||
* @param pkg the PackageElement
|
||||
* @param target name of the target frame
|
||||
* @param label tag for the link
|
||||
* @param mdle the module being documented
|
||||
* @return a content for the target module packages link
|
||||
*/
|
||||
public Content getTargetModulePackageLink(PackageElement pkg, String target,
|
||||
Content label, ModuleElement mdle) {
|
||||
return links.createLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY),
|
||||
label, "", target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Module link, with target frame.
|
||||
*
|
||||
* @param target name of the target frame
|
||||
* @param label tag for the link
|
||||
* @param mdle the module being documented
|
||||
* @return a content for the target module link
|
||||
*/
|
||||
public Content getTargetModuleLink(String target, Content label, ModuleElement mdle) {
|
||||
return links.createLink(pathToRoot.resolve(
|
||||
docPaths.moduleSummary(mdle)), label, "", target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the HTML document tree and prints it out.
|
||||
*
|
||||
|
@ -2190,24 +2150,19 @@ public class HtmlDocletWriter {
|
|||
/**
|
||||
* Returns an HtmlTree for the BODY tag.
|
||||
*
|
||||
* @param includeScript set true if printing windowtitle script
|
||||
* @param title title for the window
|
||||
* @return an HtmlTree for the BODY tag
|
||||
*/
|
||||
public HtmlTree getBody(boolean includeScript, String title) {
|
||||
public HtmlTree getBody(String title) {
|
||||
HtmlTree body = new HtmlTree(HtmlTag.BODY);
|
||||
body.put(HtmlAttr.CLASS, getBodyClass());
|
||||
|
||||
// Set window title string which is later printed
|
||||
this.winTitle = title;
|
||||
// Don't print windowtitle script for overview-frame, allclasses-frame
|
||||
// and package-frame
|
||||
if (includeScript) {
|
||||
this.mainBodyScript = getWinTitleScript();
|
||||
body.add(mainBodyScript.asContent());
|
||||
Content noScript = HtmlTree.NOSCRIPT(HtmlTree.DIV(contents.noScriptMessage));
|
||||
body.add(noScript);
|
||||
}
|
||||
body.add(mainBodyScript.asContent());
|
||||
Content noScript = HtmlTree.NOSCRIPT(HtmlTree.DIV(contents.noScriptMessage));
|
||||
body.add(noScript);
|
||||
return body;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public class IndexRedirectWriter extends HtmlDocletWriter {
|
|||
private void generateIndexFile() throws DocFileIOException {
|
||||
Content htmlComment = contents.newPage;
|
||||
Head head = new Head(path, configuration.docletVersion)
|
||||
.setTimestamp(true)
|
||||
.setTimestamp(!configuration.notimestamp)
|
||||
.setDescription("index redirect")
|
||||
.setGenerator(getGenerator(getClass()))
|
||||
.setStylesheets(configuration.getMainStylesheet(), Collections.emptyList()) // avoid reference to default stylesheet
|
||||
|
|
|
@ -1,191 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2019, 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;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.lang.model.element.ModuleElement;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.util.ElementFilter;
|
||||
|
||||
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.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
||||
/**
|
||||
* Class to generate file for each module contents in the left-hand bottom
|
||||
* frame. This will list all the Class Kinds in the module. A click on any
|
||||
* class-kind will update the right-hand frame with the clicked class-kind page.
|
||||
*
|
||||
* <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 Bhavesh Patel
|
||||
*/
|
||||
public class ModuleFrameWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* The module being documented.
|
||||
*/
|
||||
private final ModuleElement mdle;
|
||||
|
||||
/**
|
||||
* The classes to be documented. Use this to filter out classes
|
||||
* that will not be documented.
|
||||
*/
|
||||
private SortedSet<TypeElement> documentedClasses;
|
||||
|
||||
/**
|
||||
* Constructor to construct ModuleFrameWriter object and to generate
|
||||
* "module_name-type-frame.html" file. For example for module "java.base" this will generate file
|
||||
* "java.base-type-frame.html" file.
|
||||
*
|
||||
* @param configuration the configuration of the doclet.
|
||||
* @param moduleElement moduleElement under consideration.
|
||||
*/
|
||||
public ModuleFrameWriter(HtmlConfiguration configuration, ModuleElement moduleElement) {
|
||||
super(configuration, configuration.docPaths.moduleTypeFrame(moduleElement));
|
||||
this.mdle = moduleElement;
|
||||
if (configuration.getSpecifiedPackageElements().isEmpty()) {
|
||||
documentedClasses = new TreeSet<>(utils.makeGeneralPurposeComparator());
|
||||
documentedClasses.addAll(configuration.getIncludedTypeElements());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a module type summary page for the left-hand bottom frame.
|
||||
*
|
||||
* @param configuration the current configuration of the doclet.
|
||||
* @param moduleElement The package for which "module_name-type-frame.html" is to be generated.
|
||||
* @throws DocFileIOException if there is a problem generating the module summary file
|
||||
*/
|
||||
public static void generate(HtmlConfiguration configuration, ModuleElement moduleElement)
|
||||
throws DocFileIOException {
|
||||
ModuleFrameWriter mdlgen = new ModuleFrameWriter(configuration, moduleElement);
|
||||
String mdlName = moduleElement.getQualifiedName().toString();
|
||||
Content mdlLabel = new StringContent(mdlName);
|
||||
HtmlTree body = mdlgen.getBody(false, mdlgen.getWindowTitle(mdlName));
|
||||
HtmlTree htmlTree = HtmlTree.MAIN();
|
||||
DocPath moduleSummary = configuration.useModuleDirectories
|
||||
? DocPaths.DOT_DOT.resolve(configuration.docPaths.moduleSummary(moduleElement))
|
||||
: configuration.docPaths.moduleSummary(moduleElement);
|
||||
Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, HtmlStyle.bar,
|
||||
mdlgen.links.createLink(moduleSummary, mdlLabel, "", "classFrame"));
|
||||
htmlTree.add(heading);
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.setStyle(HtmlStyle.indexContainer);
|
||||
mdlgen.addClassListing(div);
|
||||
htmlTree.add(div);
|
||||
body.add(htmlTree);
|
||||
mdlgen.printHtmlDocument(
|
||||
configuration.metakeywords.getMetaKeywordsForModule(moduleElement),
|
||||
"module summary (frame)",
|
||||
body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add class listing for all the classes in this module. Divide class
|
||||
* listing as per the class kind and generate separate listing for
|
||||
* Classes, Interfaces, Exceptions and Errors.
|
||||
*
|
||||
* @param contentTree the content tree to which the listing will be added
|
||||
*/
|
||||
protected void addClassListing(HtmlTree contentTree) {
|
||||
List<PackageElement> packagesIn = ElementFilter.packagesIn(mdle.getEnclosedElements());
|
||||
SortedSet<TypeElement> interfaces = new TreeSet<>(utils.makeGeneralPurposeComparator());
|
||||
SortedSet<TypeElement> classes = new TreeSet<>(utils.makeGeneralPurposeComparator());
|
||||
SortedSet<TypeElement> enums = new TreeSet<>(utils.makeGeneralPurposeComparator());
|
||||
SortedSet<TypeElement> exceptions = new TreeSet<>(utils.makeGeneralPurposeComparator());
|
||||
SortedSet<TypeElement> errors = new TreeSet<>(utils.makeGeneralPurposeComparator());
|
||||
SortedSet<TypeElement> annotationTypes = new TreeSet<>(utils.makeGeneralPurposeComparator());
|
||||
for (PackageElement pkg : packagesIn) {
|
||||
if (utils.isIncluded(pkg)) {
|
||||
interfaces.addAll(utils.getInterfaces(pkg));
|
||||
classes.addAll(utils.getOrdinaryClasses(pkg));
|
||||
enums.addAll(utils.getEnums(pkg));
|
||||
exceptions.addAll(utils.getExceptions(pkg));
|
||||
errors.addAll(utils.getErrors(pkg));
|
||||
annotationTypes.addAll(utils.getAnnotationTypes(pkg));
|
||||
}
|
||||
}
|
||||
addClassKindListing(interfaces, contents.interfaces, contentTree);
|
||||
addClassKindListing(classes, contents.classes, contentTree);
|
||||
addClassKindListing(enums, contents.enums, contentTree);
|
||||
addClassKindListing(exceptions, contents.exceptions, contentTree);
|
||||
addClassKindListing(errors, contents.errors, contentTree);
|
||||
addClassKindListing(annotationTypes, contents.annotationTypes, contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add specific class kind listing. Also add label to the listing.
|
||||
*
|
||||
* @param list Iterable list of TypeElements
|
||||
* @param labelContent content tree of the label to be added
|
||||
* @param contentTree the content tree to which the class kind listing will be added
|
||||
*/
|
||||
protected void addClassKindListing(Iterable<TypeElement> list, Content labelContent,
|
||||
HtmlTree contentTree) {
|
||||
SortedSet<TypeElement> tset = utils.filterOutPrivateClasses(list, configuration.javafx);
|
||||
if (!tset.isEmpty()) {
|
||||
boolean printedHeader = false;
|
||||
HtmlTree htmlTree = HtmlTree.SECTION();
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(labelContent);
|
||||
for (TypeElement typeElement : tset) {
|
||||
if (documentedClasses != null && !documentedClasses.contains(typeElement)) {
|
||||
continue;
|
||||
}
|
||||
if (!utils.isCoreClass(typeElement) || !configuration.isGeneratedDoc(typeElement)) {
|
||||
continue;
|
||||
}
|
||||
if (!printedHeader) {
|
||||
Content heading = HtmlTree.HEADING(Headings.CONTENT_HEADING,
|
||||
true, labelContent);
|
||||
htmlTree.add(heading);
|
||||
printedHeader = true;
|
||||
}
|
||||
Content arr_i_name = new StringContent(utils.getSimpleName(typeElement));
|
||||
if (utils.isInterface(typeElement)) {
|
||||
arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
|
||||
}
|
||||
Content link = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.ALL_CLASSES_FRAME, typeElement).label(arr_i_name).target("classFrame"));
|
||||
Content li = HtmlTree.LI(link);
|
||||
ul.add(li);
|
||||
}
|
||||
htmlTree.add(ul);
|
||||
contentTree.add(htmlTree);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,189 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 2019, 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;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
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.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.DocLink;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
||||
/**
|
||||
* Generate the module index for the left-hand frame in the generated output.
|
||||
* A click on the module name in this frame will update the page in the top
|
||||
* left hand frame with the listing of packages of the clicked module.
|
||||
*
|
||||
* <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 Bhavesh Patel
|
||||
*/
|
||||
public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter {
|
||||
/**
|
||||
* The heading (h1 or h2) to use for the module list,
|
||||
* set by addNavigationBarHeader depending on whether or not there
|
||||
* is an additional initial heading.
|
||||
*/
|
||||
private HtmlTag moduleListHeading;
|
||||
|
||||
/**
|
||||
* Construct the ModuleIndexFrameWriter object.
|
||||
*
|
||||
* @param configuration the configuration object
|
||||
* @param filename Name of the module index file to be generated.
|
||||
*/
|
||||
public ModuleIndexFrameWriter(HtmlConfiguration configuration,
|
||||
DocPath filename) {
|
||||
super(configuration, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the module index file named "module-overview-frame.html".
|
||||
* @throws DocFileIOException
|
||||
* @param configuration the configuration object
|
||||
*/
|
||||
public static void generate(HtmlConfiguration configuration) throws DocFileIOException {
|
||||
DocPath filename = DocPaths.MODULE_OVERVIEW_FRAME;
|
||||
ModuleIndexFrameWriter modulegen = new ModuleIndexFrameWriter(configuration, filename);
|
||||
modulegen.buildModuleIndexFile("doclet.Window_Overview", "module overview (frame)", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void addModulesList(Content main) {
|
||||
Content heading = HtmlTree.HEADING(moduleListHeading, true,
|
||||
contents.modulesLabel);
|
||||
HtmlTree htmlTree = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(contents.modulesLabel);
|
||||
for (ModuleElement mdle: configuration.modules) {
|
||||
ul.add(getModuleLink(mdle));
|
||||
}
|
||||
htmlTree.add(ul);
|
||||
main.add(htmlTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns each module name as a separate link.
|
||||
*
|
||||
* @param mdle the module being documented
|
||||
* @return content for the module link
|
||||
*/
|
||||
protected Content getModuleLink(ModuleElement mdle) {
|
||||
Content moduleLinkContent;
|
||||
Content mdlLabel = new StringContent(mdle.getQualifiedName());
|
||||
moduleLinkContent = getModuleFramesHyperLink(mdle, mdlLabel, "packageListFrame");
|
||||
Content li = HtmlTree.LI(moduleLinkContent);
|
||||
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.put(HtmlAttr.TARGET, target);
|
||||
anchor.put(HtmlAttr.ONCLICK, onclickStr);
|
||||
return anchor;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavigationBarHeader(Content header) {
|
||||
String headerContent = !configuration.packagesheader.isEmpty() ? configuration.packagesheader
|
||||
: configuration.header;
|
||||
if (!headerContent.isEmpty()) {
|
||||
Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true,
|
||||
HtmlStyle.bar, new RawHtml(replaceDocRootDir(headerContent)));
|
||||
header.add(heading);
|
||||
moduleListHeading = Headings.IndexFrames.MODULE_HEADING;
|
||||
} else {
|
||||
moduleListHeading = Headings.PAGE_TITLE_HEADING;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Do nothing as there is no overview information in this page.
|
||||
*/
|
||||
protected void addOverviewHeader(Content body) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "All Classes" link for the top of the left-hand frame page to the
|
||||
* documentation tree.
|
||||
*
|
||||
* @param ul the Content object to which the all classes link should be added
|
||||
*/
|
||||
protected void addAllClassesLink(Content ul) {
|
||||
Content linkContent = links.createLink(DocPaths.ALLCLASSES_FRAME,
|
||||
contents.allClassesLabel, "", "packageFrame");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
ul.add(li);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "All Packages" link for the top of the left-hand frame page to the
|
||||
* documentation tree.
|
||||
*
|
||||
* @param ul the Content object to which the all packages link should be added
|
||||
*/
|
||||
protected void addAllPackagesLink(Content ul) {
|
||||
Content linkContent = links.createLink(DocPaths.OVERVIEW_FRAME,
|
||||
contents.allPackagesLabel, "", "packageListFrame");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
ul.add(li);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavigationBarFooter(Content footer) {
|
||||
Content p = HtmlTree.P(Contents.SPACE);
|
||||
footer.add(p);
|
||||
}
|
||||
|
||||
protected void addModulePackagesList(Map<ModuleElement, Set<PackageElement>> modules, String text,
|
||||
String tableSummary, Content main, ModuleElement mdle) {
|
||||
}
|
||||
}
|
|
@ -44,8 +44,7 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
|||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
||||
/**
|
||||
* Generate the module index page "overview-summary.html" for the right-hand
|
||||
* frame.
|
||||
* Generate the module index page "index.html".
|
||||
*
|
||||
* <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.
|
||||
|
@ -66,15 +65,15 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Generate the module index page for the right-hand frame.
|
||||
* Generate the module index page.
|
||||
*
|
||||
* @param configuration the current configuration of the doclet.
|
||||
* @throws DocFileIOException if there is a problem generating the module index page
|
||||
*/
|
||||
public static void generate(HtmlConfiguration configuration) throws DocFileIOException {
|
||||
DocPath filename = DocPaths.overviewSummary(configuration.frames);
|
||||
DocPath filename = DocPaths.INDEX;
|
||||
ModuleIndexWriter mdlgen = new ModuleIndexWriter(configuration, filename);
|
||||
mdlgen.buildModuleIndexFile("doclet.Window_Overview_Summary", "module index", true);
|
||||
mdlgen.buildModuleIndexFile("doclet.Window_Overview_Summary", "module index");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -95,15 +94,6 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter {
|
|||
* @param main the document tree to which the modules list will be added
|
||||
*/
|
||||
protected void addIndexContents(Content header, Content main) {
|
||||
HtmlTree htmltree = HtmlTree.NAV();
|
||||
htmltree.setStyle(HtmlStyle.indexNav);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
addAllClassesLink(ul);
|
||||
if (configuration.showModules) {
|
||||
addAllModulesLink(ul);
|
||||
}
|
||||
htmltree.add(ul);
|
||||
header.add(htmltree);
|
||||
addModulesList(main);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,245 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 2019, 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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.lang.model.element.ModuleElement;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
|
||||
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;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
||||
/**
|
||||
* Generate the module package index for the left-hand frame in the generated output.
|
||||
* A click on the package name in this frame will update the page in the bottom
|
||||
* left hand frame with the listing of contents of the clicked module package.
|
||||
*
|
||||
* <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 Bhavesh Patel
|
||||
*/
|
||||
public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
|
||||
/**
|
||||
* The heading (h1 or h2) to use for the module packages list,
|
||||
* set by addNavigationBarHeader depending on whether or not there
|
||||
* is an additional initial heading.
|
||||
*/
|
||||
private HtmlTag modulePackagesListHeading;
|
||||
|
||||
/**
|
||||
* Construct the ModulePackageIndexFrameWriter object.
|
||||
*
|
||||
* @param configuration the configuration object
|
||||
* @param filename Name of the package index file to be generated.
|
||||
*/
|
||||
public ModulePackageIndexFrameWriter(HtmlConfiguration configuration, DocPath filename) {
|
||||
super(configuration, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the module package index file.
|
||||
* @throws DocFileIOException
|
||||
* @param configuration the configuration object
|
||||
* @param mdle the module being documented
|
||||
*/
|
||||
public static void generate(HtmlConfiguration configuration, ModuleElement mdle) throws DocFileIOException {
|
||||
DocPath filename = configuration.docPaths.moduleFrame(mdle);
|
||||
ModulePackageIndexFrameWriter modpackgen = new ModulePackageIndexFrameWriter(configuration, filename);
|
||||
modpackgen.buildModulePackagesIndexFile("doclet.Window_Overview",
|
||||
getDescription("module package index", mdle) + " (frame)",
|
||||
false,
|
||||
mdle);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addModulePackagesList(Map<ModuleElement, Set<PackageElement>> modules, String text,
|
||||
String tableSummary, Content main, ModuleElement mdle) {
|
||||
Content profNameContent = new StringContent(mdle.getQualifiedName().toString());
|
||||
Content heading = HtmlTree.HEADING(modulePackagesListHeading, true,
|
||||
getTargetModuleLink("classFrame", profNameContent, mdle));
|
||||
heading.add(Contents.SPACE);
|
||||
heading.add(contents.packagesLabel);
|
||||
HtmlTree htmlTree = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(contents.packagesLabel);
|
||||
List<PackageElement> packages = new ArrayList<>(modules.get(mdle));
|
||||
for (PackageElement pkg : packages) {
|
||||
if ((!(configuration.nodeprecated && utils.isDeprecated(pkg)))) {
|
||||
ul.add(getPackage(pkg, mdle));
|
||||
}
|
||||
}
|
||||
htmlTree.add(ul);
|
||||
main.add(htmlTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addModulePackagesList(Set<ModuleElement> modules, String text,
|
||||
String tableSummary, Content body, ModuleElement mdle) {
|
||||
Content moduleNameContent = new StringContent(mdle.getQualifiedName().toString());
|
||||
Content heading = HtmlTree.HEADING(modulePackagesListHeading, true,
|
||||
getTargetModuleLink("classFrame", moduleNameContent, mdle));
|
||||
heading.add(Contents.SPACE);
|
||||
heading.add(contents.packagesLabel);
|
||||
HtmlTree htmlTree = HtmlTree.MAIN(HtmlStyle.indexContainer, heading);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(contents.packagesLabel);
|
||||
Set<PackageElement> modulePackages = configuration.modulePackages.get(mdle);
|
||||
for (PackageElement pkg: modulePackages) {
|
||||
if ((!(configuration.nodeprecated && utils.isDeprecated(pkg)))) {
|
||||
ul.add(getPackage(pkg, mdle));
|
||||
}
|
||||
}
|
||||
htmlTree.add(ul);
|
||||
body.add(htmlTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns each package name as a separate link.
|
||||
*
|
||||
* @param pkg PackageElement
|
||||
* @param mdle the module being documented
|
||||
* @return content for the package link
|
||||
*/
|
||||
protected Content getPackage(PackageElement pkg, ModuleElement mdle) {
|
||||
Content packageLinkContent;
|
||||
Content pkgLabel;
|
||||
if (!pkg.isUnnamed()) {
|
||||
pkgLabel = getPackageLabel(utils.getPackageName(pkg));
|
||||
packageLinkContent = links.createLink(pathString(pkg,
|
||||
DocPaths.PACKAGE_FRAME), pkgLabel, "",
|
||||
"packageFrame");
|
||||
} else {
|
||||
pkgLabel = new StringContent("<unnamed package>");
|
||||
packageLinkContent = links.createLink(DocPaths.PACKAGE_FRAME,
|
||||
pkgLabel, "", "packageFrame");
|
||||
}
|
||||
Content li = HtmlTree.LI(packageLinkContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavigationBarHeader(Content header) {
|
||||
String headerContent = !configuration.packagesheader.isEmpty() ? configuration.packagesheader
|
||||
: configuration.header;
|
||||
if (!headerContent.isEmpty()) {
|
||||
Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true,
|
||||
HtmlStyle.bar, new RawHtml(replaceDocRootDir(headerContent)));
|
||||
header.add(heading);
|
||||
modulePackagesListHeading = Headings.IndexFrames.PACKAGE_HEADING;
|
||||
} else {
|
||||
modulePackagesListHeading = Headings.PAGE_TITLE_HEADING;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Do nothing as there is no overview information in this page.
|
||||
*/
|
||||
protected void addOverviewHeader(Content body) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Do nothing as there is no modules list on this page.
|
||||
*/
|
||||
@Override
|
||||
protected void addModulesList(Content body) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "All Classes" link for the top of the left-hand frame page to the
|
||||
* documentation tree.
|
||||
*
|
||||
* @param ul the Content object to which the all classes link should be added
|
||||
*/
|
||||
protected void addAllClassesLink(Content ul) {
|
||||
DocPath allClassesFrame = configuration.useModuleDirectories
|
||||
? DocPaths.DOT_DOT.resolve(DocPaths.ALLCLASSES_FRAME)
|
||||
: DocPaths.ALLCLASSES_FRAME;
|
||||
Content linkContent = links.createLink(allClassesFrame,
|
||||
contents.allClassesLabel, "", "packageFrame");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
ul.add(li);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "All Packages" link for the top of the left-hand frame page to the
|
||||
* documentation tree.
|
||||
*
|
||||
* @param ul the Content object to which the all packages link should be added
|
||||
*/
|
||||
protected void addAllPackagesLink(Content ul) {
|
||||
DocPath overviewFrame = configuration.useModuleDirectories
|
||||
? DocPaths.DOT_DOT.resolve(DocPaths.OVERVIEW_FRAME)
|
||||
: DocPaths.OVERVIEW_FRAME;
|
||||
Content linkContent = links.createLink(overviewFrame,
|
||||
contents.allPackagesLabel, "", "packageListFrame");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
ul.add(li);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "All Modules" link for the top of the left-hand frame page to the
|
||||
* documentation tree.
|
||||
*
|
||||
* @param ul the Content object to which the all modules link should be added
|
||||
*/
|
||||
protected void addAllModulesLink(Content ul) {
|
||||
DocPath moduleOverviewFrame = configuration.useModuleDirectories
|
||||
? DocPaths.DOT_DOT.resolve(DocPaths.MODULE_OVERVIEW_FRAME)
|
||||
: DocPaths.MODULE_OVERVIEW_FRAME;
|
||||
Content linkContent = links.createLink(moduleOverviewFrame,
|
||||
contents.allModulesLabel, "", "packageListFrame");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
ul.add(li);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavigationBarFooter(Content footer) {
|
||||
Content p = HtmlTree.P(Contents.SPACE);
|
||||
footer.add(p);
|
||||
}
|
||||
}
|
|
@ -194,7 +194,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
|||
*/
|
||||
@Override
|
||||
public Content getModuleHeader(String heading) {
|
||||
HtmlTree bodyTree = getBody(true, getWindowTitle(mdle.getQualifiedName().toString()));
|
||||
HtmlTree bodyTree = getBody(getWindowTitle(mdle.getQualifiedName().toString()));
|
||||
HtmlTree htmlTree = HtmlTree.HEADER();
|
||||
addTop(htmlTree);
|
||||
navBar.setDisplaySummaryModuleDescLink(!utils.getFullBody(mdle).isEmpty() && !configuration.nocomment);
|
||||
|
|
|
@ -1,196 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2019, 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;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
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.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
||||
/**
|
||||
* Class to generate file for each package contents in the left-hand bottom
|
||||
* frame. This will list all the Class Kinds in the package. A click on any
|
||||
* class-kind will update the right-hand frame with the clicked class-kind page.
|
||||
*
|
||||
* <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 Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class PackageFrameWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* The package being documented.
|
||||
*/
|
||||
private final PackageElement packageElement;
|
||||
|
||||
/**
|
||||
* The classes to be documented. Use this to filter out classes
|
||||
* that will not be documented.
|
||||
*/
|
||||
private SortedSet<TypeElement> documentedClasses;
|
||||
|
||||
/**
|
||||
* Constructor to construct PackageFrameWriter object and to generate
|
||||
* "package-frame.html" file in the respective package directory.
|
||||
* For example for package "java.lang" this will generate file
|
||||
* "package-frame.html" file in the "java/lang" directory. It will also
|
||||
* create "java/lang" directory in the current or the destination directory
|
||||
* if it doesn't exist.
|
||||
*
|
||||
* @param configuration the configuration of the doclet.
|
||||
* @param packageElement PackageElement under consideration.
|
||||
*/
|
||||
public PackageFrameWriter(HtmlConfiguration configuration, PackageElement packageElement) {
|
||||
super(configuration,
|
||||
configuration.docPaths.forPackage(packageElement).resolve(DocPaths.PACKAGE_FRAME));
|
||||
this.packageElement = packageElement;
|
||||
if (configuration.getSpecifiedPackageElements().isEmpty()) {
|
||||
documentedClasses = new TreeSet<>(utils.makeGeneralPurposeComparator());
|
||||
documentedClasses.addAll(configuration.getIncludedTypeElements());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a package summary page for the left-hand bottom frame. Construct
|
||||
* the PackageFrameWriter object and then use it generate the file.
|
||||
*
|
||||
* @param configuration the current configuration of the doclet.
|
||||
* @param packageElement The package for which "pacakge-frame.html" is to be generated.
|
||||
* @throws DocFileIOException if there is a problem generating the package summary page
|
||||
*/
|
||||
public static void generate(HtmlConfiguration configuration, PackageElement packageElement)
|
||||
throws DocFileIOException {
|
||||
PackageFrameWriter packgen = new PackageFrameWriter(configuration, packageElement);
|
||||
String pkgName = configuration.utils.getPackageName(packageElement);
|
||||
HtmlTree body = packgen.getBody(false, packgen.getWindowTitle(pkgName));
|
||||
Content pkgNameContent = new StringContent(pkgName);
|
||||
HtmlTree htmlTree = HtmlTree.MAIN();
|
||||
Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, HtmlStyle.bar,
|
||||
packgen.getTargetPackageLink(packageElement, "classFrame", pkgNameContent));
|
||||
htmlTree.add(heading);
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.setStyle(HtmlStyle.indexContainer);
|
||||
packgen.addClassListing(div);
|
||||
htmlTree.add(div);
|
||||
body.add(htmlTree);
|
||||
packgen.printHtmlDocument(
|
||||
configuration.metakeywords.getMetaKeywords(packageElement),
|
||||
getDescription("package summary (frame)", packageElement),
|
||||
body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add class listing for all the classes in this package. Divide class
|
||||
* listing as per the class kind and generate separate listing for
|
||||
* Classes, Interfaces, Exceptions and Errors.
|
||||
*
|
||||
* @param contentTree the content tree to which the listing will be added
|
||||
*/
|
||||
protected void addClassListing(HtmlTree contentTree) {
|
||||
BaseConfiguration config = configuration;
|
||||
if (utils.isSpecified(packageElement)) {
|
||||
addClassKindListing(utils.getInterfaces(packageElement),
|
||||
contents.interfaces, contentTree);
|
||||
addClassKindListing(utils.getOrdinaryClasses(packageElement),
|
||||
contents.classes, contentTree);
|
||||
addClassKindListing(utils.getEnums(packageElement),
|
||||
contents.enums, contentTree);
|
||||
addClassKindListing(utils.getExceptions(packageElement),
|
||||
contents.exceptions, contentTree);
|
||||
addClassKindListing(utils.getErrors(packageElement),
|
||||
contents.errors, contentTree);
|
||||
addClassKindListing(utils.getAnnotationTypes(packageElement),
|
||||
contents.annotationTypes, contentTree);
|
||||
} else {
|
||||
addClassKindListing(config.typeElementCatalog.interfaces(packageElement),
|
||||
contents.interfaces, contentTree);
|
||||
addClassKindListing(config.typeElementCatalog.ordinaryClasses(packageElement),
|
||||
contents.classes, contentTree);
|
||||
addClassKindListing(config.typeElementCatalog.enums(packageElement),
|
||||
contents.enums, contentTree);
|
||||
addClassKindListing(config.typeElementCatalog.exceptions(packageElement),
|
||||
contents.exceptions, contentTree);
|
||||
addClassKindListing(config.typeElementCatalog.errors(packageElement),
|
||||
contents.errors, contentTree);
|
||||
addClassKindListing(config.typeElementCatalog.annotationTypes(packageElement),
|
||||
contents.annotationTypes, contentTree);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add specific class kind listing. Also add label to the listing.
|
||||
*
|
||||
* @param list list of specific class kinds, namely Class or Interface or Exception or Error
|
||||
* @param labelContent content tree of the label to be added
|
||||
* @param contentTree the content tree to which the class kind listing will be added
|
||||
*/
|
||||
protected void addClassKindListing(Iterable<TypeElement> list, Content labelContent,
|
||||
HtmlTree contentTree) {
|
||||
SortedSet<TypeElement> tset = utils.filterOutPrivateClasses(list, configuration.javafx);
|
||||
if(!tset.isEmpty()) {
|
||||
boolean printedHeader = false;
|
||||
HtmlTree htmlTree = HtmlTree.SECTION();
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(labelContent);
|
||||
for (TypeElement typeElement : tset) {
|
||||
if (documentedClasses != null && !documentedClasses.contains(typeElement)) {
|
||||
continue;
|
||||
}
|
||||
if (!utils.isCoreClass(typeElement) || !configuration.isGeneratedDoc(typeElement)) {
|
||||
continue;
|
||||
}
|
||||
if (!printedHeader) {
|
||||
Content heading = HtmlTree.HEADING(Headings.CONTENT_HEADING,
|
||||
true, labelContent);
|
||||
htmlTree.add(heading);
|
||||
printedHeader = true;
|
||||
}
|
||||
Content arr_i_name = new StringContent(utils.getSimpleName(typeElement));
|
||||
if (utils.isInterface(typeElement))
|
||||
arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
|
||||
Content link = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.PACKAGE_FRAME, typeElement).label(arr_i_name).target("classFrame"));
|
||||
Content li = HtmlTree.LI(link);
|
||||
ul.add(li);
|
||||
}
|
||||
htmlTree.add(ul);
|
||||
contentTree.add(htmlTree);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,191 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2019, 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;
|
||||
|
||||
import javax.lang.model.element.PackageElement;
|
||||
|
||||
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;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
||||
|
||||
/**
|
||||
* Generate the package index for the left-hand frame in the generated output.
|
||||
* A click on the package name in this frame will update the page in the bottom
|
||||
* left hand frame with the listing of contents of the clicked package.
|
||||
*
|
||||
* <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
|
||||
*/
|
||||
public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
|
||||
/**
|
||||
* The heading (h1 or h2) to use for the module list,
|
||||
* set by addNavigationBarHeader depending on whether or not there
|
||||
* is an additional initial heading.
|
||||
*/
|
||||
private HtmlTag packageListHeading;
|
||||
|
||||
/**
|
||||
* Construct the PackageIndexFrameWriter object.
|
||||
*
|
||||
* @param filename Name of the package index file to be generated.
|
||||
*/
|
||||
public PackageIndexFrameWriter(HtmlConfiguration configuration, DocPath filename) {
|
||||
super(configuration, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the package index file named "overview-frame.html".
|
||||
* @throws DocFileIOException
|
||||
*/
|
||||
public static void generate(HtmlConfiguration configuration) throws DocFileIOException {
|
||||
DocPath filename = DocPaths.OVERVIEW_FRAME;
|
||||
PackageIndexFrameWriter packgen = new PackageIndexFrameWriter(configuration, filename);
|
||||
packgen.buildPackageIndexFile("doclet.Window_Overview",
|
||||
"package index (frame)",
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void addPackagesList(Content main) {
|
||||
Content heading = HtmlTree.HEADING(packageListHeading, true,
|
||||
contents.packagesLabel);
|
||||
HtmlTree htmlTree = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(contents.packagesLabel);
|
||||
for (PackageElement aPackage : packages) {
|
||||
// Do not list the package if -nodeprecated option is set and the
|
||||
// package is marked as deprecated.
|
||||
if (aPackage != null &&
|
||||
(!(configuration.nodeprecated && utils.isDeprecated(aPackage)))) {
|
||||
ul.add(getPackage(aPackage));
|
||||
}
|
||||
}
|
||||
htmlTree.add(ul);
|
||||
main.add(htmlTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns each package name as a separate link.
|
||||
*
|
||||
* @param pe PackageElement
|
||||
* @return content for the package link
|
||||
*/
|
||||
protected Content getPackage(PackageElement pe) {
|
||||
Content packageLinkContent;
|
||||
Content packageLabel;
|
||||
if (pe.isUnnamed()) {
|
||||
packageLabel = new StringContent("<unnamed package>");
|
||||
packageLinkContent = links.createLink(DocPaths.PACKAGE_FRAME,
|
||||
packageLabel, "", "packageFrame");
|
||||
} else {
|
||||
packageLabel = getPackageLabel(pe.getQualifiedName());
|
||||
packageLinkContent = links.createLink(pathString(pe,
|
||||
DocPaths.PACKAGE_FRAME), packageLabel, "",
|
||||
"packageFrame");
|
||||
}
|
||||
Content li = HtmlTree.LI(packageLinkContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void addNavigationBarHeader(Content header) {
|
||||
Content headerContent;
|
||||
if (configuration.packagesheader.length() > 0) {
|
||||
headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
|
||||
} else {
|
||||
headerContent = new RawHtml(replaceDocRootDir(configuration.header));
|
||||
}
|
||||
if (!headerContent.isEmpty()) {
|
||||
Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true,
|
||||
HtmlStyle.bar, headerContent);
|
||||
header.add(heading);
|
||||
packageListHeading = Headings.IndexFrames.PACKAGE_HEADING;
|
||||
} else {
|
||||
packageListHeading = Headings.PAGE_TITLE_HEADING;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Do nothing as there is no overview information in this page.
|
||||
*/
|
||||
@Override
|
||||
protected void addOverviewHeader(Content body) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "All Classes" link for the top of the left-hand frame page to the
|
||||
* documentation tree.
|
||||
*
|
||||
* @param ul the Content object to which the "All Classes" link should be added
|
||||
*/
|
||||
@Override
|
||||
protected void addAllClassesLink(Content ul) {
|
||||
Content linkContent = links.createLink(DocPaths.ALLCLASSES_FRAME,
|
||||
contents.allClassesLabel, "", "packageFrame");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
ul.add(li);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "All Modules" link for the top of the left-hand frame page to the
|
||||
* documentation tree.
|
||||
*
|
||||
* @param ul the Content object to which the "All Modules" link should be added
|
||||
*/
|
||||
@Override
|
||||
protected void addAllModulesLink(Content ul) {
|
||||
Content linkContent = links.createLink(DocPaths.MODULE_OVERVIEW_FRAME,
|
||||
contents.allModulesLabel, "", "packageListFrame");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
ul.add(li);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void addNavigationBarFooter(Content footer) {
|
||||
Content p = HtmlTree.P(Contents.SPACE);
|
||||
footer.add(p);
|
||||
}
|
||||
}
|
|
@ -42,9 +42,7 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
|||
import jdk.javadoc.internal.doclets.toolkit.util.Group;
|
||||
|
||||
/**
|
||||
* Generate the package index page "overview-summary.html" for the right-hand
|
||||
* frame. A click on the package name on this page will update the same frame
|
||||
* with the "package-summary.html" file for the clicked package.
|
||||
* Generate the package index page "index.html".
|
||||
*
|
||||
* <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.
|
||||
|
@ -70,15 +68,15 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Generate the package index page for the right-hand frame.
|
||||
* Generate the package index page.
|
||||
*
|
||||
* @param configuration the current configuration of the doclet.
|
||||
* @throws DocFileIOException if there is a problem generating the package index page
|
||||
*/
|
||||
public static void generate(HtmlConfiguration configuration) throws DocFileIOException {
|
||||
DocPath filename = DocPaths.overviewSummary(configuration.frames);
|
||||
DocPath filename = DocPaths.INDEX;
|
||||
PackageIndexWriter packgen = new PackageIndexWriter(configuration, filename);
|
||||
packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", "package index", true);
|
||||
packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", "package index");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -131,7 +131,7 @@ public class PackageTreeWriter extends AbstractTreeWriter {
|
|||
protected HtmlTree getPackageTreeHeader() {
|
||||
String packageName = packageElement.isUnnamed() ? "" : utils.getPackageName(packageElement);
|
||||
String title = packageName + " " + resources.getText("doclet.Window_Class_Hierarchy");
|
||||
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
|
||||
HtmlTree bodyTree = getBody(getWindowTitle(title));
|
||||
HtmlTree htmlTree = HtmlTree.HEADER();
|
||||
addTop(htmlTree);
|
||||
Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement),
|
||||
|
|
|
@ -237,7 +237,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
|
|||
String packageText = resources.getText("doclet.Package");
|
||||
String name = packageElement.isUnnamed() ? "" : utils.getPackageName(packageElement);
|
||||
String title = resources.getText("doclet.Window_ClassUse_Header", packageText, name);
|
||||
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
|
||||
HtmlTree bodyTree = getBody(getWindowTitle(title));
|
||||
HtmlTree htmlTree = HtmlTree.HEADER();
|
||||
addTop(htmlTree);
|
||||
Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement),
|
||||
|
|
|
@ -105,7 +105,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
|||
*/
|
||||
@Override
|
||||
public Content getPackageHeader(String heading) {
|
||||
HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getPackageName(packageElement)));
|
||||
HtmlTree bodyTree = getBody(getWindowTitle(utils.getPackageName(packageElement)));
|
||||
HtmlTree htmlTree = HtmlTree.HEADER();
|
||||
addTop(htmlTree);
|
||||
Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement),
|
||||
|
|
|
@ -78,7 +78,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
|
|||
* @return the body content tree
|
||||
*/
|
||||
public Content getHeader(String header) {
|
||||
HtmlTree bodyTree = getBody(true, getWindowTitle(header));
|
||||
HtmlTree bodyTree = getBody(getWindowTitle(header));
|
||||
HtmlTree htmlTree = HtmlTree.HEADER();
|
||||
addTop(htmlTree);
|
||||
navBar.setUserHeader(getUserHeaderFooter(true));
|
||||
|
|
|
@ -92,7 +92,7 @@ public class SingleIndexWriter extends AbstractIndexWriter {
|
|||
*/
|
||||
protected void generateIndexFile() throws DocFileIOException {
|
||||
String title = resources.getText("doclet.Window_Single_Index");
|
||||
HtmlTree body = getBody(true, getWindowTitle(title));
|
||||
HtmlTree body = getBody(getWindowTitle(title));
|
||||
HtmlTree header = HtmlTree.HEADER();
|
||||
addTop(header);
|
||||
navBar.setUserHeader(getUserHeaderFooter(true));
|
||||
|
|
|
@ -120,7 +120,7 @@ public class SplitIndexWriter extends AbstractIndexWriter {
|
|||
protected void generateIndexFile(Character unicode) throws DocFileIOException {
|
||||
String title = resources.getText("doclet.Window_Split_Index",
|
||||
unicode.toString());
|
||||
HtmlTree body = getBody(true, getWindowTitle(title));
|
||||
HtmlTree body = getBody(getWindowTitle(title));
|
||||
HtmlTree header = HtmlTree.HEADER();
|
||||
addTop(header);
|
||||
navBar.setUserHeader(getUserHeaderFooter(true));
|
||||
|
|
|
@ -175,7 +175,7 @@ public class TreeWriter extends AbstractTreeWriter {
|
|||
*/
|
||||
protected HtmlTree getTreeHeader() {
|
||||
String title = resources.getText("doclet.Window_Class_Hierarchy");
|
||||
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
|
||||
HtmlTree bodyTree = getBody(getWindowTitle(title));
|
||||
HtmlTree htmlTree = HtmlTree.HEADER();
|
||||
addTop(htmlTree);
|
||||
navBar.setUserHeader(getUserHeaderFooter(true));
|
||||
|
|
|
@ -824,7 +824,7 @@ public class Navigation {
|
|||
|
||||
private void addOverviewLink(Content tree) {
|
||||
if (configuration.createoverview) {
|
||||
tree.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.overviewSummary(configuration.frames)),
|
||||
tree.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.INDEX),
|
||||
contents.overviewLabel, "", "")));
|
||||
}
|
||||
}
|
||||
|
@ -930,27 +930,6 @@ public class Navigation {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add "FRAMES" link, to switch to the frame version of the output.
|
||||
*
|
||||
* @param tree the content tree to which the link will be added
|
||||
*/
|
||||
private void addNavShowLists(Content tree) {
|
||||
DocLink dl = new DocLink(pathToRoot.resolve(DocPaths.INDEX), path.getPath(), null);
|
||||
Content framesContent = links.createLink(dl, contents.framesLabel, "", "_top");
|
||||
tree.add(HtmlTree.LI(framesContent));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add "NO FRAMES" link, to switch to the non-frame version of the output.
|
||||
*
|
||||
* @param tree the content tree to which the link will be added
|
||||
*/
|
||||
private void addNavHideLists(Content tree) {
|
||||
Content noFramesContent = links.createLink(path.basename(), contents.noFramesLabel, "", "_top");
|
||||
tree.add(HtmlTree.LI(noFramesContent));
|
||||
}
|
||||
|
||||
private void addSearch(Content tree) {
|
||||
String searchValueId = "search";
|
||||
String reset = "reset";
|
||||
|
@ -1018,15 +997,6 @@ public class Navigation {
|
|||
ulNavDetail.setStyle(HtmlStyle.subNavList);
|
||||
addDetailLinks(ulNavDetail);
|
||||
div.add(ulNavDetail);
|
||||
HtmlTree ulFrames = new HtmlTree(HtmlTag.UL);
|
||||
ulFrames.setStyle(HtmlStyle.navList);
|
||||
if (!configuration.nonavbar) {
|
||||
if (configuration.frames) {
|
||||
addNavShowLists(ulFrames);
|
||||
addNavHideLists(ulFrames);
|
||||
}
|
||||
}
|
||||
div.add(ulFrames);
|
||||
subDiv.add(div);
|
||||
if (top && configuration.createindex) {
|
||||
addSearch(subDiv);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
doclet.build_version=Standard Doclet version {0}
|
||||
doclet.Contents=Contents
|
||||
doclet.Overview=Overview
|
||||
doclet.Window_Overview=Overview List
|
||||
doclet.Window_Overview_Summary=Overview
|
||||
doclet.Element=Element
|
||||
doclet.Package=Package
|
||||
|
@ -167,10 +166,6 @@ doclet.help.index.head=\
|
|||
doclet.help.index.body=\
|
||||
The {0} contains an alphabetic index of all classes, interfaces, constructors, methods, \
|
||||
and fields, as well as lists of all packages and all classes.
|
||||
doclet.help.frames.head=\
|
||||
Frames/No Frames
|
||||
doclet.help.frames.body=\
|
||||
These links show and hide the HTML frames. All pages are available with or without frames.
|
||||
doclet.help.serial_form.body=\
|
||||
Each serializable or externalizable class has a description of its serialization fields and \
|
||||
methods. This information is of interest to re-implementors, not to developers using the API. \
|
||||
|
@ -446,9 +441,7 @@ doclet.usage.xdoclint-package.description=\
|
|||
of the given package. Prefix the package specifier with - to\n\
|
||||
disable checks for the specified packages.
|
||||
|
||||
# L10N: do not localize the option names --frames
|
||||
doclet.Frames_specified=\
|
||||
You have specified to generate frames, by using the --frames option.\n\
|
||||
The default is currently to not generate frames and the support for \n\
|
||||
frames will be removed in a future release.\n\
|
||||
To suppress this warning, remove the --frames option and avoid the use of frames.
|
||||
# L10N: do not localize the option names --no-frames
|
||||
doclet.NoFrames_specified=\
|
||||
The --no-frames option is no longer required and may be removed\n\
|
||||
in a future release.
|
||||
|
|
|
@ -124,8 +124,6 @@ doclet.modules=modules
|
|||
doclet.All_Classes=All Classes
|
||||
doclet.All_Superinterfaces=All Superinterfaces:
|
||||
doclet.All_Implemented_Interfaces=All Implemented Interfaces:
|
||||
doclet.All_classes_and_interfaces=All classes and interfaces (except non-static nested types)
|
||||
doclet.Package_class_and_interface_descriptions=Package, class and interface descriptions
|
||||
doclet.Interface=Interface
|
||||
doclet.Class=Class
|
||||
doclet.AnnotationType=Annotation Type
|
||||
|
|
|
@ -150,10 +150,6 @@ function updateTabs(type) {
|
|||
}
|
||||
}
|
||||
|
||||
function updateModuleFrame(pFrame, cFrame) {
|
||||
top.packageFrame.location = pFrame;
|
||||
top.classFrame.location = cFrame;
|
||||
}
|
||||
function switchTab(e) {
|
||||
if (e.keyCode == 37 || e.keyCode == 38) {
|
||||
$("[aria-selected=true]").prev().click().focus();
|
||||
|
|
|
@ -51,25 +51,12 @@ public class DocPaths {
|
|||
|
||||
public static final DocPath DOT_DOT = DocPath.create("..");
|
||||
|
||||
/** The name of the file for all classes, without using frames, when --no-frames is specified. */
|
||||
public static final DocPath ALLCLASSES = DocPath.create("allclasses.html");
|
||||
|
||||
/** The name of the file for all classes, using frames. */
|
||||
public static final DocPath ALLCLASSES_FRAME = DocPath.create("allclasses-frame.html");
|
||||
|
||||
/** The name of the file for all classes index. */
|
||||
public static final DocPath ALLCLASSES_INDEX = DocPath.create("allclasses-index.html");
|
||||
|
||||
/** The name of the file for all packages index. */
|
||||
public static final DocPath ALLPACKAGES_INDEX = DocPath.create("allpackages-index.html");
|
||||
|
||||
/** The name of the file for all classes, without using frames. */
|
||||
public static final DocPath ALLCLASSES_NOFRAME = DocPath.create("allclasses-noframe.html");
|
||||
|
||||
public static DocPath AllClasses(boolean frames) {
|
||||
return frames ? ALLCLASSES_NOFRAME : ALLCLASSES;
|
||||
}
|
||||
|
||||
/** The name of the sub-directory for storing class usage info. */
|
||||
public static final DocPath CLASS_USE = DocPath.create("class-use");
|
||||
|
||||
|
@ -163,22 +150,12 @@ public class DocPaths {
|
|||
/** The name of the module search index js file. */
|
||||
public static final DocPath MODULE_SEARCH_INDEX_JS = DocPath.create("module-search-index.js");
|
||||
|
||||
/** The name of the file for the overview frame. */
|
||||
public static final DocPath OVERVIEW_FRAME = DocPath.create("overview-frame.html");
|
||||
|
||||
/** The name of the file for the overview summary. */
|
||||
public static final DocPath OVERVIEW_SUMMARY = DocPath.create("overview-summary.html");
|
||||
|
||||
public static DocPath overviewSummary(boolean frames) {
|
||||
return frames ? OVERVIEW_SUMMARY : INDEX;
|
||||
}
|
||||
|
||||
/** The name of the file for the overview tree. */
|
||||
public static final DocPath OVERVIEW_TREE = DocPath.create("overview-tree.html");
|
||||
|
||||
/** The name of the file for the package frame. */
|
||||
public static final DocPath PACKAGE_FRAME = DocPath.create("package-frame.html");
|
||||
|
||||
/** The name of the file for the package list. This is to support the legacy mode. */
|
||||
public static final DocPath PACKAGE_LIST = DocPath.create("package-list");
|
||||
|
||||
|
@ -305,15 +282,6 @@ public class DocPaths {
|
|||
return createModulePath(mdle, "doc-files");
|
||||
}
|
||||
|
||||
/**
|
||||
* The path for the file for a module's frame page.
|
||||
* @param mdle the module
|
||||
* @return the path
|
||||
*/
|
||||
public DocPath moduleFrame(ModuleElement mdle) {
|
||||
return createModulePath(mdle, "frame.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* The path for the file for a module's summary page.
|
||||
* @param mdle the module
|
||||
|
@ -332,15 +300,6 @@ public class DocPaths {
|
|||
return createModulePath(mdleName, "summary.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* The path for the file for a module's type frame page.
|
||||
* @param mdle the module
|
||||
* @return the path
|
||||
*/
|
||||
public DocPath moduleTypeFrame(ModuleElement mdle) {
|
||||
return createModulePath(mdle, "type-frame.html");
|
||||
}
|
||||
|
||||
private DocPath createModulePath(ModuleElement mdle, String path) {
|
||||
return DocPath.create(mdle.getQualifiedName() + moduleSeparator + path);
|
||||
}
|
||||
|
@ -349,9 +308,6 @@ public class DocPaths {
|
|||
return DocPath.create(moduleName + moduleSeparator + path);
|
||||
}
|
||||
|
||||
/** The name of the file for the module overview frame. */
|
||||
public static final DocPath MODULE_OVERVIEW_FRAME = DocPath.create("module-overview-frame.html");
|
||||
|
||||
/** The name of the sub-package from which resources are read. */
|
||||
public static final DocPath RESOURCES = DocPath.create("resources");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue