# HG changeset patch # User bpatel # Date 1358747135 18000 # Node ID 58a73dac9ee44cc0f183a0ef1b73b06fe4732226 # Parent f627eff819628822a0777af8062244352f2a29cf 8006124: javadoc/doclet should be updated to support profiles Reviewed-by: jjg diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java Wed Jul 05 18:37:13 2017 +0200 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java Mon Jan 21 00:45:35 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, 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 @@ -150,7 +150,20 @@ String tableSummary, Content body) { if (packages.length > 0) { Arrays.sort(packages); - addAllClassesLink(body); + HtmlTree div = new HtmlTree(HtmlTag.DIV); + div.addStyle(HtmlStyle.indexHeader); + addAllClassesLink(div); + if (configuration.showProfiles) { + addAllProfilesLink(div); + } + body.addContent(div); + if (configuration.showProfiles) { + String profileSummary = configuration.getText("doclet.Profiles"); + String profilesTableSummary = configuration.getText("doclet.Member_Table_Summary", + configuration.getText("doclet.Profile_Summary"), + configuration.getText("doclet.profiles")); + addProfilesList(profileSummary, profilesTableSummary, body); + } addPackagesList(packages, text, tableSummary, body); } } @@ -182,10 +195,29 @@ } /** - * Do nothing. This will be overridden in PackageIndexFrameWriter. + * Do nothing. This will be overridden. + * + * @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. * - * @param body the document tree to which the all classes link will be added + * @param div the document tree to which the all profiles link will be added */ - protected void addAllClassesLink(Content body) { + protected void addAllProfilesLink(Content div) { + } + + /** + * Do nothing. This will be overridden. + * + * @param profileSummary the profile summary heading + * @param profilesTableSummary the profiles table summary information + * @param body the content tree to which the profiles list will be added + */ + protected void addProfilesList(String profileSummary, String profilesTableSummary, + Content body) { } } diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java Mon Jan 21 00:45:35 2013 -0500 @@ -0,0 +1,276 @@ +/* + * Copyright (c) 2013, 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 com.sun.tools.doclets.formats.html; + +import java.io.*; + +import com.sun.tools.javac.sym.Profiles; +import com.sun.tools.doclets.formats.html.markup.*; +import com.sun.tools.doclets.internal.toolkit.*; +import com.sun.tools.doclets.internal.toolkit.util.DocPath; + +/** + * Abstract class to generate the profile overview files in + * Frame and Non-Frame format. This will be sub-classed to + * generate profile-overview-frame.html as well as profile-overview-summary.html. + * + *
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. + * + * @author Bhavesh Patel + */ +public abstract class AbstractProfileIndexWriter extends HtmlDocletWriter { + + /** + * Profiles to be documented. + */ + protected Profiles profiles; + + /** + * Constructor. Also initializes the profiles variable. + * + * @param configuration The current configuration + * @param filename Name of the profile index file to be generated. + */ + public AbstractProfileIndexWriter(ConfigurationImpl configuration, + DocPath filename) throws IOException { + super(configuration, filename); + profiles = configuration.profiles; + } + + /** + * Adds the navigation bar header to the documentation tree. + * + * @param body the document tree to which the navigation bar header will be added + */ + protected abstract void addNavigationBarHeader(Content body); + + /** + * Adds the navigation bar footer to the documentation tree. + * + * @param body the document tree to which the navigation bar footer will be added + */ + protected abstract void addNavigationBarFooter(Content body); + + /** + * Adds the overview header to the documentation tree. + * + * @param body the document tree to which the overview header will be added + */ + protected abstract void addOverviewHeader(Content body); + + /** + * Adds the profiles list to the documentation tree. + * + * @param profiles profiles object + * @param text caption for the table + * @param tableSummary summary for the table + * @param body the document tree to which the profiles list will be added + */ + protected abstract void addProfilesList(Profiles profiles, String text, + String tableSummary, Content body); + + /** + * Adds the profile packages list to the documentation tree. + * + * @param profiles profiles object + * @param text caption for the table + * @param tableSummary summary for the table + * @param body the document tree to which the profiles list will be added + * @param profileName the name for the profile being documented + */ + protected abstract void addProfilePackagesList(Profiles profiles, String text, + String tableSummary, Content body, String profileName); + + /** + * Generate and prints the contents in the profile index file. Call appropriate + * methods from the sub-class in order to generate Frame or Non + * Frame format. + * + * @param title the title of the window. + * @param includeScript boolean set true if windowtitle script is to be included + */ + protected void buildProfileIndexFile(String title, boolean includeScript) throws IOException { + String windowOverview = configuration.getText(title); + Content body = getBody(includeScript, getWindowTitle(windowOverview)); + addNavigationBarHeader(body); + addOverviewHeader(body); + addIndex(body); + addOverview(body); + addNavigationBarFooter(body); + printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title, + configuration.doctitle), includeScript, body); + } + + /** + * Generate and prints the contents in the profile packages index file. Call appropriate + * methods from the sub-class in order to generate Frame or Non + * Frame format. + * + * @param title the title of the window. + * @param includeScript boolean set true if windowtitle script is to be included + * @param profileName the name of the profile being documented + */ + protected void buildProfilePackagesIndexFile(String title, + boolean includeScript, String profileName) throws IOException { + String windowOverview = configuration.getText(title); + Content body = getBody(includeScript, getWindowTitle(windowOverview)); + addNavigationBarHeader(body); + addOverviewHeader(body); + addProfilePackagesIndex(body, profileName); + addOverview(body); + addNavigationBarFooter(body); + printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title, + configuration.doctitle), includeScript, body); + } + + /** + * Default to no overview, override to add overview. + * + * @param body the document tree to which the overview will be added + */ + protected void addOverview(Content body) throws IOException { + } + + /** + * Adds the frame or non-frame profile index to the documentation tree. + * + * @param body the document tree to which the index will be added + */ + protected void addIndex(Content body) { + addIndexContents(profiles, "doclet.Profile_Summary", + configuration.getText("doclet.Member_Table_Summary", + configuration.getText("doclet.Profile_Summary"), + configuration.getText("doclet.profiles")), body); + } + + /** + * Adds the frame or non-frame profile packages index to the documentation tree. + * + * @param body the document tree to which the index will be added + * @param profileName the name of the profile being documented + */ + protected void addProfilePackagesIndex(Content body, String profileName) { + addProfilePackagesIndexContents(profiles, "doclet.Profile_Summary", + configuration.getText("doclet.Member_Table_Summary", + configuration.getText("doclet.Profile_Summary"), + configuration.getText("doclet.profiles")), body, profileName); + } + + /** + * Adds profile index contents. Call appropriate methods from + * the sub-classes. Adds it to the body HtmlTree + * + * @param profiles profiles to be documented + * @param text string which will be used as the heading + * @param tableSummary summary for the table + * @param body the document tree to which the index contents will be added + */ + protected void addIndexContents(Profiles profiles, String text, + String tableSummary, Content body) { + if (profiles.getProfileCount() > 0) { + HtmlTree div = new HtmlTree(HtmlTag.DIV); + div.addStyle(HtmlStyle.indexHeader); + addAllClassesLink(div); + addAllPackagesLink(div); + body.addContent(div); + addProfilesList(profiles, text, tableSummary, body); + } + } + + /** + * Adds profile packages index contents. Call appropriate methods from + * the sub-classes. Adds it to the body HtmlTree + * + * @param profiles profiles to be documented + * @param text string which will be used as the heading + * @param tableSummary summary for the table + * @param body the document tree to which the index contents will be added + * @param profileName the name of the profile being documented + */ + protected void addProfilePackagesIndexContents(Profiles profiles, String text, + String tableSummary, Content body, String profileName) { + HtmlTree div = new HtmlTree(HtmlTag.DIV); + div.addStyle(HtmlStyle.indexHeader); + addAllClassesLink(div); + addAllPackagesLink(div); + addAllProfilesLink(div); + body.addContent(div); + addProfilePackagesList(profiles, text, tableSummary, body, profileName); + } + + /** + * Adds the doctitle to the documentation tree, if it is specified on the command line. + * + * @param body the document tree to which the title will be added + */ + protected void addConfigurationTitle(Content body) { + if (configuration.doctitle.length() > 0) { + Content title = new RawHtml(configuration.doctitle); + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, + HtmlStyle.title, title); + Content div = HtmlTree.DIV(HtmlStyle.header, heading); + body.addContent(div); + } + } + + /** + * Returns highlighted "Overview", in the navigation bar as this is the + * overview page. + * + * @return a Content object to be added to the documentation tree + */ + protected Content getNavLinkContents() { + Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel); + return li; + } + + /** + * Do nothing. This will be overridden in ProfileIndexFrameWriter. + * + * @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 ProfileIndexFrameWriter. + * + * @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 ProfilePackageIndexFrameWriter. + * + * @param div the document tree to which the all profiles link will be added + */ + protected void addAllProfilesLink(Content div) { + } +} diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Wed Jul 05 18:37:13 2017 +0200 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Mon Jan 21 00:45:35 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, 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 @@ -25,10 +25,10 @@ package com.sun.tools.doclets.formats.html; -import java.io.IOException; import java.util.*; import com.sun.javadoc.*; +import com.sun.tools.javac.jvm.Profile; import com.sun.tools.doclets.formats.html.markup.*; import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.builders.*; @@ -165,6 +165,20 @@ bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.header); + if (configuration.showProfiles) { + String sep = ""; + int profile = configuration.profiles.getProfile(getTypeNameForProfile(classDoc)); + if (profile > 0) { + Content profNameContent = new StringContent(); + for (int i = profile; i < configuration.profiles.getProfileCount(); i++) { + profNameContent.addContent(sep); + profNameContent.addContent(Profile.lookup(i).name); + sep = ", "; + } + Content profileNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, profNameContent); + div.addContent(profileNameDiv); + } + } if (pkgname.length() > 0) { Content pkgNameContent = new StringContent(pkgname); Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent); diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java Wed Jul 05 18:37:13 2017 +0200 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java Mon Jan 21 00:45:35 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, 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 @@ -65,7 +65,7 @@ public FrameOutputWriter(ConfigurationImpl configuration, DocPath filename) throws IOException { super(configuration, filename); - noOfPackages = configuration.packages.length; + noOfPackages = configuration.packages.length; } /** @@ -135,7 +135,13 @@ protected Content getFrameDetails() { HtmlTree frameset = HtmlTree.FRAMESET("20%,80%", null, "Documentation frame", "top.loadFrames()"); - if (noOfPackages <= 1) { + if (configuration.showProfiles) { + HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames", + "top.loadFrames()"); + addAllProfilesFrameTag(leftFrameset); + addAllClassesFrameTag(leftFrameset); + frameset.addContent(leftFrameset); + } else if (noOfPackages <= 1) { addAllClassesFrameTag(frameset); } else if (noOfPackages > 1) { HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames", @@ -150,6 +156,17 @@ } /** + * Add the FRAME tag for the frame that lists all profiles. + * + * @param contentTree the content tree to which the information will be added + */ + private void addAllProfilesFrameTag(Content contentTree) { + HtmlTree frame = HtmlTree.FRAME(DocPaths.PROFILE_OVERVIEW_FRAME.getPath(), + "profileListFrame", configuration.getText("doclet.All_Profiles")); + contentTree.addContent(frame); + } + + /** * Add the FRAME tag for the frame that lists all packages. * * @param contentTree the content tree to which the information will be added diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Wed Jul 05 18:37:13 2017 +0200 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Mon Jan 21 00:45:35 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, 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 @@ -28,6 +28,8 @@ import java.util.*; import com.sun.javadoc.*; +import com.sun.tools.javac.sym.Profiles; +import com.sun.tools.javac.jvm.Profile; import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.builders.*; import com.sun.tools.doclets.internal.toolkit.util.*; @@ -202,6 +204,44 @@ /** * {@inheritDoc} */ + protected void generateProfileFiles() throws Exception { + if (configuration.showProfiles) { + ProfileIndexFrameWriter.generate(configuration); + Profile prevProfile = null, nextProfile; + for (int i = 1; i < configuration.profiles.getProfileCount(); i++) { + ProfilePackageIndexFrameWriter.generate(configuration, Profile.lookup(i).name); + PackageDoc[] packages = configuration.profilePackages.get( + Profile.lookup(i).name); + PackageDoc prev = null, next; + for (int j = 0; j < packages.length; j++) { + // if -nodeprecated option is set and the package is marked as + // deprecated, do not generate the profilename-package-summary.html + // and profilename-package-frame.html pages for that package. + if (!(configuration.nodeprecated && Util.isDeprecated(packages[j]))) { + ProfilePackageFrameWriter.generate(configuration, packages[j], i); + next = (j + 1 < packages.length + && packages[j + 1].name().length() > 0) ? packages[j + 1] : null; + AbstractBuilder profilePackageSummaryBuilder = + configuration.getBuilderFactory().getProfilePackageSummaryBuilder( + packages[j], prev, next, Profile.lookup(i)); + profilePackageSummaryBuilder.build(); + prev = packages[j]; + } + } + nextProfile = (i + 1 < configuration.profiles.getProfileCount()) ? + Profile.lookup(i + 1) : null; + AbstractBuilder profileSummaryBuilder = + configuration.getBuilderFactory().getProfileSummaryBuilder( + Profile.lookup(i), prevProfile, nextProfile); + profileSummaryBuilder.build(); + prevProfile = Profile.lookup(i); + } + } + } + + /** + * {@inheritDoc} + */ protected void generatePackageFiles(ClassTree classtree) throws Exception { PackageDoc[] packages = configuration.packages; if (packages.length > 1) { diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Wed Jul 05 18:37:13 2017 +0200 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Mon Jan 21 00:45:35 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, 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 @@ -301,6 +301,107 @@ } /** + * Get Profile Package link, with target frame. + * + * @param pd the packageDoc object + * @param target name of the target frame + * @param label tag for the link + * @param profileName the name of the profile being documented + * @return a content for the target profile packages link + */ + public Content getTargetProfilePackageLink(PackageDoc pd, String target, + Content label, String profileName) { + return getHyperLink(pathString(pd, DocPaths.profilePackageSummary(profileName)), + label, "", target); + } + + /** + * Get Profile link, with target frame. + * + * @param target name of the target frame + * @param label tag for the link + * @param profileName the name of the profile being documented + * @return a content for the target profile link + */ + public Content getTargetProfileLink(String target, Content label, + String profileName) { + return getHyperLink(pathToRoot.resolve( + DocPaths.profileSummary(profileName)), label, "", target); + } + + /** + * Get the type name for profile search. + * + * @param cd the classDoc object for which the type name conversion is needed + * @return a type name string for the type + */ + public String getTypeNameForProfile(ClassDoc cd) { + StringBuilder typeName = + new StringBuilder((cd.containingPackage()).name().replace(".", "/")); + typeName.append("/") + .append(cd.name().replace(".", "$")); + return typeName.toString(); + } + + /** + * Check if a type belongs to a profile. + * + * @param cd the classDoc object that needs to be checked + * @param profileValue the profile in which the type needs to be checked + * @return true if the type is in the profile + */ + public boolean isTypeInProfile(ClassDoc cd, int profileValue) { + return (configuration.profiles.getProfile(getTypeNameForProfile(cd)) <= profileValue); + } + + public void addClassesSummary(ClassDoc[] classes, String label, + String tableSummary, String[] tableHeader, Content summaryContentTree, + int profileValue) { + if(classes.length > 0) { + Arrays.sort(classes); + Content caption = getTableCaption(label); + Content table = HtmlTree.TABLE(HtmlStyle.packageSummary, 0, 3, 0, + tableSummary, caption); + table.addContent(getSummaryTableHeader(tableHeader, "col")); + Content tbody = new HtmlTree(HtmlTag.TBODY); + for (int i = 0; i < classes.length; i++) { + if (!isTypeInProfile(classes[i], profileValue)) { + continue; + } + if (!Util.isCoreClass(classes[i]) || + !configuration.isGeneratedDoc(classes[i])) { + continue; + } + Content classContent = new RawHtml(getLink(new LinkInfoImpl( + configuration, LinkInfoImpl.CONTEXT_PACKAGE, classes[i], + false))); + Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent); + HtmlTree tr = HtmlTree.TR(tdClass); + if (i%2 == 0) + tr.addStyle(HtmlStyle.altColor); + else + tr.addStyle(HtmlStyle.rowColor); + HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD); + tdClassDescription.addStyle(HtmlStyle.colLast); + if (Util.isDeprecated(classes[i])) { + tdClassDescription.addContent(deprecatedLabel); + if (classes[i].tags("deprecated").length > 0) { + addSummaryDeprecatedComment(classes[i], + classes[i].tags("deprecated")[0], tdClassDescription); + } + } + else + addSummaryComment(classes[i], tdClassDescription); + tr.addContent(tdClassDescription); + tbody.addContent(tr); + } + table.addContent(tbody); + Content li = HtmlTree.LI(HtmlStyle.blockList, table); + summaryContentTree.addContent(li); + } + } + + /** * Generates the HTML document tree and prints it out. * * @param metakeywords Array of String keywords for META tag. Each element diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java Wed Jul 05 18:37:13 2017 +0200 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java Mon Jan 21 00:45:35 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, 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 @@ -145,13 +145,26 @@ * Adds "All Classes" link for the top of the left-hand frame page to the * documentation tree. * - * @param body the Content object to which the all classes link should be added + * @param div the Content object to which the all classes link should be added */ - protected void addAllClassesLink(Content body) { + protected void addAllClassesLink(Content div) { Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME, allclassesLabel, "", "packageFrame"); - Content div = HtmlTree.DIV(HtmlStyle.indexHeader, linkContent); - body.addContent(div); + Content span = HtmlTree.SPAN(linkContent); + div.addContent(span); + } + + /** + * Adds "All Profiles" link for the top of the left-hand frame page to the + * documentation tree. + * + * @param div the Content object to which the all profiles link should be added + */ + protected void addAllProfilesLink(Content div) { + Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME, + allprofilesLabel, "", "profileListFrame"); + Content span = HtmlTree.SPAN(linkContent); + div.addContent(span); } /** diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Wed Jul 05 18:37:13 2017 +0200 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Mon Jan 21 00:45:35 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, 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 @@ -29,6 +29,7 @@ import java.util.*; import com.sun.javadoc.*; +import com.sun.tools.javac.jvm.Profile; import com.sun.tools.doclets.formats.html.markup.*; import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.util.*; @@ -122,6 +123,21 @@ /** * {@inheritDoc} */ + protected void addProfilesList(String profileSummary, String profilesTableSummary, + Content body) { + Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, profilesTableSummary, + getTableCaption(profileSummary)); + table.addContent(getSummaryTableHeader(profileTableHeader, "col")); + Content tbody = new HtmlTree(HtmlTag.TBODY); + addProfilesList(tbody); + table.addContent(tbody); + Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table); + body.addContent(div); + } + + /** + * {@inheritDoc} + */ protected void addPackagesList(PackageDoc[] packages, String text, String tableSummary, Content body) { Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary, @@ -135,6 +151,31 @@ } /** + * Adds list of profiles in the index table. Generate link to each profile. + * + * @param tbody the documentation tree to which the list will be added + */ + protected void addProfilesList(Content tbody) { + for (int i = 1; i < configuration.profiles.getProfileCount(); i++) { + String profileName = Profile.lookup(i).name; + Content profileLinkContent = getTargetProfileLink("classFrame", + new StringContent(profileName), profileName); + Content tdProfile = HtmlTree.TD(HtmlStyle.colFirst, profileLinkContent); + HtmlTree tdSummary = new HtmlTree(HtmlTag.TD); + tdSummary.addStyle(HtmlStyle.colLast); + tdSummary.addContent(getSpace()); + HtmlTree tr = HtmlTree.TR(tdProfile); + tr.addContent(tdSummary); + if (i % 2 == 0) { + tr.addStyle(HtmlStyle.altColor); + } else { + tr.addStyle(HtmlStyle.rowColor); + } + tbody.addContent(tr); + } + } + + /** * Adds list of packages in the index table. Generate link to each package. * * @param packages Packages to which link is to be generated diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java Mon Jan 21 00:45:35 2013 -0500 @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2013, 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 com.sun.tools.doclets.formats.html; + +import java.io.*; + +import com.sun.tools.javac.sym.Profiles; +import com.sun.tools.doclets.formats.html.markup.*; +import com.sun.tools.doclets.internal.toolkit.*; +import com.sun.tools.doclets.internal.toolkit.util.*; +import com.sun.tools.javac.jvm.Profile; + +/** + * Generate the profile index for the left-hand frame in the generated output. + * A click on the profile name in this frame will update the page in the top + * left hand frame with the listing of packages of the clicked profile. + * + *
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. + * + * @author Bhavesh Patel + */ +public class ProfileIndexFrameWriter extends AbstractProfileIndexWriter { + + /** + * Construct the ProfileIndexFrameWriter object. + * + * @param configuration the configuration object + * @param filename Name of the profile index file to be generated. + */ + public ProfileIndexFrameWriter(ConfigurationImpl configuration, + DocPath filename) throws IOException { + super(configuration, filename); + } + + /** + * Generate the profile index file named "profile-overview-frame.html". + * @throws DocletAbortException + * @param configuration the configuration object + */ + public static void generate(ConfigurationImpl configuration) { + ProfileIndexFrameWriter profilegen; + DocPath filename = DocPaths.PROFILE_OVERVIEW_FRAME; + try { + profilegen = new ProfileIndexFrameWriter(configuration, filename); + profilegen.buildProfileIndexFile("doclet.Window_Overview", false); + profilegen.close(); + } catch (IOException exc) { + configuration.standardmessage.error( + "doclet.exception_encountered", + exc.toString(), filename); + throw new DocletAbortException(); + } + } + + /** + * {@inheritDoc} + */ + protected void addProfilesList(Profiles profiles, String text, + String tableSummary, Content body) { + Content heading = HtmlTree.HEADING(HtmlConstants.PROFILE_HEADING, true, + profilesLabel); + Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading); + HtmlTree ul = new HtmlTree(HtmlTag.UL); + ul.addAttr(HtmlAttr.TITLE, profilesLabel.toString()); + for (int i = 1; i < profiles.getProfileCount(); i++) { + ul.addContent(getProfile(i)); + } + div.addContent(ul); + body.addContent(div); + } + + /** + * Gets each profile name as a separate link. + * + * @param profile the profile being documented + * @return content for the profile link + */ + protected Content getProfile(int profile) { + Content profileLinkContent; + Content profileLabel; + String profileName = (Profile.lookup(profile)).name; + profileLabel = new StringContent(profileName); + profileLinkContent = getHyperLink(DocPaths.profileFrame(profileName), profileLabel, "", + "profileListFrame"); + Content li = HtmlTree.LI(profileLinkContent); + return li; + } + + /** + * {@inheritDoc} + */ + protected void addNavigationBarHeader(Content body) { + Content headerContent; + if (configuration.packagesheader.length() > 0) { + headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader)); + } else { + headerContent = new RawHtml(replaceDocRootDir(configuration.header)); + } + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, + HtmlStyle.bar, headerContent); + body.addContent(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 div the Content object to which the all classes link should be added + */ + protected void addAllClassesLink(Content div) { + Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME, + allclassesLabel, "", "packageFrame"); + Content span = HtmlTree.SPAN(linkContent); + div.addContent(span); + } + + /** + * Adds "All Packages" link for the top of the left-hand frame page to the + * documentation tree. + * + * @param div the Content object to which the all packages link should be added + */ + protected void addAllPackagesLink(Content div) { + Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME, + allpackagesLabel, "", "profileListFrame"); + Content span = HtmlTree.SPAN(linkContent); + div.addContent(span); + } + + /** + * {@inheritDoc} + */ + protected void addNavigationBarFooter(Content body) { + Content p = HtmlTree.P(getSpace()); + body.addContent(p); + } + + protected void addProfilePackagesList(Profiles profiles, String text, + String tableSummary, Content body, String profileName) { + } +} diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java Mon Jan 21 00:45:35 2013 -0500 @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2013, 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 com.sun.tools.doclets.formats.html; + +import java.io.*; +import java.util.*; + +import com.sun.javadoc.*; +import com.sun.tools.javac.jvm.Profile; +import com.sun.tools.doclets.formats.html.markup.*; +import com.sun.tools.doclets.internal.toolkit.*; +import com.sun.tools.doclets.internal.toolkit.util.*; + +/** + * Class to generate file for each package contents of a profile in the left-hand bottom + * frame. This will list all the Class Kinds in the package for a profile. A click on any + * class-kind will update the right-hand frame with the clicked class-kind page. + * + *
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. + * + * @author Bhavesh Patel + */ +public class ProfilePackageFrameWriter extends HtmlDocletWriter { + + /** + * The package being documented. + */ + private PackageDoc packageDoc; + + /** + * Constructor to construct ProfilePackageFrameWriter object and to generate + * "profilename-package-frame.html" file in the respective package directory. + * For example for profile compact1 and package "java.lang" this will generate file + * "compact1-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 packageDoc PackageDoc under consideration. + * @param profileName the name of the profile being documented + */ + public ProfilePackageFrameWriter(ConfigurationImpl configuration, + PackageDoc packageDoc, String profileName) + throws IOException { + super(configuration, DocPath.forPackage(packageDoc).resolve( + DocPaths.profilePackageFrame(profileName))); + this.packageDoc = packageDoc; + } + + /** + * Generate a profile package summary page for the left-hand bottom frame. Construct + * the ProfilePackageFrameWriter object and then uses it generate the file. + * + * @param configuration the current configuration of the doclet. + * @param packageDoc The package for which "profilename-package-frame.html" is to be generated. + * @param profileValue the value of the profile being documented + */ + public static void generate(ConfigurationImpl configuration, + PackageDoc packageDoc, int profileValue) { + ProfilePackageFrameWriter profpackgen; + try { + String profileName = Profile.lookup(profileValue).name; + profpackgen = new ProfilePackageFrameWriter(configuration, packageDoc, + profileName); + StringBuilder winTitle = new StringBuilder(profileName); + String sep = " - "; + winTitle.append(sep); + String pkgName = Util.getPackageName(packageDoc); + winTitle.append(pkgName); + Content body = profpackgen.getBody(false, + profpackgen.getWindowTitle(winTitle.toString())); + Content profName = new StringContent(profileName); + Content sepContent = new StringContent(sep); + Content pkgNameContent = new RawHtml(pkgName); + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, + profpackgen.getTargetProfileLink("classFrame", profName, profileName)); + heading.addContent(sepContent); + heading.addContent(profpackgen.getTargetProfilePackageLink(packageDoc, + "classFrame", pkgNameContent, profileName)); + body.addContent(heading); + HtmlTree div = new HtmlTree(HtmlTag.DIV); + div.addStyle(HtmlStyle.indexContainer); + profpackgen.addClassListing(div, profileValue); + body.addContent(div); + profpackgen.printHtmlDocument( + configuration.metakeywords.getMetaKeywords(packageDoc), false, body); + profpackgen.close(); + } catch (IOException exc) { + configuration.standardmessage.error( + "doclet.exception_encountered", + exc.toString(), DocPaths.PACKAGE_FRAME.getPath()); + throw new DocletAbortException(); + } + } + + /** + * 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 + * @param profileValue the value of the profile being documented + */ + protected void addClassListing(Content contentTree, int profileValue) { + if (packageDoc.isIncluded()) { + addClassKindListing(packageDoc.interfaces(), + getResource("doclet.Interfaces"), contentTree, profileValue); + addClassKindListing(packageDoc.ordinaryClasses(), + getResource("doclet.Classes"), contentTree, profileValue); + addClassKindListing(packageDoc.enums(), + getResource("doclet.Enums"), contentTree, profileValue); + addClassKindListing(packageDoc.exceptions(), + getResource("doclet.Exceptions"), contentTree, profileValue); + addClassKindListing(packageDoc.errors(), + getResource("doclet.Errors"), contentTree, profileValue); + addClassKindListing(packageDoc.annotationTypes(), + getResource("doclet.AnnotationTypes"), contentTree, profileValue); + } + } + + /** + * Add specific class kind listing. Also add label to the listing. + * + * @param arr Array 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 + * @param profileValue the value of the profile being documented + */ + protected void addClassKindListing(ClassDoc[] arr, Content labelContent, + Content contentTree, int profileValue) { + if(arr.length > 0) { + Arrays.sort(arr); + boolean printedHeader = false; + HtmlTree ul = new HtmlTree(HtmlTag.UL); + ul.addAttr(HtmlAttr.TITLE, labelContent.toString()); + for (int i = 0; i < arr.length; i++) { + if (!isTypeInProfile(arr[i], profileValue)) { + continue; + } + if (!Util.isCoreClass(arr[i]) || ! + configuration.isGeneratedDoc(arr[i])) { + continue; + } + if (!printedHeader) { + Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + true, labelContent); + contentTree.addContent(heading); + printedHeader = true; + } + Content link = new RawHtml (getLink(new LinkInfoImpl(configuration, + LinkInfoImpl.PACKAGE_FRAME, arr[i], + (arr[i].isInterface() ? italicsText(arr[i].name()) : + arr[i].name()),"classFrame"))); + Content li = HtmlTree.LI(link); + ul.addContent(li); + } + contentTree.addContent(ul); + } + } +} diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java Mon Jan 21 00:45:35 2013 -0500 @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2013, 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 com.sun.tools.doclets.formats.html; + +import java.io.*; + +import com.sun.javadoc.*; +import com.sun.tools.javac.sym.Profiles; +import com.sun.tools.doclets.formats.html.markup.*; +import com.sun.tools.doclets.internal.toolkit.*; +import com.sun.tools.doclets.internal.toolkit.util.*; + +/** + * Generate the profile 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 profile package. + * + *
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. + * + * @author Bhavesh Patel + */ +public class ProfilePackageIndexFrameWriter extends AbstractProfileIndexWriter { + + /** + * Construct the ProfilePackageIndexFrameWriter object. + * + * @param configuration the configuration object + * @param filename Name of the package index file to be generated. + */ + public ProfilePackageIndexFrameWriter(ConfigurationImpl configuration, + DocPath filename) throws IOException { + super(configuration, filename); + } + + /** + * Generate the profile package index file. + * @throws DocletAbortException + * @param configuration the configuration object + * @param profileName the name of the profile being documented + */ + public static void generate(ConfigurationImpl configuration, String profileName) { + ProfilePackageIndexFrameWriter profpackgen; + DocPath filename = DocPaths.profileFrame(profileName); + try { + profpackgen = new ProfilePackageIndexFrameWriter(configuration, filename); + profpackgen.buildProfilePackagesIndexFile("doclet.Window_Overview", false, profileName); + profpackgen.close(); + } catch (IOException exc) { + configuration.standardmessage.error( + "doclet.exception_encountered", + exc.toString(), filename); + throw new DocletAbortException(); + } + } + + /** + * {@inheritDoc} + */ + protected void addProfilePackagesList(Profiles profiles, String text, + String tableSummary, Content body, String profileName) { + Content profNameContent = new StringContent(profileName); + Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, + getTargetProfileLink("classFrame", profNameContent, profileName)); + heading.addContent(getSpace()); + heading.addContent(packagesLabel); + Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading); + HtmlTree ul = new HtmlTree(HtmlTag.UL); + ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString()); + PackageDoc[] packages = configuration.profilePackages.get(profileName); + for (int i = 0; i < packages.length; i++) { + if ((!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) { + ul.addContent(getPackage(packages[i], profileName)); + } + } + div.addContent(ul); + body.addContent(div); + } + + /** + * Gets each package name as a separate link. + * + * @param pd PackageDoc + * @param profileName the name of the profile being documented + * @return content for the package link + */ + protected Content getPackage(PackageDoc pd, String profileName) { + Content packageLinkContent; + Content pkgLabel; + if (pd.name().length() > 0) { + pkgLabel = getPackageLabel(pd.name()); + packageLinkContent = getHyperLink(pathString(pd, + DocPaths.profilePackageFrame(profileName)), pkgLabel, "", + "packageFrame"); + } else { + pkgLabel = new RawHtml("<unnamed package>"); + packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME, + pkgLabel, "", "packageFrame"); + } + Content li = HtmlTree.LI(packageLinkContent); + return li; + } + + /** + * {@inheritDoc} + */ + protected void addNavigationBarHeader(Content body) { + Content headerContent; + if (configuration.packagesheader.length() > 0) { + headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader)); + } else { + headerContent = new RawHtml(replaceDocRootDir(configuration.header)); + } + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, + HtmlStyle.bar, headerContent); + body.addContent(heading); + } + + /** + * Do nothing as there is no overview information in this page. + */ + protected void addOverviewHeader(Content body) { + } + + protected void addProfilesList(Profiles profiles, String text, + String tableSummary, Content body) { + } + + /** + * Adds "All Classes" link for the top of the left-hand frame page to the + * documentation tree. + * + * @param div the Content object to which the all classes link should be added + */ + protected void addAllClassesLink(Content div) { + Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME, + allclassesLabel, "", "packageFrame"); + Content span = HtmlTree.SPAN(linkContent); + div.addContent(span); + } + + /** + * Adds "All Packages" link for the top of the left-hand frame page to the + * documentation tree. + * + * @param div the Content object to which the all packages link should be added + */ + protected void addAllPackagesLink(Content div) { + Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME, + allpackagesLabel, "", "profileListFrame"); + Content span = HtmlTree.SPAN(linkContent); + div.addContent(span); + } + + /** + * Adds "All Profiles" link for the top of the left-hand frame page to the + * documentation tree. + * + * @param div the Content object to which the all profiles link should be added + */ + protected void addAllProfilesLink(Content div) { + Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME, + allprofilesLabel, "", "profileListFrame"); + Content span = HtmlTree.SPAN(linkContent); + div.addContent(span); + } + + /** + * {@inheritDoc} + */ + protected void addNavigationBarFooter(Content body) { + Content p = HtmlTree.P(getSpace()); + body.addContent(p); + } +} diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java Mon Jan 21 00:45:35 2013 -0500 @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2013, 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 com.sun.tools.doclets.formats.html; + +import java.io.*; +import java.util.*; + +import com.sun.javadoc.*; +import com.sun.tools.javac.jvm.Profile; +import com.sun.tools.doclets.formats.html.markup.*; +import com.sun.tools.doclets.internal.toolkit.*; +import com.sun.tools.doclets.internal.toolkit.util.*; + +/** + * Class to generate file for each profile package contents in the right-hand + * frame. This will list all the Class Kinds in the package. A click on any + * class-kind will update the frame with the clicked class-kind page. + * + *
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. + * + * @author Bhavesh Patel + */ +public class ProfilePackageWriterImpl extends HtmlDocletWriter + implements ProfilePackageSummaryWriter { + + /** + * The prev package name in the alpha-order list. + */ + protected PackageDoc prev; + + /** + * The next package name in the alpha-order list. + */ + protected PackageDoc next; + + /** + * The profile package being documented. + */ + protected PackageDoc packageDoc; + + /** + * The name of the profile being documented. + */ + protected String profileName; + + /** + * The value of the profile being documented. + */ + protected int profileValue; + + /** + * Constructor to construct ProfilePackageWriter object and to generate + * "profilename-package-summary.html" file in the respective package directory. + * For example for profile compact1 and package "java.lang" this will generate file + * "compact1-package-summary.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 packageDoc PackageDoc under consideration. + * @param prev Previous package in the sorted array. + * @param next Next package in the sorted array. + * @param profile The profile being documented. + */ + public ProfilePackageWriterImpl(ConfigurationImpl configuration, + PackageDoc packageDoc, PackageDoc prev, PackageDoc next, + Profile profile) throws IOException { + super(configuration, DocPath.forPackage(packageDoc).resolve( + DocPaths.profilePackageSummary(profile.name))); + this.prev = prev; + this.next = next; + this.packageDoc = packageDoc; + this.profileName = profile.name; + this.profileValue = profile.value; + } + + /** + * {@inheritDoc} + */ + public Content getPackageHeader(String heading) { + String pkgName = packageDoc.name(); + Content bodyTree = getBody(true, getWindowTitle(pkgName)); + addTop(bodyTree); + addNavLinks(true, bodyTree); + HtmlTree div = new HtmlTree(HtmlTag.DIV); + div.addStyle(HtmlStyle.header); + Content profileContent = new StringContent(profileName); + Content profileNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, profileContent); + div.addContent(profileNameDiv); + Content annotationContent = new HtmlTree(HtmlTag.P); + addAnnotationInfo(packageDoc, annotationContent); + div.addContent(annotationContent); + Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, + HtmlStyle.title, packageLabel); + tHeading.addContent(getSpace()); + Content packageHead = new RawHtml(heading); + tHeading.addContent(packageHead); + div.addContent(tHeading); + addDeprecationInfo(div); + if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) { + HtmlTree docSummaryDiv = new HtmlTree(HtmlTag.DIV); + docSummaryDiv.addStyle(HtmlStyle.docSummary); + addSummaryComment(packageDoc, docSummaryDiv); + div.addContent(docSummaryDiv); + Content space = getSpace(); + Content descLink = getHyperLink(DocLink.fragment("package_description"), + descriptionLabel, "", ""); + Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink); + div.addContent(descPara); + } + bodyTree.addContent(div); + return bodyTree; + } + + /** + * {@inheritDoc} + */ + public Content getContentHeader() { + HtmlTree div = new HtmlTree(HtmlTag.DIV); + div.addStyle(HtmlStyle.contentContainer); + return div; + } + + /** + * Add the package deprecation information to the documentation tree. + * + * @param div the content tree to which the deprecation information will be added + */ + public void addDeprecationInfo(Content div) { + Tag[] deprs = packageDoc.tags("deprecated"); + if (Util.isDeprecated(packageDoc)) { + HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); + deprDiv.addStyle(HtmlStyle.deprecatedContent); + Content deprPhrase = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); + deprDiv.addContent(deprPhrase); + if (deprs.length > 0) { + Tag[] commentTags = deprs[0].inlineTags(); + if (commentTags.length > 0) { + addInlineDeprecatedComment(packageDoc, deprs[0], deprDiv); + } + } + div.addContent(deprDiv); + } + } + + /** + * {@inheritDoc} + */ + public void addClassesSummary(ClassDoc[] classes, String label, + String tableSummary, String[] tableHeader, Content packageSummaryContentTree) { + addClassesSummary(classes, label, tableSummary, tableHeader, + packageSummaryContentTree, profileValue); + } + + /** + * {@inheritDoc} + */ + public Content getSummaryHeader() { + HtmlTree ul = new HtmlTree(HtmlTag.UL); + ul.addStyle(HtmlStyle.blockList); + return ul; + } + + /** + * {@inheritDoc} + */ + public void addPackageDescription(Content packageContentTree) { + if (packageDoc.inlineTags().length > 0) { + packageContentTree.addContent(getMarkerAnchor("package_description")); + Content h2Content = new StringContent( + configuration.getText("doclet.Package_Description", + packageDoc.name())); + packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, + true, h2Content)); + addInlineComment(packageDoc, packageContentTree); + } + } + + /** + * {@inheritDoc} + */ + public void addPackageTags(Content packageContentTree) { + addTagsInfo(packageDoc, packageContentTree); + } + + /** + * {@inheritDoc} + */ + public void addPackageFooter(Content contentTree) { + addNavLinks(false, contentTree); + addBottom(contentTree); + } + + /** + * {@inheritDoc} + */ + public void printDocument(Content contentTree) throws IOException { + printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageDoc), + true, contentTree); + } + + /** + * Get "Use" link for this package in the navigation bar. + * + * @return a content tree for the class use link + */ + protected Content getNavLinkClassUse() { + Content useLink = getHyperLink(DocPaths.PACKAGE_USE, + useLabel, "", ""); + Content li = HtmlTree.LI(useLink); + return li; + } + + /** + * Get "PREV PACKAGE" link in the navigation bar. + * + * @return a content tree for the previous link + */ + public Content getNavLinkPrevious() { + Content li; + if (prev == null) { + li = HtmlTree.LI(prevpackageLabel); + } else { + DocPath path = DocPath.relativePath(packageDoc, prev); + li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.profilePackageSummary(profileName)), + prevpackageLabel, "", "")); + } + return li; + } + + /** + * Get "NEXT PACKAGE" link in the navigation bar. + * + * @return a content tree for the next link + */ + public Content getNavLinkNext() { + Content li; + if (next == null) { + li = HtmlTree.LI(nextpackageLabel); + } else { + DocPath path = DocPath.relativePath(packageDoc, next); + li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.profilePackageSummary(profileName)), + nextpackageLabel, "", "")); + } + return li; + } + + /** + * Get "Tree" link in the navigation bar. This will be link to the package + * tree file. + * + * @return a content tree for the tree link + */ + protected Content getNavLinkTree() { + Content useLink = getHyperLink(DocPaths.PACKAGE_TREE, + treeLabel, "", ""); + Content li = HtmlTree.LI(useLink); + return li; + } + + /** + * Highlight "Package" in the navigation bar, as this is the package page. + * + * @return a content tree for the package link + */ + protected Content getNavLinkPackage() { + Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, packageLabel); + return li; + } +} diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java Mon Jan 21 00:45:35 2013 -0500 @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2013, 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 com.sun.tools.doclets.formats.html; + +import java.io.*; +import java.util.*; + +import com.sun.javadoc.*; +import com.sun.tools.javac.jvm.Profile; +import com.sun.tools.doclets.formats.html.markup.*; +import com.sun.tools.doclets.internal.toolkit.*; +import com.sun.tools.doclets.internal.toolkit.util.*; + +/** + * Class to generate file for each profile contents in the right-hand + * frame. This will list all the packages and Class Kinds in the profile. A click on any + * class-kind will update the frame with the clicked class-kind page. A click on any + * package will update the frame with the clicked profile package page. + * + *
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.
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfileWriterImpl extends HtmlDocletWriter
+ implements ProfileSummaryWriter {
+
+ /**
+ * The prev profile name in the alpha-order list.
+ */
+ protected Profile prevProfile;
+
+ /**
+ * The next profile name in the alpha-order list.
+ */
+ protected Profile nextProfile;
+
+ /**
+ * The profile being documented.
+ */
+ protected Profile profile;
+
+ /**
+ * Constructor to construct ProfileWriter object and to generate
+ * "profileName-summary.html" file.
+ *
+ * @param configuration the configuration of the doclet.
+ * @param profile Profile under consideration.
+ * @param prevProfile Previous profile in the sorted array.
+ * @param nextProfile Next profile in the sorted array.
+ */
+ public ProfileWriterImpl(ConfigurationImpl configuration,
+ Profile profile, Profile prevProfile, Profile nextProfile)
+ throws IOException {
+ super(configuration, DocPaths.profileSummary(profile.name));
+ this.prevProfile = prevProfile;
+ this.nextProfile = nextProfile;
+ this.profile = profile;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Content getProfileHeader(String heading) {
+ String profileName = profile.name;
+ Content bodyTree = getBody(true, getWindowTitle(profileName));
+ addTop(bodyTree);
+ addNavLinks(true, bodyTree);
+ HtmlTree div = new HtmlTree(HtmlTag.DIV);
+ div.addStyle(HtmlStyle.header);
+ Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
+ HtmlStyle.title, profileLabel);
+ tHeading.addContent(getSpace());
+ Content profileHead = new RawHtml(heading);
+ tHeading.addContent(profileHead);
+ div.addContent(tHeading);
+ bodyTree.addContent(div);
+ return bodyTree;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Content getContentHeader() {
+ HtmlTree div = new HtmlTree(HtmlTag.DIV);
+ div.addStyle(HtmlStyle.contentContainer);
+ return div;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Content getSummaryHeader() {
+ HtmlTree li = new HtmlTree(HtmlTag.LI);
+ li.addStyle(HtmlStyle.blockList);
+ return li;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Content getSummaryTree(Content summaryContentTree) {
+ HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
+ HtmlTree div = HtmlTree.DIV(HtmlStyle.summary, ul);
+ return div;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Content getPackageSummaryHeader(PackageDoc pkg) {
+ Content pkgName = getTargetProfilePackageLink(pkg,
+ "classFrame", new StringContent(pkg.name()), profile.name);
+ Content heading = HtmlTree.HEADING(HtmlTag.H3, pkgName);
+ HtmlTree li = HtmlTree.LI(HtmlStyle.blockList, heading);
+ return li;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Content getPackageSummaryTree(Content packageSummaryContentTree) {
+ HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, packageSummaryContentTree);
+ return ul;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addClassesSummary(ClassDoc[] classes, String label,
+ String tableSummary, String[] tableHeader, Content packageSummaryContentTree) {
+ addClassesSummary(classes, label, tableSummary, tableHeader,
+ packageSummaryContentTree, profile.value);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addProfileFooter(Content contentTree) {
+ addNavLinks(false, contentTree);
+ addBottom(contentTree);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void printDocument(Content contentTree) throws IOException {
+ printHtmlDocument(configuration.metakeywords.getMetaKeywords(profile),
+ true, contentTree);
+ }
+
+ /**
+ * Get "PREV PROFILE" link in the navigation bar.
+ *
+ * @return a content tree for the previous link
+ */
+ public Content getNavLinkPrevious() {
+ Content li;
+ if (prevProfile == null) {
+ li = HtmlTree.LI(prevprofileLabel);
+ } else {
+ li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.profileSummary(
+ prevProfile.name)), prevprofileLabel, "", ""));
+ }
+ return li;
+ }
+
+ /**
+ * Get "NEXT PROFILE" link in the navigation bar.
+ *
+ * @return a content tree for the next link
+ */
+ public Content getNavLinkNext() {
+ Content li;
+ if (nextProfile == null) {
+ li = HtmlTree.LI(nextprofileLabel);
+ } else {
+ li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.profileSummary(
+ nextProfile.name)), nextprofileLabel, "", ""));
+ }
+ return li;
+ }
+}
diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java Wed Jul 05 18:37:13 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java Mon Jan 21 00:45:35 2013 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -28,6 +28,7 @@
import java.io.IOException;
import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -69,6 +70,24 @@
/**
* {@inheritDoc}
*/
+ public ProfileSummaryWriter getProfileSummaryWriter(Profile profile,
+ Profile prevProfile, Profile nextProfile) throws Exception {
+ return new ProfileWriterImpl(configuration, profile,
+ prevProfile, nextProfile);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ProfilePackageSummaryWriter getProfilePackageSummaryWriter(PackageDoc packageDoc,
+ PackageDoc prevPkg, PackageDoc nextPkg, Profile profile) throws Exception {
+ return new ProfilePackageWriterImpl(configuration, packageDoc,
+ prevPkg, nextPkg, profile);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public ClassWriter getClassWriter(ClassDoc classDoc, ClassDoc prevClass,
ClassDoc nextClass, ClassTree classTree) throws IOException {
return new ClassWriterImpl(configuration, classDoc,
diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java Wed Jul 05 18:37:13 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java Mon Jan 21 00:45:35 2013 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, 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
@@ -168,6 +168,11 @@
public static final HtmlTag PACKAGE_HEADING = HtmlTag.H2;
/**
+ * Html tag for the profile name heading.
+ */
+ public static final HtmlTag PROFILE_HEADING = HtmlTag.H2;
+
+ /**
* Html tag for the member summary heading.
*/
public static final HtmlTag SUMMARY_HEADING = HtmlTag.H3;
diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Wed Jul 05 18:37:13 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Mon Jan 21 00:45:35 2013 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -63,6 +63,11 @@
protected boolean memberDetailsListPrinted;
/**
+ * Header for table displaying profiles and description..
+ */
+ protected final String[] profileTableHeader;
+
+ /**
* Header for tables displaying packages and description..
*/
protected final String[] packageTableHeader;
@@ -83,6 +88,8 @@
public final Content packageLabel;
+ public final Content profileLabel;
+
public final Content useLabel;
public final Content prevLabel;
@@ -111,6 +118,10 @@
public final Content allclassesLabel;
+ public final Content allpackagesLabel;
+
+ public final Content allprofilesLabel;
+
public final Content indexLabel;
public final Content helpLabel;
@@ -123,8 +134,14 @@
public final Content nextpackageLabel;
+ public final Content prevprofileLabel;
+
+ public final Content nextprofileLabel;
+
public final Content packagesLabel;
+ public final Content profilesLabel;
+
public final Content methodDetailsLabel;
public final Content annotationTypeDetailsLabel;
@@ -162,6 +179,10 @@
writer = DocFile.createFileForOutput(configuration, path).openWriter();
this.configuration = configuration;
this.memberDetailsListPrinted = false;
+ profileTableHeader = new String[] {
+ configuration.getText("doclet.Profile"),
+ configuration.getText("doclet.Description")
+ };
packageTableHeader = new String[] {
configuration.getText("doclet.Package"),
configuration.getText("doclet.Description")
@@ -175,6 +196,7 @@
defaultPackageLabel = new RawHtml(
DocletConstants.DEFAULT_PACKAGE_NAME);
packageLabel = getResource("doclet.Package");
+ profileLabel = getResource("doclet.Profile");
useLabel = getResource("doclet.navClassUse");
prevLabel = getResource("doclet.Prev");
nextLabel = getResource("doclet.Next");
@@ -189,13 +211,18 @@
deprecatedLabel = getResource("doclet.navDeprecated");
deprecatedPhrase = getResource("doclet.Deprecated");
allclassesLabel = getResource("doclet.All_Classes");
+ allpackagesLabel = getResource("doclet.All_Packages");
+ allprofilesLabel = getResource("doclet.All_Profiles");
indexLabel = getResource("doclet.Index");
helpLabel = getResource("doclet.Help");
seeLabel = getResource("doclet.See");
descriptionLabel = getResource("doclet.Description");
prevpackageLabel = getResource("doclet.Prev_Package");
nextpackageLabel = getResource("doclet.Next_Package");
+ prevprofileLabel = getResource("doclet.Prev_Profile");
+ nextprofileLabel = getResource("doclet.Next_Profile");
packagesLabel = getResource("doclet.Packages");
+ profilesLabel = getResource("doclet.Profiles");
methodDetailsLabel = getResource("doclet.Method_Detail");
annotationTypeDetailsLabel = getResource("doclet.Annotation_Type_Member_Detail");
fieldDetailsLabel = getResource("doclet.Field_Detail");
diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Wed Jul 05 18:37:13 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Mon Jan 21 00:45:35 2013 -0500
@@ -4,7 +4,9 @@
doclet.Window_Overview=Overview List
doclet.Window_Overview_Summary=Overview
doclet.Package=Package
+doclet.Profile=Profile
doclet.All_Packages=All Packages
+doclet.All_Profiles=All Profiles
doclet.Tree=Tree
doclet.Class_Hierarchy=Class Hierarchy
doclet.Window_Class_Hierarchy=Class Hierarchy
@@ -17,6 +19,8 @@
doclet.Next_Class=Next Class
doclet.Prev_Package=Prev Package
doclet.Next_Package=Next Package
+doclet.Prev_Profile=Prev Profile
+doclet.Next_Profile=Next Profile
doclet.Prev_Letter=Prev Letter
doclet.Next_Letter=Next Letter
doclet.Href_Class_Title=class in {0}
diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java Wed Jul 05 18:37:13 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java Mon Jan 21 00:45:35 2013 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -28,8 +28,6 @@
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.builders.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
-import java.io.File;
-import java.util.StringTokenizer;
/**
* An abstract implementation of a Doclet.
@@ -128,6 +126,7 @@
PackageListWriter.generate(configuration);
generatePackageFiles(classtree);
+ generateProfileFiles();
generateOtherFiles(root, classtree);
configuration.tagletManager.printReport();
@@ -148,6 +147,12 @@
}
/**
+ * Generate the profile documentation.
+ *
+ */
+ protected abstract void generateProfileFiles() throws Exception;
+
+ /**
* Generate the package documentation.
*
* @param classtree the data structure representing the class tree.
diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Wed Jul 05 18:37:13 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Mon Jan 21 00:45:35 2013 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -29,6 +29,8 @@
import java.util.*;
import com.sun.javadoc.*;
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.javac.jvm.Profile;
import com.sun.tools.doclets.internal.toolkit.builders.BuilderFactory;
import com.sun.tools.doclets.internal.toolkit.taglets.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -188,6 +190,17 @@
public String sourcepath = "";
/**
+ * Argument for command line option "-Xprofilespath".
+ */
+ public String profilespath = "";
+
+ /**
+ * Generate profiles documentation if profilespath is set and valid profiles
+ * are present.
+ */
+ public boolean showProfiles = false;
+
+ /**
* Don't generate deprecated API information at all, if -nodeprecated
* option is used. 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.
+ *
+ * @author Bhavesh Patel
+ */
+
+public interface ProfilePackageSummaryWriter {
+
+ /**
+ * Get the header for the summary.
+ *
+ * @param heading Package name.
+ * @return the header to be added to the content tree
+ */
+ public abstract Content getPackageHeader(String heading);
+
+ /**
+ * Get the header for the content.
+ *
+ * @return a content tree for the content header
+ */
+ public abstract Content getContentHeader();
+
+ /**
+ * Get the header for the package summary.
+ *
+ * @return a content tree with the package summary header
+ */
+ public abstract Content getSummaryHeader();
+
+ /**
+ * Adds the table of classes to the documentation tree.
+ *
+ * @param classes the array of classes to document.
+ * @param label the label for this table.
+ * @param tableSummary the summary string for the table
+ * @param tableHeader array of table headers
+ * @param summaryContentTree the content tree to which the summaries will be added
+ */
+ public abstract void addClassesSummary(ClassDoc[] classes, String label,
+ String tableSummary, String[] tableHeader, Content summaryContentTree);
+
+ /**
+ * Adds the package description from the "packages.html" file to the documentation
+ * tree.
+ *
+ * @param packageContentTree the content tree to which the package description
+ * will be added
+ */
+ public abstract void addPackageDescription(Content packageContentTree);
+
+ /**
+ * Adds the tag information from the "packages.html" file to the documentation
+ * tree.
+ *
+ * @param packageContentTree the content tree to which the package tags will
+ * be added
+ */
+ public abstract void addPackageTags(Content packageContentTree);
+
+ /**
+ * Adds the footer to the documentation tree.
+ *
+ * @param contentTree the tree to which the footer will be added
+ */
+ public abstract void addPackageFooter(Content contentTree);
+
+ /**
+ * Print the package summary document.
+ *
+ * @param contentTree the content tree that will be printed
+ */
+ public abstract void printDocument(Content contentTree) throws IOException;
+
+ /**
+ * Close the writer.
+ */
+ public abstract void close() throws IOException;
+
+}
diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ProfileSummaryWriter.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ProfileSummaryWriter.java Mon Jan 21 00:45:35 2013 -0500
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2013, 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 com.sun.tools.doclets.internal.toolkit;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+
+/**
+ * The interface for writing profile summary output.
+ *
+ * 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.
+ *
+ * @author Bhavesh Patel
+ */
+
+public interface ProfileSummaryWriter {
+
+ /**
+ * Get the header for the summary.
+ *
+ * @param heading profile name.
+ * @return the header to be added to the content tree
+ */
+ public abstract Content getProfileHeader(String heading);
+
+ /**
+ * Get the header for the profile content.
+ *
+ * @return a content tree for the profile content header
+ */
+ public abstract Content getContentHeader();
+
+ /**
+ * Get the header for the summary header.
+ *
+ * @return a content tree with the summary header
+ */
+ public abstract Content getSummaryHeader();
+
+ /**
+ * Get the header for the summary tree.
+ *
+ * @param summaryContentTree the content tree.
+ * @return a content tree with the summary tree
+ */
+ public abstract Content getSummaryTree(Content summaryContentTree);
+
+ /**
+ * Get the header for the package summary header.
+ *
+ * @return a content tree with the package summary header
+ */
+ public abstract Content getPackageSummaryHeader(PackageDoc pkg);
+
+ /**
+ * Get the header for the package summary tree.
+ *
+ * @return a content tree with the package summary
+ */
+ public abstract Content getPackageSummaryTree(Content packageSummaryContentTree);
+
+ /**
+ * Adds the table of classes to the documentation tree.
+ *
+ * @param classes the array of classes to document.
+ * @param label the label for this table.
+ * @param tableSummary the summary string for the table
+ * @param tableHeader array of table headers
+ * @param packageSummaryContentTree the content tree to which the summaries will be added
+ */
+ public abstract void addClassesSummary(ClassDoc[] classes, String label,
+ String tableSummary, String[] tableHeader, Content packageSummaryContentTree);
+
+ /**
+ * Adds the footer to the documentation tree.
+ *
+ * @param contentTree the tree to which the footer will be added
+ */
+ public abstract void addProfileFooter(Content contentTree);
+
+ /**
+ * Print the profile summary document.
+ *
+ * @param contentTree the content tree that will be printed
+ */
+ public abstract void printDocument(Content contentTree) throws IOException;
+
+ /**
+ * Close the writer.
+ */
+ public abstract void close() throws IOException;
+
+}
diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java Wed Jul 05 18:37:13 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java Mon Jan 21 00:45:35 2013 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -26,6 +26,7 @@
package com.sun.tools.doclets.internal.toolkit;
import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
import com.sun.tools.doclets.internal.toolkit.util.*;
/**
@@ -65,6 +66,33 @@
throws Exception;
/**
+ * Return the writer for the profile summary.
+ *
+ * @param profile the profile being documented.
+ * @param prevProfile the previous profile that was documented.
+ * @param nextProfile the next profile being documented.
+ * @return the writer for the profile summary. Return null if this
+ * writer is not supported by the doclet.
+ */
+ public abstract ProfileSummaryWriter getProfileSummaryWriter(Profile
+ profile, Profile prevProfile, Profile nextProfile)
+ throws Exception;
+
+ /**
+ * Return the writer for the profile package summary.
+ *
+ * @param packageDoc the profile package being documented.
+ * @param prevPkg the previous profile package that was documented.
+ * @param nextPkg the next profile package being documented.
+ * @param profile the profile being documented.
+ * @return the writer for the profile package summary. Return null if this
+ * writer is not supported by the doclet.
+ */
+ public abstract ProfilePackageSummaryWriter getProfilePackageSummaryWriter(
+ PackageDoc packageDoc, PackageDoc prevPkg, PackageDoc nextPkg,
+ Profile profile) throws Exception;
+
+ /**
* Return the writer for a class.
*
* @param classDoc the class being documented.
diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java Wed Jul 05 18:37:13 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java Mon Jan 21 00:45:35 2013 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -29,6 +29,7 @@
import java.util.Set;
import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -96,6 +97,36 @@
}
/**
+ * Return the builder that builds the profile summary.
+ *
+ * @param profile the profile being documented.
+ * @param prevProfile the previous profile being documented.
+ * @param nextProfile the next profile being documented.
+ * @return the builder that builds the profile summary.
+ */
+ public AbstractBuilder getProfileSummaryBuilder(Profile profile, Profile prevProfile,
+ Profile nextProfile) throws Exception {
+ return ProfileSummaryBuilder.getInstance(context, profile,
+ writerFactory.getProfileSummaryWriter(profile, prevProfile, nextProfile));
+ }
+
+ /**
+ * Return the builder that builds the profile package summary.
+ *
+ * @param pkg the profile package being documented.
+ * @param prevPkg the previous profile package being documented.
+ * @param nextPkg the next profile package being documented.
+ * @param profile the profile being documented.
+ * @return the builder that builds the profile package summary.
+ */
+ public AbstractBuilder getProfilePackageSummaryBuilder(PackageDoc pkg, PackageDoc prevPkg,
+ PackageDoc nextPkg, Profile profile) throws Exception {
+ return ProfilePackageSummaryBuilder.getInstance(context, pkg,
+ writerFactory.getProfilePackageSummaryWriter(pkg, prevPkg, nextPkg,
+ profile), profile);
+ }
+
+ /**
* Return the builder for the class.
*
* @param classDoc the class being documented.
diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java Mon Jan 21 00:45:35 2013 -0500
@@ -0,0 +1,374 @@
+/*
+ * Copyright (c) 2013, 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 com.sun.tools.doclets.internal.toolkit.builders;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Builds the summary for a given profile package.
+ *
+ * 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.
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfilePackageSummaryBuilder extends AbstractBuilder {
+ /**
+ * The root element of the profile package summary XML is {@value}.
+ */
+ public static final String ROOT = "PackageDoc";
+
+ /**
+ * The profile package being documented.
+ */
+ private final PackageDoc packageDoc;
+
+ /**
+ * The name of the profile being documented.
+ */
+ private final String profileName;
+
+ /**
+ * The value of the profile being documented.
+ */
+ private final int profileValue;
+
+ /**
+ * The doclet specific writer that will output the result.
+ */
+ private final ProfilePackageSummaryWriter profilePackageWriter;
+
+ /**
+ * The content that will be added to the profile package summary documentation tree.
+ */
+ private Content contentTree;
+
+ /**
+ * Construct a new ProfilePackageSummaryBuilder.
+ *
+ * @param context the build context.
+ * @param pkg the profile package being documented.
+ * @param profilePackageWriter the doclet specific writer that will output the
+ * result.
+ * @param profile the profile being documented.
+ */
+ private ProfilePackageSummaryBuilder(Context context,
+ PackageDoc pkg, ProfilePackageSummaryWriter profilePackageWriter,
+ Profile profile) {
+ super(context);
+ this.packageDoc = pkg;
+ this.profilePackageWriter = profilePackageWriter;
+ this.profileName = profile.name;
+ this.profileValue = profile.value;
+ }
+
+ /**
+ * Construct a new ProfilePackageSummaryBuilder.
+ *
+ * @param context the build context.
+ * @param pkg the profile package being documented.
+ * @param profilePackageWriter the doclet specific writer that will output the
+ * result.
+ * @param profile the profile being documented.
+ *
+ * @return an instance of a ProfilePackageSummaryBuilder.
+ */
+ public static ProfilePackageSummaryBuilder getInstance(Context context,
+ PackageDoc pkg, ProfilePackageSummaryWriter profilePackageWriter,
+ Profile profile) {
+ return new ProfilePackageSummaryBuilder(context, pkg, profilePackageWriter,
+ profile);
+ }
+
+ /**
+ * Build the profile package summary.
+ */
+ public void build() throws IOException {
+ if (profilePackageWriter == null) {
+ //Doclet does not support this output.
+ return;
+ }
+ build(layoutParser.parseXML(ROOT), contentTree);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return ROOT;
+ }
+
+ /**
+ * Build the profile package documentation.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param contentTree the content tree to which the documentation will be added
+ */
+ public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception {
+ contentTree = profilePackageWriter.getPackageHeader(
+ Util.getPackageName(packageDoc));
+ buildChildren(node, contentTree);
+ profilePackageWriter.addPackageFooter(contentTree);
+ profilePackageWriter.printDocument(contentTree);
+ profilePackageWriter.close();
+ Util.copyDocFiles(configuration, packageDoc);
+ }
+
+ /**
+ * Build the content for the profile package doc.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param contentTree the content tree to which the package contents
+ * will be added
+ */
+ public void buildContent(XMLNode node, Content contentTree) {
+ Content packageContentTree = profilePackageWriter.getContentHeader();
+ buildChildren(node, packageContentTree);
+ contentTree.addContent(packageContentTree);
+ }
+
+ /**
+ * Build the profile package summary.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param packageContentTree the package content tree to which the summaries will
+ * be added
+ */
+ public void buildSummary(XMLNode node, Content packageContentTree) {
+ Content summaryContentTree = profilePackageWriter.getSummaryHeader();
+ buildChildren(node, summaryContentTree);
+ packageContentTree.addContent(summaryContentTree);
+ }
+
+ /**
+ * Build the summary for the interfaces in this package.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param summaryContentTree the summary tree to which the interface summary
+ * will be added
+ */
+ public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) {
+ String interfaceTableSummary =
+ configuration.getText("doclet.Member_Table_Summary",
+ configuration.getText("doclet.Interface_Summary"),
+ configuration.getText("doclet.interfaces"));
+ String[] interfaceTableHeader = new String[] {
+ configuration.getText("doclet.Interface"),
+ configuration.getText("doclet.Description")
+ };
+ ClassDoc[] interfaces =
+ packageDoc.isIncluded()
+ ? packageDoc.interfaces()
+ : configuration.classDocCatalog.interfaces(
+ Util.getPackageName(packageDoc));
+ if (interfaces.length > 0) {
+ profilePackageWriter.addClassesSummary(
+ interfaces,
+ configuration.getText("doclet.Interface_Summary"),
+ interfaceTableSummary, interfaceTableHeader, summaryContentTree);
+ }
+ }
+
+ /**
+ * Build the summary for the classes in this package.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param summaryContentTree the summary tree to which the class summary will
+ * be added
+ */
+ public void buildClassSummary(XMLNode node, Content summaryContentTree) {
+ String classTableSummary =
+ configuration.getText("doclet.Member_Table_Summary",
+ configuration.getText("doclet.Class_Summary"),
+ configuration.getText("doclet.classes"));
+ String[] classTableHeader = new String[] {
+ configuration.getText("doclet.Class"),
+ configuration.getText("doclet.Description")
+ };
+ ClassDoc[] classes =
+ packageDoc.isIncluded()
+ ? packageDoc.ordinaryClasses()
+ : configuration.classDocCatalog.ordinaryClasses(
+ Util.getPackageName(packageDoc));
+ if (classes.length > 0) {
+ profilePackageWriter.addClassesSummary(
+ classes,
+ configuration.getText("doclet.Class_Summary"),
+ classTableSummary, classTableHeader, summaryContentTree);
+ }
+ }
+
+ /**
+ * Build the summary for the enums in this package.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param summaryContentTree the summary tree to which the enum summary will
+ * be added
+ */
+ public void buildEnumSummary(XMLNode node, Content summaryContentTree) {
+ String enumTableSummary =
+ configuration.getText("doclet.Member_Table_Summary",
+ configuration.getText("doclet.Enum_Summary"),
+ configuration.getText("doclet.enums"));
+ String[] enumTableHeader = new String[] {
+ configuration.getText("doclet.Enum"),
+ configuration.getText("doclet.Description")
+ };
+ ClassDoc[] enums =
+ packageDoc.isIncluded()
+ ? packageDoc.enums()
+ : configuration.classDocCatalog.enums(
+ Util.getPackageName(packageDoc));
+ if (enums.length > 0) {
+ profilePackageWriter.addClassesSummary(
+ enums,
+ configuration.getText("doclet.Enum_Summary"),
+ enumTableSummary, enumTableHeader, summaryContentTree);
+ }
+ }
+
+ /**
+ * Build the summary for the exceptions in this package.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param summaryContentTree the summary tree to which the exception summary will
+ * be added
+ */
+ public void buildExceptionSummary(XMLNode node, Content summaryContentTree) {
+ String exceptionTableSummary =
+ configuration.getText("doclet.Member_Table_Summary",
+ configuration.getText("doclet.Exception_Summary"),
+ configuration.getText("doclet.exceptions"));
+ String[] exceptionTableHeader = new String[] {
+ configuration.getText("doclet.Exception"),
+ configuration.getText("doclet.Description")
+ };
+ ClassDoc[] exceptions =
+ packageDoc.isIncluded()
+ ? packageDoc.exceptions()
+ : configuration.classDocCatalog.exceptions(
+ Util.getPackageName(packageDoc));
+ if (exceptions.length > 0) {
+ profilePackageWriter.addClassesSummary(
+ exceptions,
+ configuration.getText("doclet.Exception_Summary"),
+ exceptionTableSummary, exceptionTableHeader, summaryContentTree);
+ }
+ }
+
+ /**
+ * Build the summary for the errors in this package.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param summaryContentTree the summary tree to which the error summary will
+ * be added
+ */
+ public void buildErrorSummary(XMLNode node, Content summaryContentTree) {
+ String errorTableSummary =
+ configuration.getText("doclet.Member_Table_Summary",
+ configuration.getText("doclet.Error_Summary"),
+ configuration.getText("doclet.errors"));
+ String[] errorTableHeader = new String[] {
+ configuration.getText("doclet.Error"),
+ configuration.getText("doclet.Description")
+ };
+ ClassDoc[] errors =
+ packageDoc.isIncluded()
+ ? packageDoc.errors()
+ : configuration.classDocCatalog.errors(
+ Util.getPackageName(packageDoc));
+ if (errors.length > 0) {
+ profilePackageWriter.addClassesSummary(
+ errors,
+ configuration.getText("doclet.Error_Summary"),
+ errorTableSummary, errorTableHeader, summaryContentTree);
+ }
+ }
+
+ /**
+ * Build the summary for the annotation type in this package.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param summaryContentTree the summary tree to which the annotation type
+ * summary will be added
+ */
+ public void buildAnnotationTypeSummary(XMLNode node, Content summaryContentTree) {
+ String annotationtypeTableSummary =
+ configuration.getText("doclet.Member_Table_Summary",
+ configuration.getText("doclet.Annotation_Types_Summary"),
+ configuration.getText("doclet.annotationtypes"));
+ String[] annotationtypeTableHeader = new String[] {
+ configuration.getText("doclet.AnnotationType"),
+ configuration.getText("doclet.Description")
+ };
+ ClassDoc[] annotationTypes =
+ packageDoc.isIncluded()
+ ? packageDoc.annotationTypes()
+ : configuration.classDocCatalog.annotationTypes(
+ Util.getPackageName(packageDoc));
+ if (annotationTypes.length > 0) {
+ profilePackageWriter.addClassesSummary(
+ annotationTypes,
+ configuration.getText("doclet.Annotation_Types_Summary"),
+ annotationtypeTableSummary, annotationtypeTableHeader,
+ summaryContentTree);
+ }
+ }
+
+ /**
+ * Build the description of the summary.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param packageContentTree the tree to which the package description will
+ * be added
+ */
+ public void buildPackageDescription(XMLNode node, Content packageContentTree) {
+ if (configuration.nocomment) {
+ return;
+ }
+ profilePackageWriter.addPackageDescription(packageContentTree);
+ }
+
+ /**
+ * Build the tags of the summary.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param packageContentTree the tree to which the package tags will be added
+ */
+ public void buildPackageTags(XMLNode node, Content packageContentTree) {
+ if (configuration.nocomment) {
+ return;
+ }
+ profilePackageWriter.addPackageTags(packageContentTree);
+ }
+}
diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java Mon Jan 21 00:45:35 2013 -0500
@@ -0,0 +1,328 @@
+/*
+ * Copyright (c) 2013, 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 com.sun.tools.doclets.internal.toolkit.builders;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Builds the summary for a given profile.
+ *
+ * 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.
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfileSummaryBuilder extends AbstractBuilder {
+ /**
+ * The root element of the profile summary XML is {@value}.
+ */
+ public static final String ROOT = "ProfileDoc";
+
+ /**
+ * The profile being documented.
+ */
+ private final Profile profile;
+
+ /**
+ * The doclet specific writer that will output the result.
+ */
+ private final ProfileSummaryWriter profileWriter;
+
+ /**
+ * The content that will be added to the profile summary documentation tree.
+ */
+ private Content contentTree;
+
+ /**
+ * The profile package being documented.
+ */
+ private PackageDoc pkg;
+
+ /**
+ * Construct a new ProfileSummaryBuilder.
+ *
+ * @param context the build context.
+ * @param profile the profile being documented.
+ * @param profileWriter the doclet specific writer that will output the
+ * result.
+ */
+ private ProfileSummaryBuilder(Context context,
+ Profile profile, ProfileSummaryWriter profileWriter) {
+ super(context);
+ this.profile = profile;
+ this.profileWriter = profileWriter;
+ }
+
+ /**
+ * Construct a new ProfileSummaryBuilder.
+ *
+ * @param context the build context.
+ * @param profile the profile being documented.
+ * @param profileWriter the doclet specific writer that will output the
+ * result.
+ *
+ * @return an instance of a ProfileSummaryBuilder.
+ */
+ public static ProfileSummaryBuilder getInstance(Context context,
+ Profile profile, ProfileSummaryWriter profileWriter) {
+ return new ProfileSummaryBuilder(context, profile, profileWriter);
+ }
+
+ /**
+ * Build the profile summary.
+ */
+ public void build() throws IOException {
+ if (profileWriter == null) {
+ //Doclet does not support this output.
+ return;
+ }
+ build(layoutParser.parseXML(ROOT), contentTree);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return ROOT;
+ }
+
+ /**
+ * Build the profile documentation.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param contentTree the content tree to which the documentation will be added
+ */
+ public void buildProfileDoc(XMLNode node, Content contentTree) throws Exception {
+ contentTree = profileWriter.getProfileHeader(profile.name);
+ buildChildren(node, contentTree);
+ profileWriter.addProfileFooter(contentTree);
+ profileWriter.printDocument(contentTree);
+ profileWriter.close();
+ Util.copyDocFiles(configuration, DocPaths.profileSummary(profile.name));
+ }
+
+ /**
+ * Build the content for the profile doc.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param contentTree the content tree to which the profile contents
+ * will be added
+ */
+ public void buildContent(XMLNode node, Content contentTree) {
+ Content profileContentTree = profileWriter.getContentHeader();
+ buildChildren(node, profileContentTree);
+ contentTree.addContent(profileContentTree);
+ }
+
+ /**
+ * Build the profile summary.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param profileContentTree the profile content tree to which the summaries will
+ * be added
+ */
+ public void buildSummary(XMLNode node, Content profileContentTree) {
+ Content summaryContentTree = profileWriter.getSummaryHeader();
+ buildChildren(node, summaryContentTree);
+ profileContentTree.addContent(profileWriter.getSummaryTree(summaryContentTree));
+ }
+
+ /**
+ * Build the profile package summary.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param summaryContentTree the content tree to which the summaries will
+ * be added
+ */
+ public void buildPackageSummary(XMLNode node, Content summaryContentTree) {
+ PackageDoc[] packages = configuration.profilePackages.get(profile.name);
+ for (int i = 0; i < packages.length; i++) {
+ this.pkg = packages[i];
+ Content packageSummaryContentTree = profileWriter.getPackageSummaryHeader(this.pkg);
+ buildChildren(node, packageSummaryContentTree);
+ summaryContentTree.addContent(profileWriter.getPackageSummaryTree(
+ packageSummaryContentTree));
+ }
+ }
+
+ /**
+ * Build the summary for the interfaces in the package.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param packageSummaryContentTree the tree to which the interface summary
+ * will be added
+ */
+ public void buildInterfaceSummary(XMLNode node, Content packageSummaryContentTree) {
+ String interfaceTableSummary =
+ configuration.getText("doclet.Member_Table_Summary",
+ configuration.getText("doclet.Interface_Summary"),
+ configuration.getText("doclet.interfaces"));
+ String[] interfaceTableHeader = new String[] {
+ configuration.getText("doclet.Interface"),
+ configuration.getText("doclet.Description")
+ };
+ ClassDoc[] interfaces = pkg.interfaces();
+ if (interfaces.length > 0) {
+ profileWriter.addClassesSummary(
+ interfaces,
+ configuration.getText("doclet.Interface_Summary"),
+ interfaceTableSummary, interfaceTableHeader, packageSummaryContentTree);
+ }
+ }
+
+ /**
+ * Build the summary for the classes in the package.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param packageSummaryContentTree the tree to which the class summary will
+ * be added
+ */
+ public void buildClassSummary(XMLNode node, Content packageSummaryContentTree) {
+ String classTableSummary =
+ configuration.getText("doclet.Member_Table_Summary",
+ configuration.getText("doclet.Class_Summary"),
+ configuration.getText("doclet.classes"));
+ String[] classTableHeader = new String[] {
+ configuration.getText("doclet.Class"),
+ configuration.getText("doclet.Description")
+ };
+ ClassDoc[] classes = pkg.ordinaryClasses();
+ if (classes.length > 0) {
+ profileWriter.addClassesSummary(
+ classes,
+ configuration.getText("doclet.Class_Summary"),
+ classTableSummary, classTableHeader, packageSummaryContentTree);
+ }
+ }
+
+ /**
+ * Build the summary for the enums in the package.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param packageSummaryContentTree the tree to which the enum summary will
+ * be added
+ */
+ public void buildEnumSummary(XMLNode node, Content packageSummaryContentTree) {
+ String enumTableSummary =
+ configuration.getText("doclet.Member_Table_Summary",
+ configuration.getText("doclet.Enum_Summary"),
+ configuration.getText("doclet.enums"));
+ String[] enumTableHeader = new String[] {
+ configuration.getText("doclet.Enum"),
+ configuration.getText("doclet.Description")
+ };
+ ClassDoc[] enums = pkg.enums();
+ if (enums.length > 0) {
+ profileWriter.addClassesSummary(
+ enums,
+ configuration.getText("doclet.Enum_Summary"),
+ enumTableSummary, enumTableHeader, packageSummaryContentTree);
+ }
+ }
+
+ /**
+ * Build the summary for the exceptions in the package.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param packageSummaryContentTree the tree to which the exception summary will
+ * be added
+ */
+ public void buildExceptionSummary(XMLNode node, Content packageSummaryContentTree) {
+ String exceptionTableSummary =
+ configuration.getText("doclet.Member_Table_Summary",
+ configuration.getText("doclet.Exception_Summary"),
+ configuration.getText("doclet.exceptions"));
+ String[] exceptionTableHeader = new String[] {
+ configuration.getText("doclet.Exception"),
+ configuration.getText("doclet.Description")
+ };
+ ClassDoc[] exceptions = pkg.exceptions();
+ if (exceptions.length > 0) {
+ profileWriter.addClassesSummary(
+ exceptions,
+ configuration.getText("doclet.Exception_Summary"),
+ exceptionTableSummary, exceptionTableHeader, packageSummaryContentTree);
+ }
+ }
+
+ /**
+ * Build the summary for the errors in the package.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param packageSummaryContentTree the tree to which the error summary will
+ * be added
+ */
+ public void buildErrorSummary(XMLNode node, Content packageSummaryContentTree) {
+ String errorTableSummary =
+ configuration.getText("doclet.Member_Table_Summary",
+ configuration.getText("doclet.Error_Summary"),
+ configuration.getText("doclet.errors"));
+ String[] errorTableHeader = new String[] {
+ configuration.getText("doclet.Error"),
+ configuration.getText("doclet.Description")
+ };
+ ClassDoc[] errors = pkg.errors();
+ if (errors.length > 0) {
+ profileWriter.addClassesSummary(
+ errors,
+ configuration.getText("doclet.Error_Summary"),
+ errorTableSummary, errorTableHeader, packageSummaryContentTree);
+ }
+ }
+
+ /**
+ * Build the summary for the annotation type in the package.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param packageSummaryContentTree the tree to which the annotation type
+ * summary will be added
+ */
+ public void buildAnnotationTypeSummary(XMLNode node, Content packageSummaryContentTree) {
+ String annotationtypeTableSummary =
+ configuration.getText("doclet.Member_Table_Summary",
+ configuration.getText("doclet.Annotation_Types_Summary"),
+ configuration.getText("doclet.annotationtypes"));
+ String[] annotationtypeTableHeader = new String[] {
+ configuration.getText("doclet.AnnotationType"),
+ configuration.getText("doclet.Description")
+ };
+ ClassDoc[] annotationTypes = pkg.annotationTypes();
+ if (annotationTypes.length > 0) {
+ profileWriter.addClassesSummary(
+ annotationTypes,
+ configuration.getText("doclet.Annotation_Types_Summary"),
+ annotationtypeTableSummary, annotationtypeTableHeader,
+ packageSummaryContentTree);
+ }
+ }
+}
diff -r f627eff81962 -r 58a73dac9ee4 langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml Wed Jul 05 18:37:13 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml Mon Jan 21 00:45:35 2013 -0500
@@ -28,6 +28,21 @@
nodepracted
is set to true if
* -nodeprecated option is used. Default is generate deprected API
@@ -247,6 +260,16 @@
public abstract MessageRetriever getDocletSpecificMsg();
/**
+ * A profiles object used to access profiles across various pages.
+ */
+ public Profiles profiles;
+
+ /**
+ * An map of the profiles to packages.
+ */
+ public MapProfile compact2
"
+ },
+ {PROFILE_BUG_ID + FS + "compact2-summary.html",
+ "pkg2
"
+ },
+ // Tests for profileName-package-summary.html listing the summary for a
+ // package in a profile.
+ {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
+ "Packages
"
+ },
+ {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-frame.html",
+ "pkg4
"
+ },
+ {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-summary.html",
+ "Package pkg4
" + NL + "Profile compact2
"
+ },
+ {PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
+ "