8006124: javadoc/doclet should be updated to support profiles

Reviewed-by: jjg
This commit is contained in:
Bhavesh Patel 2013-01-21 00:45:35 -05:00
parent 75c48b0d1b
commit bd4ebc07d8
46 changed files with 3563 additions and 30 deletions

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -150,7 +150,20 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
String tableSummary, Content body) { String tableSummary, Content body) {
if (packages.length > 0) { if (packages.length > 0) {
Arrays.sort(packages); 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); addPackagesList(packages, text, tableSummary, body);
} }
} }
@ -182,10 +195,29 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
} }
/** /**
* Do nothing. This will be overridden in PackageIndexFrameWriter. * 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 classes link will be added
*/ */
protected void addAllClassesLink(Content body) { protected void addAllClassesLink(Content div) {
}
/**
* Do nothing. This will be overridden.
*
* @param div the document tree to which the all profiles link will be added
*/
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) {
} }
} }

View file

@ -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.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*
* @author Bhavesh Patel
*/
public 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) {
}
}

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,10 +25,10 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import java.io.IOException;
import java.util.*; import java.util.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.javac.jvm.Profile;
import com.sun.tools.doclets.formats.html.markup.*; import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.builders.*; import com.sun.tools.doclets.internal.toolkit.builders.*;
@ -165,6 +165,20 @@ public class ClassWriterImpl extends SubWriterHolderWriter
bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA); bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
HtmlTree div = new HtmlTree(HtmlTag.DIV); HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.header); 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) { if (pkgname.length() > 0) {
Content pkgNameContent = new StringContent(pkgname); Content pkgNameContent = new StringContent(pkgname);
Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent); Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -135,7 +135,13 @@ public class FrameOutputWriter extends HtmlDocletWriter {
protected Content getFrameDetails() { protected Content getFrameDetails() {
HtmlTree frameset = HtmlTree.FRAMESET("20%,80%", null, "Documentation frame", HtmlTree frameset = HtmlTree.FRAMESET("20%,80%", null, "Documentation frame",
"top.loadFrames()"); "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); addAllClassesFrameTag(frameset);
} else if (noOfPackages > 1) { } else if (noOfPackages > 1) {
HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames", HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames",
@ -149,6 +155,17 @@ public class FrameOutputWriter extends HtmlDocletWriter {
return frameset; return frameset;
} }
/**
* 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. * Add the FRAME tag for the frame that lists all packages.
* *

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,8 @@ import java.io.*;
import java.util.*; import java.util.*;
import com.sun.javadoc.*; 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.*;
import com.sun.tools.doclets.internal.toolkit.builders.*; import com.sun.tools.doclets.internal.toolkit.builders.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
@ -199,6 +201,44 @@ public class HtmlDoclet extends AbstractDoclet {
} }
} }
/**
* {@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} * {@inheritDoc}
*/ */

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -300,6 +300,107 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return getHyperLink(pathString(pd, DocPaths.PACKAGE_SUMMARY), label, "", target); return getHyperLink(pathString(pd, DocPaths.PACKAGE_SUMMARY), label, "", target);
} }
/**
* 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. * Generates the HTML document tree and prints it out.
* *

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -145,13 +145,26 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
* Adds "All Classes" link for the top of the left-hand frame page to the * Adds "All Classes" link for the top of the left-hand frame page to the
* documentation tree. * 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, Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
allclassesLabel, "", "packageFrame"); allclassesLabel, "", "packageFrame");
Content div = HtmlTree.DIV(HtmlStyle.indexHeader, linkContent); Content span = HtmlTree.SPAN(linkContent);
body.addContent(div); 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);
} }
/** /**

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@ import java.io.*;
import java.util.*; import java.util.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.javac.jvm.Profile;
import com.sun.tools.doclets.formats.html.markup.*; import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
@ -119,6 +120,21 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
} }
} }
/**
* {@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} * {@inheritDoc}
*/ */
@ -134,6 +150,31 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
body.addContent(div); body.addContent(div);
} }
/**
* 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. * Adds list of packages in the index table. Generate link to each package.
* *

View file

@ -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.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*
* @author Bhavesh Patel
*/
public class 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) {
}
}

View file

@ -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.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*
* @author Bhavesh Patel
*/
public class 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);
}
}
}

View file

@ -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.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*
* @author Bhavesh Patel
*/
public class 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("&lt;unnamed package&gt;");
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);
}
}

View file

@ -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.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*
* @author Bhavesh Patel
*/
public class 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;
}
}

View file

@ -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.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*
* @author Bhavesh Patel
*/
public class 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;
}
}

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@ package com.sun.tools.doclets.formats.html;
import java.io.IOException; import java.io.IOException;
import com.sun.javadoc.*; 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.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
@ -66,6 +67,24 @@ public class WriterFactoryImpl implements WriterFactory {
prevPkg, nextPkg); prevPkg, nextPkg);
} }
/**
* {@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} * {@inheritDoc}
*/ */

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -167,6 +167,11 @@ public class HtmlConstants {
*/ */
public static final HtmlTag PACKAGE_HEADING = HtmlTag.H2; 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. * Html tag for the member summary heading.
*/ */

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -62,6 +62,11 @@ public class HtmlWriter {
*/ */
protected boolean memberDetailsListPrinted; protected boolean memberDetailsListPrinted;
/**
* Header for table displaying profiles and description..
*/
protected final String[] profileTableHeader;
/** /**
* Header for tables displaying packages and description.. * Header for tables displaying packages and description..
*/ */
@ -83,6 +88,8 @@ public class HtmlWriter {
public final Content packageLabel; public final Content packageLabel;
public final Content profileLabel;
public final Content useLabel; public final Content useLabel;
public final Content prevLabel; public final Content prevLabel;
@ -111,6 +118,10 @@ public class HtmlWriter {
public final Content allclassesLabel; public final Content allclassesLabel;
public final Content allpackagesLabel;
public final Content allprofilesLabel;
public final Content indexLabel; public final Content indexLabel;
public final Content helpLabel; public final Content helpLabel;
@ -123,8 +134,14 @@ public class HtmlWriter {
public final Content nextpackageLabel; public final Content nextpackageLabel;
public final Content prevprofileLabel;
public final Content nextprofileLabel;
public final Content packagesLabel; public final Content packagesLabel;
public final Content profilesLabel;
public final Content methodDetailsLabel; public final Content methodDetailsLabel;
public final Content annotationTypeDetailsLabel; public final Content annotationTypeDetailsLabel;
@ -162,6 +179,10 @@ public class HtmlWriter {
writer = DocFile.createFileForOutput(configuration, path).openWriter(); writer = DocFile.createFileForOutput(configuration, path).openWriter();
this.configuration = configuration; this.configuration = configuration;
this.memberDetailsListPrinted = false; this.memberDetailsListPrinted = false;
profileTableHeader = new String[] {
configuration.getText("doclet.Profile"),
configuration.getText("doclet.Description")
};
packageTableHeader = new String[] { packageTableHeader = new String[] {
configuration.getText("doclet.Package"), configuration.getText("doclet.Package"),
configuration.getText("doclet.Description") configuration.getText("doclet.Description")
@ -175,6 +196,7 @@ public class HtmlWriter {
defaultPackageLabel = new RawHtml( defaultPackageLabel = new RawHtml(
DocletConstants.DEFAULT_PACKAGE_NAME); DocletConstants.DEFAULT_PACKAGE_NAME);
packageLabel = getResource("doclet.Package"); packageLabel = getResource("doclet.Package");
profileLabel = getResource("doclet.Profile");
useLabel = getResource("doclet.navClassUse"); useLabel = getResource("doclet.navClassUse");
prevLabel = getResource("doclet.Prev"); prevLabel = getResource("doclet.Prev");
nextLabel = getResource("doclet.Next"); nextLabel = getResource("doclet.Next");
@ -189,13 +211,18 @@ public class HtmlWriter {
deprecatedLabel = getResource("doclet.navDeprecated"); deprecatedLabel = getResource("doclet.navDeprecated");
deprecatedPhrase = getResource("doclet.Deprecated"); deprecatedPhrase = getResource("doclet.Deprecated");
allclassesLabel = getResource("doclet.All_Classes"); allclassesLabel = getResource("doclet.All_Classes");
allpackagesLabel = getResource("doclet.All_Packages");
allprofilesLabel = getResource("doclet.All_Profiles");
indexLabel = getResource("doclet.Index"); indexLabel = getResource("doclet.Index");
helpLabel = getResource("doclet.Help"); helpLabel = getResource("doclet.Help");
seeLabel = getResource("doclet.See"); seeLabel = getResource("doclet.See");
descriptionLabel = getResource("doclet.Description"); descriptionLabel = getResource("doclet.Description");
prevpackageLabel = getResource("doclet.Prev_Package"); prevpackageLabel = getResource("doclet.Prev_Package");
nextpackageLabel = getResource("doclet.Next_Package"); nextpackageLabel = getResource("doclet.Next_Package");
prevprofileLabel = getResource("doclet.Prev_Profile");
nextprofileLabel = getResource("doclet.Next_Profile");
packagesLabel = getResource("doclet.Packages"); packagesLabel = getResource("doclet.Packages");
profilesLabel = getResource("doclet.Profiles");
methodDetailsLabel = getResource("doclet.Method_Detail"); methodDetailsLabel = getResource("doclet.Method_Detail");
annotationTypeDetailsLabel = getResource("doclet.Annotation_Type_Member_Detail"); annotationTypeDetailsLabel = getResource("doclet.Annotation_Type_Member_Detail");
fieldDetailsLabel = getResource("doclet.Field_Detail"); fieldDetailsLabel = getResource("doclet.Field_Detail");

View file

@ -4,7 +4,9 @@ doclet.Overview=Overview
doclet.Window_Overview=Overview List doclet.Window_Overview=Overview List
doclet.Window_Overview_Summary=Overview doclet.Window_Overview_Summary=Overview
doclet.Package=Package doclet.Package=Package
doclet.Profile=Profile
doclet.All_Packages=All Packages doclet.All_Packages=All Packages
doclet.All_Profiles=All Profiles
doclet.Tree=Tree doclet.Tree=Tree
doclet.Class_Hierarchy=Class Hierarchy doclet.Class_Hierarchy=Class Hierarchy
doclet.Window_Class_Hierarchy=Class Hierarchy doclet.Window_Class_Hierarchy=Class Hierarchy
@ -17,6 +19,8 @@ doclet.Prev_Class=Prev Class
doclet.Next_Class=Next Class doclet.Next_Class=Next Class
doclet.Prev_Package=Prev Package doclet.Prev_Package=Prev Package
doclet.Next_Package=Next Package doclet.Next_Package=Next Package
doclet.Prev_Profile=Prev Profile
doclet.Next_Profile=Next Profile
doclet.Prev_Letter=Prev Letter doclet.Prev_Letter=Prev Letter
doclet.Next_Letter=Next Letter doclet.Next_Letter=Next Letter
doclet.Href_Class_Title=class in {0} doclet.Href_Class_Title=class in {0}

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,8 +28,6 @@ package com.sun.tools.doclets.internal.toolkit;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.builders.*; import com.sun.tools.doclets.internal.toolkit.builders.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import java.io.File;
import java.util.StringTokenizer;
/** /**
* An abstract implementation of a Doclet. * An abstract implementation of a Doclet.
@ -128,6 +126,7 @@ public abstract class AbstractDoclet {
PackageListWriter.generate(configuration); PackageListWriter.generate(configuration);
generatePackageFiles(classtree); generatePackageFiles(classtree);
generateProfileFiles();
generateOtherFiles(root, classtree); generateOtherFiles(root, classtree);
configuration.tagletManager.printReport(); configuration.tagletManager.printReport();
@ -147,6 +146,12 @@ public abstract class AbstractDoclet {
serializedFormBuilder.build(); serializedFormBuilder.build();
} }
/**
* Generate the profile documentation.
*
*/
protected abstract void generateProfileFiles() throws Exception;
/** /**
* Generate the package documentation. * Generate the package documentation.
* *

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,8 @@ import java.io.*;
import java.util.*; import java.util.*;
import com.sun.javadoc.*; 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.builders.BuilderFactory;
import com.sun.tools.doclets.internal.toolkit.taglets.*; import com.sun.tools.doclets.internal.toolkit.taglets.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
@ -187,6 +189,17 @@ public abstract class Configuration {
*/ */
public String sourcepath = ""; 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 * Don't generate deprecated API information at all, if -nodeprecated
* option is used. <code>nodepracted</code> is set to true if * option is used. <code>nodepracted</code> is set to true if
@ -246,6 +259,16 @@ public abstract class Configuration {
*/ */
public abstract MessageRetriever getDocletSpecificMsg(); 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 Map<String,PackageDoc[]> profilePackages;
/** /**
* An array of the packages specified on the command-line merged * An array of the packages specified on the command-line merged
* with the array of packages that contain the classes specified on the * with the array of packages that contain the classes specified on the
@ -315,7 +338,8 @@ public abstract class Configuration {
option.equals("-sourcepath") || option.equals("-sourcepath") ||
option.equals("-tag") || option.equals("-tag") ||
option.equals("-taglet") || option.equals("-taglet") ||
option.equals("-tagletpath")) { option.equals("-tagletpath") ||
option.equals("-xprofilespath")) {
return 2; return 2;
} else if (option.equals("-group") || } else if (option.equals("-group") ||
option.equals("-linkoffline")) { option.equals("-linkoffline")) {
@ -334,6 +358,38 @@ public abstract class Configuration {
public abstract boolean validOptions(String options[][], public abstract boolean validOptions(String options[][],
DocErrorReporter reporter); DocErrorReporter reporter);
private void initProfiles() throws IOException {
profiles = Profiles.read(new File(profilespath));
// Generate profiles documentation only is profilespath is set and if
// profiles is not null and profiles count is 1 or more.
showProfiles = (!profilespath.isEmpty() && profiles != null &&
profiles.getProfileCount() > 0);
}
private void initProfilePackages() throws IOException {
profilePackages = new HashMap<String,PackageDoc[]>();
ArrayList<PackageDoc> results;
Map<String,PackageDoc> packageIndex = new HashMap<String,PackageDoc>();
for (int i = 0; i < packages.length; i++) {
PackageDoc pkg = packages[i];
packageIndex.put(pkg.name(), pkg);
}
for (int i = 1; i < profiles.getProfileCount(); i++) {
Set<String> profPkgs = profiles.getPackages(i);
results = new ArrayList<PackageDoc>();
for (String packageName : profPkgs) {
packageName = packageName.replace("/", ".");
PackageDoc profPkg = packageIndex.get(packageName);
if (profPkg != null) {
results.add(profPkg);
}
}
Collections.sort(results);
PackageDoc[] profilePkgs = results.toArray(new PackageDoc[]{});
profilePackages.put(Profile.lookup(i).name, profilePkgs);
}
}
private void initPackageArray() { private void initPackageArray() {
Set<PackageDoc> set = new HashSet<PackageDoc>(Arrays.asList(root.specifiedPackages())); Set<PackageDoc> set = new HashSet<PackageDoc>(Arrays.asList(root.specifiedPackages()));
ClassDoc[] classes = root.specifiedClasses(); ClassDoc[] classes = root.specifiedClasses();
@ -404,6 +460,8 @@ public abstract class Configuration {
customTagStrs.add(os); customTagStrs.add(os);
} else if (opt.equals("-tagletpath")) { } else if (opt.equals("-tagletpath")) {
tagletpath = os[1]; tagletpath = os[1];
} else if (opt.equals("-xprofilespath")) {
profilespath = os[1];
} else if (opt.equals("-keywords")) { } else if (opt.equals("-keywords")) {
keywords = true; keywords = true;
} else if (opt.equals("-serialwarn")) { } else if (opt.equals("-serialwarn")) {
@ -439,6 +497,14 @@ public abstract class Configuration {
public void setOptions() { public void setOptions() {
initPackageArray(); initPackageArray();
setOptions(root.options()); setOptions(root.options());
if (!profilespath.isEmpty()) {
try {
initProfiles();
initProfilePackages();
} catch (Exception e) {
throw new DocletAbortException();
}
}
setSpecificDocletOptions(root.options()); setSpecificDocletOptions(root.options());
} }

View file

@ -0,0 +1,116 @@
/*
* 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 package summary output.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*
* @author Bhavesh Patel
*/
public 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;
}

View file

@ -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.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*
* @author Bhavesh Patel
*/
public 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;
}

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
package com.sun.tools.doclets.internal.toolkit; package com.sun.tools.doclets.internal.toolkit;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.javac.jvm.Profile;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
/** /**
@ -64,6 +65,33 @@ public interface WriterFactory {
packageDoc, PackageDoc prevPkg, PackageDoc nextPkg) packageDoc, PackageDoc prevPkg, PackageDoc nextPkg)
throws Exception; 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. * Return the writer for a class.
* *

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import com.sun.javadoc.*; 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.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
@ -95,6 +96,36 @@ public class BuilderFactory {
writerFactory.getPackageSummaryWriter(pkg, prevPkg, nextPkg)); writerFactory.getPackageSummaryWriter(pkg, prevPkg, nextPkg));
} }
/**
* 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. * Return the builder for the class.
* *

View file

@ -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.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*
* @author Bhavesh Patel
*/
public class 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);
}
}

View file

@ -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.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*
* @author Bhavesh Patel
*/
public class 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);
}
}
}

View file

@ -28,6 +28,21 @@
<Doclet> <Doclet>
<ProfileDoc>
<Content>
<Summary>
<PackageSummary>
<InterfaceSummary/>
<ClassSummary/>
<EnumSummary/>
<ExceptionSummary/>
<ErrorSummary/>
<AnnotationTypeSummary/>
</PackageSummary>
</Summary>
</Content>
</ProfileDoc>
<PackageDoc> <PackageDoc>
<Content> <Content>
<Summary> <Summary>

View file

@ -29,6 +29,7 @@ doclet.Building_Index=Building index for all the packages and classes...
doclet.Building_Index_For_All_Classes=Building index for all classes... doclet.Building_Index_For_All_Classes=Building index for all classes...
doclet.sourcetab_warning=The argument for -sourcetab must be an integer greater than 0. doclet.sourcetab_warning=The argument for -sourcetab must be an integer greater than 0.
doclet.Packages=Packages doclet.Packages=Packages
doclet.Profiles=Profiles
doclet.Other_Packages=Other Packages doclet.Other_Packages=Other Packages
doclet.Notice_taglet_registered=Registered Taglet {0} ... doclet.Notice_taglet_registered=Registered Taglet {0} ...
doclet.Notice_taglet_unseen=Note: Custom tags that were not seen: {0} doclet.Notice_taglet_unseen=Note: Custom tags that were not seen: {0}
@ -59,6 +60,7 @@ doclet.noInheritedDoc=@inheritDoc used but {0} does not override or implement an
doclet.malformed_html_link_tag=<a> tag is malformed:\n"{0}" doclet.malformed_html_link_tag=<a> tag is malformed:\n"{0}"
doclet.tag_misuse=Tag {0} cannot be used in {1} documentation. It can only be used in the following types of documentation: {2}. doclet.tag_misuse=Tag {0} cannot be used in {1} documentation. It can only be used in the following types of documentation: {2}.
doclet.Package_Summary=Package Summary doclet.Package_Summary=Package Summary
doclet.Profile_Summary=Profile Summary
doclet.Interface_Summary=Interface Summary doclet.Interface_Summary=Interface Summary
doclet.Annotation_Types_Summary=Annotation Types Summary doclet.Annotation_Types_Summary=Annotation Types Summary
doclet.Enum_Summary=Enum Summary doclet.Enum_Summary=Enum Summary
@ -80,6 +82,7 @@ doclet.Errors=Errors
doclet.Classes=Classes doclet.Classes=Classes
doclet.Packages=Packages doclet.Packages=Packages
doclet.packages=packages doclet.packages=packages
doclet.profiles=profiles
doclet.All_Classes=All Classes doclet.All_Classes=All Classes
doclet.All_Superinterfaces=All Superinterfaces: doclet.All_Superinterfaces=All Superinterfaces:
doclet.All_Implemented_Interfaces=All Implemented Interfaces: doclet.All_Implemented_Interfaces=All Implemented Interfaces:

View file

@ -191,6 +191,9 @@ Page header and footer styles
margin:10px; margin:10px;
position:relative; position:relative;
} }
.indexHeader span{
margin-right:15px;
}
.indexHeader h1 { .indexHeader h1 {
font-size:1.3em; font-size:1.3em;
} }

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -87,6 +87,26 @@ public class DocPaths {
/** The name of the file for the package frame. */ /** The name of the file for the package frame. */
public static final DocPath PACKAGE_FRAME = DocPath.create("package-frame.html"); public static final DocPath PACKAGE_FRAME = DocPath.create("package-frame.html");
/** The name of the file for the profile frame. */
public static final DocPath profileFrame(String profileName) {
return DocPath.create(profileName + "-frame.html");
}
/** The name of the file for the profile package frame. */
public static final DocPath profilePackageFrame(String profileName) {
return DocPath.create(profileName + "-package-frame.html");
}
/** The name of the file for the profile package summary. */
public static final DocPath profilePackageSummary(String profileName) {
return DocPath.create(profileName + "-package-summary.html");
}
/** The name of the file for the profile summary. */
public static final DocPath profileSummary(String profileName) {
return DocPath.create(profileName + "-summary.html");
}
/** The name of the file for the package list. */ /** The name of the file for the package list. */
public static final DocPath PACKAGE_LIST = DocPath.create("package-list"); public static final DocPath PACKAGE_LIST = DocPath.create("package-list");
@ -99,6 +119,9 @@ public class DocPaths {
/** The name of the file for the package usage info. */ /** The name of the file for the package usage info. */
public static final DocPath PACKAGE_USE = DocPath.create("package-use.html"); public static final DocPath PACKAGE_USE = DocPath.create("package-use.html");
/** The name of the file for the overview frame. */
public static final DocPath PROFILE_OVERVIEW_FRAME = DocPath.create("profile-overview-frame.html");
/** The name of the directory in which resources are generated. /** The name of the directory in which resources are generated.
* Also the name of the sub-package from which resources are read. * Also the name of the sub-package from which resources are read.
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@ package com.sun.tools.doclets.internal.toolkit.util;
import java.util.*; import java.util.*;
import com.sun.javadoc.*; 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.*;
/** /**
@ -104,6 +105,20 @@ public class MetaKeywords {
} }
} }
/**
* Get the profile keywords.
*
* @param profile the profile being documented
*/
public String[] getMetaKeywords(Profile profile) {
if( configuration.keywords ) {
String profileName = profile.name;
return new String[] { profileName + " " + "profile" };
} else {
return new String[] {};
}
}
/** /**
* Get the overview keywords. * Get the overview keywords.
*/ */

View file

@ -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.
*
* 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.
*/
/*
* @test
* @bug 8006124
* @summary Test javadoc support for profiles.
* @author Bhavesh Patel
* @library ../lib/
* @build JavadocTester TestProfiles
* @run main TestProfiles
*/
public class TestProfiles extends JavadocTester {
//Test information.
private static final String BUG_ID = "8006124";
private static final String PROFILE_BUG_ID = BUG_ID + "-1";
private static final String PACKAGE_BUG_ID = BUG_ID + "-2";
//Javadoc arguments.
private static final String[] ARGS1 = new String[]{
"-d", PROFILE_BUG_ID, "-sourcepath", SRC_DIR, "-Xprofilespath", SRC_DIR + FS
+ "profile-rtjar-includes.txt", "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
};
private static final String[] ARGS2 = new String[]{
"-d", PACKAGE_BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
};
//Input for string tests for profiles.
private static final String[][] PROFILES_TEST = {
// Tests for profile-overview-frame.html listing all profiles.
{PROFILE_BUG_ID + FS + "profile-overview-frame.html",
"<span><a href=\"overview-frame.html\" "
+ "target=\"profileListFrame\">All Packages</a></span>"
},
{PROFILE_BUG_ID + FS + "profile-overview-frame.html",
"<li><a href=\"compact1-frame.html\" target=\"profileListFrame\">"
+ "compact1</a></li>"
},
// Tests for profileName-frame.html listing all packages in a profile.
{PROFILE_BUG_ID + FS + "compact2-frame.html",
"<span><a href=\"overview-frame.html\" target=\"profileListFrame\">"
+ "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
+ "target=\"profileListFrame\">All Profiles</a></span>"
},
{PROFILE_BUG_ID + FS + "compact2-frame.html",
"<li><a href=\"pkg4/compact2-package-frame.html\" "
+ "target=\"packageFrame\">pkg4</a></li>"
},
// Test for profileName-package-frame.html listing all types in a
// package of a profile.
{PROFILE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
"<a href=\"../compact2-summary.html\" target=\"classFrame\">"
+ "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
+ "target=\"classFrame\">pkg2</a>"
},
// Tests for profileName-summary.html listing the summary for a profile.
{PROFILE_BUG_ID + FS + "compact2-summary.html",
"<li><a href=\"compact1-summary.html\">Prev Profile</a></li>" + NL
+ "<li><a href=\"compact3-summary.html\">Next Profile</a></li>"
},
{PROFILE_BUG_ID + FS + "compact2-summary.html",
"<h1 title=\"Profile\" class=\"title\">Profile&nbsp;compact2</h1>"
},
{PROFILE_BUG_ID + FS + "compact2-summary.html",
"<h3><a href=\"pkg2/compact2-package-summary.html\" "
+ "target=\"classFrame\">pkg2</a></h3>"
},
// 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",
"<li><a href=\"../pkg4/compact3-package-summary.html\">Prev Package"
+ "</a></li>"
},
{PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
"<div class=\"subTitle\">compact3</div>"
},
//Test for "overview-frame.html" showing the "All Profiles" link.
{PROFILE_BUG_ID + FS + "overview-frame.html",
"<span><a href=\"profile-overview-frame.html\" "
+ "target=\"profileListFrame\">All Profiles</a></span>"
},
//Test for "className.html" showing the profile information for the type.
{PROFILE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
"<div class=\"subTitle\">compact1, compact2, compact3</div>"
}
};
private static final String[][] PROFILES_NEGATED_TEST = {
{PROFILE_BUG_ID + FS + "pkg3" + FS + "Class2Pkg3.html",
"<div class=\"subTitle\">compact1"
},
{PROFILE_BUG_ID + FS + "pkg3" + FS + "Interface1Pkg3.html",
"<div class=\"subTitle\">compact1"
},
{PROFILE_BUG_ID + FS + "pkg4" + FS + "compact2-package-frame.html",
"<li><a href=\"Anno1Pkg4.html\" title=\"annotation in pkg4\" "
+ "target=\"classFrame\">Anno1Pkg4</a></li>"
}
};
private static final String[][] PACKAGES_TEST = {
{PACKAGE_BUG_ID + FS + "overview-frame.html",
"<h2 title=\"Packages\">Packages</h2>"
},
{PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-frame.html",
"<h1 class=\"bar\"><a href=\"../pkg4/package-summary.html\" "
+ "target=\"classFrame\">pkg4</a></h1>"
},
{PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-summary.html",
"<div class=\"header\">" + NL + "<h1 title=\"Package\" "
+ "class=\"title\">Package&nbsp;pkg4</h1>" + NL + "</div>"
}
};
private static final String[][] PACKAGES_NEGATED_TEST = {
{PACKAGE_BUG_ID + FS + "profile-overview-frame.html",
"<span><a href=\"overview-frame.html\" "
+ "target=\"profileListFrame\">All Packages</a></span>"
},
{PACKAGE_BUG_ID + FS + "compact2-frame.html",
"<span><a href=\"overview-frame.html\" target=\"profileListFrame\">"
+ "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
+ "target=\"profileListFrame\">All Profiles</a></span>"
},
{PACKAGE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
"<a href=\"../compact2-summary.html\" target=\"classFrame\">"
+ "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
+ "target=\"classFrame\">pkg2</a>"
},
{PACKAGE_BUG_ID + FS + "compact2-summary.html",
"<h1 title=\"Profile\" class=\"title\">Profile&nbsp;compact2</h1>"
},
{PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
"<div class=\"subTitle\">compact3</div>"
},
{PACKAGE_BUG_ID + FS + "overview-frame.html",
"<span><a href=\"profile-overview-frame.html\" "
+ "target=\"profileListFrame\">All Profiles</a></span>"
},
{PACKAGE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
"<div class=\"subTitle\">compact1, compact2, compact3</div>"
}
};
/**
* The entry point of the test.
*
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestProfiles tester = new TestProfiles();
run(tester, ARGS1, PROFILES_TEST, PROFILES_NEGATED_TEST);
run(tester, ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST);
tester.printSummary();
}
/**
* {@inheritDoc}
*/
public String getBugId() {
return BUG_ID;
}
/**
* {@inheritDoc}
*/
public String getBugName() {
return getClass().getName();
}
}

View file

@ -0,0 +1,32 @@
/*
* 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.
*
* 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 pkg1;
/**
* A test class.
*
* @author Bhavesh Patel
*/
public class Class1Pkg1 {
}

View file

@ -0,0 +1,32 @@
/*
* 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.
*
* 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 pkg1;
/**
* A test class.
*
* @author Bhavesh Patel
*/
public class Class2Pkg1 {
}

View file

@ -0,0 +1,32 @@
/*
* 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.
*
* 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 pkg1;
/**
* A test class.
*
* @author Bhavesh Patel
*/
public class Class3Pkg1 {
}

View file

@ -0,0 +1,48 @@
/*
* 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.
*
* 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 pkg1;
/**
* A sample interface.
*
* @author Bhavesh Patel
*/
public interface Interface1Pkg1 {
/**
* A test method.
*
* @param a blah.
* @param b blah.
*/
void method1(int a, int b);
/**
* Another test method.
*
* @param c blah.
*/
void method2(int c);
}

View file

@ -0,0 +1,40 @@
/*
* 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 pkg2;
import java.lang.annotation.*;
/**
* Test Annotation class.
*
* @author Bhavesh Patel
*/
public @interface Anno1Pkg2 {
/**
* Comment.
*/
String[] value();
}

View file

@ -0,0 +1,35 @@
/*
* 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 pkg2;
import java.lang.annotation.*;
/*
* A sample interface.
*/
public @interface Anno2Pkg2 {
boolean value() default true;
}

View file

@ -0,0 +1,51 @@
/*
* 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.
*
* 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 pkg2;
/**
* Another test class.
*
* @author Bhavesh Patel
*/
public class Class1Pkg2 {
/**
* A sample enum.
*/
public static enum ModalExclusionType {
/**
* Test comment.
*/
NO_EXCLUDE,
/**
* Another comment.
*/
APPLICATION_EXCLUDE
};
/**
* A string constant.
*/
public static final String CONSTANT1 = "C2";
}

View file

@ -0,0 +1,32 @@
/*
* 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.
*
* 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 pkg3;
/**
* A test class.
*
* @author Bhavesh Patel
*/
public class Class1Pkg3 {
}

View file

@ -0,0 +1,32 @@
/*
* 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.
*
* 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 pkg3;
/**
* A test class.
*
* @author Bhavesh Patel
*/
public class Class2Pkg3 {
}

View file

@ -0,0 +1,48 @@
/*
* 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.
*
* 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 pkg3;
/**
* A sample interface.
*
* @author Bhavesh Patel
*/
public interface Interface1Pkg3 {
/**
* A test method.
*
* @param a blah.
* @param b blah.
*/
void method1(int a, int b);
/**
* Another test method.
*
* @param c blah.
*/
void method2(int c);
}

View file

@ -0,0 +1,40 @@
/*
* 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 pkg4;
import java.lang.annotation.*;
/**
* Test Annotation class.
*
* @author Bhavesh Patel
*/
public @interface Anno1Pkg4 {
/**
* Comment.
*/
String[] value();
}

View file

@ -0,0 +1,32 @@
/*
* 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.
*
* 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 pkg4;
/**
* Another test class.
*
* @author Bhavesh Patel
*/
public class Class1Pkg4 {
}

View file

@ -0,0 +1,32 @@
/*
* 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.
*
* 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 pkg5;
/**
* A test class.
*
* @author Bhavesh Patel
*/
public class Class1Pkg5 {
}

View file

@ -0,0 +1,40 @@
/*
* 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.
*
* 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 pkg5;
/**
* A sample interface.
*
* @author Bhavesh Patel
*/
public interface Interface1Pkg5 {
/**
* A test method.
*
* @param a blah.
* @param b blah.
*/
void method1(int a, int b);
}

View file

@ -0,0 +1,42 @@
PROFILE_1_RTJAR_INCLUDE_PACKAGES := \
pkg2
PROFILE_1_RTJAR_INCLUDE_TYPES := \
pkg3/Class1Pkg3.class
PROFILE_1_RTJAR_EXCLUDE_TYPES :=
PROFILE_1_INCLUDE_METAINF_SERVICES :=
PROFILE_2_RTJAR_INCLUDE_PACKAGES := \
pkg4
PROFILE_2_RTJAR_INCLUDE_TYPES :=
PROFILE_2_RTJAR_EXCLUDE_TYPES := \
pkg4/Anno1Pkg4.class
PROFILE_2_INCLUDE_METAINF_SERVICES :=
PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
pkg5
PROFILE_3_RTJAR_INCLUDE_TYPES :=
PROFILE_3_RTJAR_EXCLUDE_TYPES :=
PROFILE_3_INCLUDE_METAINF_SERVICES :=
PROFILE_4_RTJAR_INCLUDE_PACKAGES := \
pkg1
PROFILE_4_RTJAR_INCLUDE_TYPES :=
PROFILE_4_RTJAR_EXCLUDE_TYPES :=
PROFILE_4_INCLUDE_METAINF_SERVICES :=