Mon, 19 Nov 2012 16:10:34 -0800
8002304: Group methods by types in methods summary section
Reviewed-by: jjg
1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Mon Nov 19 11:38:49 2012 -0800 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Mon Nov 19 16:10:34 2012 -0800 1.3 @@ -52,6 +52,9 @@ 1.4 protected final ConfigurationImpl configuration; 1.5 protected final SubWriterHolderWriter writer; 1.6 protected final ClassDoc classdoc; 1.7 + protected Map<String,Integer> typeMap = new LinkedHashMap<String,Integer>(); 1.8 + protected Set<MethodTypes> methodTypes = EnumSet.noneOf(MethodTypes.class); 1.9 + private int methodTypesOr = 0; 1.10 public final boolean nodepr; 1.11 1.12 protected boolean printedSummaryHeader = false; 1.13 @@ -524,11 +527,11 @@ 1.14 * @param classDoc the class that is being documented 1.15 * @param member the member being documented 1.16 * @param firstSentenceTags the first sentence tags to be added to the summary 1.17 - * @param tableTree the content tree to which the documentation will be added 1.18 - * @param counter the counter for determing style for the table row 1.19 + * @param tableContents the list of contents to which the documentation will be added 1.20 + * @param counter the counter for determining id and style for the table row 1.21 */ 1.22 public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member, 1.23 - Tag[] firstSentenceTags, Content tableTree, int counter) { 1.24 + Tag[] firstSentenceTags, List<Content> tableContents, int counter) { 1.25 HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD); 1.26 tdSummaryType.addStyle(HtmlStyle.colFirst); 1.27 writer.addSummaryType(this, member, tdSummaryType); 1.28 @@ -538,11 +541,46 @@ 1.29 writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary); 1.30 HtmlTree tr = HtmlTree.TR(tdSummaryType); 1.31 tr.addContent(tdSummary); 1.32 + if (member instanceof MethodDoc && !member.isAnnotationTypeElement()) { 1.33 + int methodType = (member.isStatic()) ? MethodTypes.STATIC.value() : 1.34 + MethodTypes.INSTANCE.value(); 1.35 + methodType = (classdoc.isInterface() || ((MethodDoc)member).isAbstract()) ? 1.36 + methodType | MethodTypes.ABSTRACT.value() : 1.37 + methodType | MethodTypes.CONCRETE.value(); 1.38 + if (Util.isDeprecated(member) || Util.isDeprecated(classdoc)) { 1.39 + methodType = methodType | MethodTypes.DEPRECATED.value(); 1.40 + } 1.41 + methodTypesOr = methodTypesOr | methodType; 1.42 + String tableId = "i" + counter; 1.43 + typeMap.put(tableId, methodType); 1.44 + tr.addAttr(HtmlAttr.ID, tableId); 1.45 + } 1.46 if (counter%2 == 0) 1.47 tr.addStyle(HtmlStyle.altColor); 1.48 else 1.49 tr.addStyle(HtmlStyle.rowColor); 1.50 - tableTree.addContent(tr); 1.51 + tableContents.add(tr); 1.52 + } 1.53 + 1.54 + /** 1.55 + * Generate the method types set and return true if the method summary table 1.56 + * needs to show tabs. 1.57 + * 1.58 + * @return true if the table should show tabs 1.59 + */ 1.60 + public boolean showTabs() { 1.61 + int value; 1.62 + for (MethodTypes type : EnumSet.allOf(MethodTypes.class)) { 1.63 + value = type.value(); 1.64 + if ((value & methodTypesOr) == value) { 1.65 + methodTypes.add(type); 1.66 + } 1.67 + } 1.68 + boolean showTabs = methodTypes.size() > 1; 1.69 + if (showTabs) { 1.70 + methodTypes.add(MethodTypes.ALL); 1.71 + } 1.72 + return showTabs; 1.73 } 1.74 1.75 /** 1.76 @@ -595,10 +633,11 @@ 1.77 * Get the summary table tree for the given class. 1.78 * 1.79 * @param classDoc the class for which the summary table is generated 1.80 + * @param tableContents list of contents to be displayed in the summary table 1.81 * @return a content tree for the summary table 1.82 */ 1.83 - public Content getSummaryTableTree(ClassDoc classDoc) { 1.84 - return writer.getSummaryTableTree(this, classDoc); 1.85 + public Content getSummaryTableTree(ClassDoc classDoc, List<Content> tableContents) { 1.86 + return writer.getSummaryTableTree(this, classDoc, tableContents, showTabs()); 1.87 } 1.88 1.89 /**
2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Mon Nov 19 11:38:49 2012 -0800 2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Mon Nov 19 16:10:34 2012 -0800 2.3 @@ -117,6 +117,8 @@ 2.4 copyResourceFile("tab.gif"); 2.5 copyResourceFile("titlebar.gif"); 2.6 copyResourceFile("titlebar_end.gif"); 2.7 + copyResourceFile("activetitlebar.gif"); 2.8 + copyResourceFile("activetitlebar_end.gif"); 2.9 // do early to reduce memory footprint 2.10 if (configuration.classuse) { 2.11 ClassUseWriter.generate(configuration, classtree); 2.12 @@ -152,10 +154,13 @@ 2.13 } 2.14 // If a stylesheet file is not specified, copy the default stylesheet 2.15 // and replace newline with platform-specific newline. 2.16 + DocFile f; 2.17 if (configuration.stylesheetfile.length() == 0) { 2.18 - DocFile f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET); 2.19 + f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET); 2.20 f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), false, true); 2.21 } 2.22 + f = DocFile.createFileForOutput(configuration, DocPaths.JAVASCRIPT); 2.23 + f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.JAVASCRIPT), true, true); 2.24 } 2.25 2.26 /**
3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Mon Nov 19 11:38:49 2012 -0800 3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Mon Nov 19 16:10:34 2012 -0800 3.3 @@ -327,6 +327,7 @@ 3.4 } 3.5 } 3.6 head.addContent(getStyleSheetProperties()); 3.7 + head.addContent(getScriptProperties()); 3.8 Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), 3.9 head, body); 3.10 Content htmlDocument = new HtmlDocument(htmlDocType, 3.11 @@ -1688,6 +1689,17 @@ 3.12 } 3.13 3.14 /** 3.15 + * Returns a link to the JavaScript file. 3.16 + * 3.17 + * @return an HtmlTree for the Script tag which provides the JavaScript location 3.18 + */ 3.19 + public HtmlTree getScriptProperties() { 3.20 + HtmlTree script = HtmlTree.SCRIPT("text/javascript", 3.21 + pathToRoot.resolve(DocPaths.JAVASCRIPT).getPath()); 3.22 + return script; 3.23 + } 3.24 + 3.25 + /** 3.26 * According to 3.27 * <cite>The Java™ Language Specification</cite>, 3.28 * all the outer classes and static nested classes are core classes.
4.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java Mon Nov 19 11:38:49 2012 -0800 4.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java Mon Nov 19 16:10:34 2012 -0800 4.3 @@ -26,6 +26,7 @@ 4.4 package com.sun.tools.doclets.formats.html; 4.5 4.6 import java.io.*; 4.7 +import java.util.*; 4.8 4.9 import com.sun.javadoc.*; 4.10 import com.sun.tools.doclets.formats.html.markup.*; 4.11 @@ -77,16 +78,71 @@ 4.12 * 4.13 * @param mw the writer for the member being documented 4.14 * @param cd the classdoc to be documented 4.15 + * @param tableContents list of summary table contents 4.16 + * @param showTabs true if the table needs to show tabs 4.17 * @return the content tree for the summary table 4.18 */ 4.19 - public Content getSummaryTableTree(AbstractMemberWriter mw, ClassDoc cd) { 4.20 + public Content getSummaryTableTree(AbstractMemberWriter mw, ClassDoc cd, 4.21 + List<Content> tableContents, boolean showTabs) { 4.22 + Content caption; 4.23 + if (showTabs) { 4.24 + caption = getTableCaption(mw.methodTypes); 4.25 + generateMethodTypesScript(mw.typeMap, mw.methodTypes); 4.26 + } 4.27 + else { 4.28 + caption = getTableCaption(mw.getCaption()); 4.29 + } 4.30 Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, 4.31 - mw.getTableSummary(), getTableCaption(mw.getCaption())); 4.32 + mw.getTableSummary(), caption); 4.33 table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(cd), "col")); 4.34 + for (int i = 0; i < tableContents.size(); i++) { 4.35 + table.addContent(tableContents.get(i)); 4.36 + } 4.37 return table; 4.38 } 4.39 4.40 /** 4.41 + * Get the summary table caption. 4.42 + * 4.43 + * @param methodTypes set comprising of method types to show as table caption 4.44 + * @return the caption for the summary table 4.45 + */ 4.46 + public Content getTableCaption(Set<MethodTypes> methodTypes) { 4.47 + Content tabbedCaption = new HtmlTree(HtmlTag.CAPTION); 4.48 + for (MethodTypes type : methodTypes) { 4.49 + Content captionSpan; 4.50 + Content span; 4.51 + if (type.isDefaultTab()) { 4.52 + captionSpan = HtmlTree.SPAN(new StringContent(type.text())); 4.53 + span = HtmlTree.SPAN(type.tabId(), 4.54 + HtmlStyle.activeTableTab, captionSpan); 4.55 + } else { 4.56 + captionSpan = HtmlTree.SPAN(getMethodTypeLinks(type)); 4.57 + span = HtmlTree.SPAN(type.tabId(), 4.58 + HtmlStyle.tableTab, captionSpan); 4.59 + } 4.60 + Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, getSpace()); 4.61 + span.addContent(tabSpan); 4.62 + tabbedCaption.addContent(span); 4.63 + } 4.64 + return tabbedCaption; 4.65 + } 4.66 + 4.67 + /** 4.68 + * Get the method type links for the table caption. 4.69 + * 4.70 + * @param methodType the method type to be displayed as link 4.71 + * @return the content tree for the method type link 4.72 + */ 4.73 + public Content getMethodTypeLinks(MethodTypes methodType) { 4.74 + StringBuilder jsShow = new StringBuilder("javascript:show("); 4.75 + jsShow.append(methodType.value()).append(");"); 4.76 + HtmlTree link = HtmlTree.A(jsShow.toString(), 4.77 + new StringContent(methodType.text())); 4.78 + return link; 4.79 + } 4.80 + 4.81 + /** 4.82 * Add the inherited summary header. 4.83 * 4.84 * @param mw the writer for the member being documented
5.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Mon Nov 19 11:38:49 2012 -0800 5.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Mon Nov 19 16:10:34 2012 -0800 5.3 @@ -37,6 +37,7 @@ 5.4 */ 5.5 public enum HtmlStyle { 5.6 aboutLanguage, 5.7 + activeTableTab, 5.8 altColor, 5.9 bar, 5.10 block, 5.11 @@ -75,6 +76,7 @@ 5.12 summary, 5.13 deprecatedContent, 5.14 tabEnd, 5.15 + tableTab, 5.16 title, 5.17 topNav; 5.18 }
6.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Mon Nov 19 11:38:49 2012 -0800 6.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Mon Nov 19 16:10:34 2012 -0800 6.3 @@ -494,6 +494,20 @@ 6.4 } 6.5 6.6 /** 6.7 + * Generates a SCRIPT tag with the type and src attributes. 6.8 + * 6.9 + * @param type type of link 6.10 + * @param src the path for the script 6.11 + * @return an HtmlTree object for the SCRIPT tag 6.12 + */ 6.13 + public static HtmlTree SCRIPT(String type, String src) { 6.14 + HtmlTree htmltree = new HtmlTree(HtmlTag.SCRIPT); 6.15 + htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type)); 6.16 + htmltree.addAttr(HtmlAttr.SRC, nullCheck(src)); 6.17 + return htmltree; 6.18 + } 6.19 + 6.20 + /** 6.21 * Generates a SMALL tag with some content. 6.22 * 6.23 * @param body content for the tag 6.24 @@ -540,6 +554,23 @@ 6.25 } 6.26 6.27 /** 6.28 + * Generates a SPAN tag with id and style class attributes. It also encloses 6.29 + * a content. 6.30 + * 6.31 + * @param id the id for the tag 6.32 + * @param styleClass stylesheet class for the tag 6.33 + * @param body content for the tag 6.34 + * @return an HtmlTree object for the SPAN tag 6.35 + */ 6.36 + public static HtmlTree SPAN(String id, HtmlStyle styleClass, Content body) { 6.37 + HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body)); 6.38 + htmltree.addAttr(HtmlAttr.ID, nullCheck(id)); 6.39 + if (styleClass != null) 6.40 + htmltree.addStyle(styleClass); 6.41 + return htmltree; 6.42 + } 6.43 + 6.44 + /** 6.45 * Generates a Table tag with border, width and summary attributes and 6.46 * some content. 6.47 * 6.48 @@ -742,6 +773,9 @@ 6.49 return (hasAttr(HtmlAttr.HREF) && !hasContent()); 6.50 case META : 6.51 return (hasAttr(HtmlAttr.CONTENT) && !hasContent()); 6.52 + case SCRIPT : 6.53 + return ((hasAttr(HtmlAttr.TYPE) && hasAttr(HtmlAttr.SRC) && !hasContent()) || 6.54 + (hasAttr(HtmlAttr.TYPE) && hasContent())); 6.55 default : 6.56 return hasContent(); 6.57 }
7.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Mon Nov 19 11:38:49 2012 -0800 7.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Mon Nov 19 16:10:34 2012 -0800 7.3 @@ -26,6 +26,7 @@ 7.4 package com.sun.tools.doclets.formats.html.markup; 7.5 7.6 import java.io.*; 7.7 +import java.util.*; 7.8 7.9 import com.sun.tools.doclets.internal.toolkit.*; 7.10 import com.sun.tools.doclets.internal.toolkit.util.*; 7.11 @@ -144,6 +145,8 @@ 7.12 7.13 private final Writer writer; 7.14 7.15 + private Content script; 7.16 + 7.17 /** 7.18 * Constructor. 7.19 * 7.20 @@ -301,7 +304,8 @@ 7.21 // Don't print windowtitle script for overview-frame, allclasses-frame 7.22 // and package-frame 7.23 if (includeScript) { 7.24 - body.addContent(getWinTitleScript()); 7.25 + this.script = getWinTitleScript(); 7.26 + body.addContent(script); 7.27 Content noScript = HtmlTree.NOSCRIPT( 7.28 HtmlTree.DIV(getResource("doclet.No_Script_Message"))); 7.29 body.addContent(noScript); 7.30 @@ -310,6 +314,53 @@ 7.31 } 7.32 7.33 /** 7.34 + * Generated javascript variables for the document. 7.35 + * 7.36 + * @param typeMap map comprising of method and type relationship 7.37 + * @param methodTypes set comprising of all methods types for this class 7.38 + */ 7.39 + public void generateMethodTypesScript(Map<String,Integer> typeMap, 7.40 + Set<MethodTypes> methodTypes) { 7.41 + String sep = ""; 7.42 + StringBuilder vars = new StringBuilder("var methods = {"); 7.43 + for (Map.Entry<String,Integer> entry : typeMap.entrySet()) { 7.44 + vars.append(sep); 7.45 + sep = ","; 7.46 + vars.append("\""); 7.47 + vars.append(entry.getKey()); 7.48 + vars.append("\":"); 7.49 + vars.append(entry.getValue()); 7.50 + } 7.51 + vars.append("};").append(DocletConstants.NL); 7.52 + sep = ""; 7.53 + vars.append("var tabs = {"); 7.54 + for (MethodTypes entry : methodTypes) { 7.55 + vars.append(sep); 7.56 + sep = ","; 7.57 + vars.append(entry.value()).append(":"); 7.58 + vars.append("[").append("\"").append(entry.tabId()); 7.59 + vars.append("\"").append(sep).append("\"").append(entry.text()).append("\"]"); 7.60 + } 7.61 + vars.append("};").append(DocletConstants.NL); 7.62 + addStyles(HtmlStyle.altColor, vars); 7.63 + addStyles(HtmlStyle.rowColor, vars); 7.64 + addStyles(HtmlStyle.tableTab, vars); 7.65 + addStyles(HtmlStyle.activeTableTab, vars); 7.66 + script.addContent(new RawHtml(vars.toString())); 7.67 + } 7.68 + 7.69 + /** 7.70 + * Adds javascript style variables to the document. 7.71 + * 7.72 + * @param style style to be added as a javascript variable 7.73 + * @param vars variable string to which the style variable will be added 7.74 + */ 7.75 + public void addStyles(HtmlStyle style, StringBuilder vars) { 7.76 + vars.append("var ").append(style).append(" = \"").append(style) 7.77 + .append("\";").append(DocletConstants.NL); 7.78 + } 7.79 + 7.80 + /** 7.81 * Returns an HtmlTree for the TITLE tag. 7.82 * 7.83 * @return an HtmlTree for the TITLE tag
8.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/MemberSummaryWriter.java Mon Nov 19 11:38:49 2012 -0800 8.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/MemberSummaryWriter.java Mon Nov 19 16:10:34 2012 -0800 8.3 @@ -58,9 +58,11 @@ 8.4 * Get the summary table for the given class. 8.5 * 8.6 * @param classDoc the class the summary table belongs to 8.7 + * @param tableContents list of contents that will be added to the summary table 8.8 * @return a content tree for the member summary table 8.9 */ 8.10 - public Content getSummaryTableTree(ClassDoc classDoc); 8.11 + public Content getSummaryTableTree(ClassDoc classDoc, 8.12 + List<Content> tableContents); 8.13 8.14 /** 8.15 * Add the member summary for the given class and member. 8.16 @@ -68,11 +70,11 @@ 8.17 * @param classDoc the class the summary belongs to 8.18 * @param member the member that is documented 8.19 * @param firstSentenceTags the tags for the sentence being documented 8.20 - * @param tableTree the content treeto which the information will be added 8.21 - * @param counter the counter for determing style for the table row 8.22 + * @param tableContents list of contents to which the summary will be added 8.23 + * @param counter the counter for determining id and style for the table row 8.24 */ 8.25 public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member, 8.26 - Tag[] firstSentenceTags, Content tableTree, int counter); 8.27 + Tag[] firstSentenceTags, List<Content> tableContents, int counter); 8.28 8.29 /** 8.30 * Get the inherited member summary header for the given class.
9.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java Mon Nov 19 11:38:49 2012 -0800 9.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java Mon Nov 19 16:10:34 2012 -0800 9.3 @@ -308,7 +308,7 @@ 9.4 configuration)); 9.5 if (members.size() > 0) { 9.6 Collections.sort(members); 9.7 - Content tableTree = writer.getSummaryTableTree(classDoc); 9.8 + List<Content> tableContents = new LinkedList<Content>(); 9.9 for (int i = 0; i < members.size(); i++) { 9.10 ProgramElementDoc member = members.get(i); 9.11 Tag[] firstSentenceTags = member.firstSentenceTags(); 9.12 @@ -317,14 +317,15 @@ 9.13 //necessary. 9.14 DocFinder.Output inheritedDoc = 9.15 DocFinder.search(new DocFinder.Input((MethodDoc) member)); 9.16 - if (inheritedDoc.holder != null && 9.17 - inheritedDoc.holder.firstSentenceTags().length > 0) { 9.18 + if (inheritedDoc.holder != null 9.19 + && inheritedDoc.holder.firstSentenceTags().length > 0) { 9.20 firstSentenceTags = inheritedDoc.holder.firstSentenceTags(); 9.21 } 9.22 } 9.23 - writer.addMemberSummary(classDoc, member, firstSentenceTags, tableTree, i); 9.24 + writer.addMemberSummary(classDoc, member, firstSentenceTags, 9.25 + tableContents, i); 9.26 } 9.27 - summaryTreeList.add(tableTree); 9.28 + summaryTreeList.add(writer.getSummaryTableTree(classDoc, tableContents)); 9.29 } 9.30 } 9.31
10.1 Binary file src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/activetitlebar.gif has changed
11.1 Binary file src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/activetitlebar_end.gif has changed
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/script.js Mon Nov 19 16:10:34 2012 -0800 12.3 @@ -0,0 +1,30 @@ 12.4 +function show(type) 12.5 +{ 12.6 + count = 0; 12.7 + for (var key in methods) { 12.8 + var row = document.getElementById(key); 12.9 + if ((methods[key] & type) != 0) { 12.10 + row.style.display = ''; 12.11 + row.className = (count++ % 2) ? rowColor : altColor; 12.12 + } 12.13 + else 12.14 + row.style.display = 'none'; 12.15 + } 12.16 + updateTabs(type); 12.17 +} 12.18 + 12.19 +function updateTabs(type) 12.20 +{ 12.21 + for (var value in tabs) { 12.22 + var sNode = document.getElementById(tabs[value][0]); 12.23 + var spanNode = sNode.firstChild; 12.24 + if (value == type) { 12.25 + sNode.className = activeTableTab; 12.26 + spanNode.innerHTML = tabs[value][1]; 12.27 + } 12.28 + else { 12.29 + sNode.className = tableTab; 12.30 + spanNode.innerHTML = "<a href=\"javascript:show("+ value + ");\">" + tabs[value][1] + "</a>"; 12.31 + } 12.32 + } 12.33 +}
13.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Mon Nov 19 11:38:49 2012 -0800 13.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Mon Nov 19 16:10:34 2012 -0800 13.3 @@ -381,6 +381,31 @@ 13.4 background-image:url(resources/titlebar.gif); 13.5 height:18px; 13.6 } 13.7 +.contentContainer ul.blockList li.blockList caption span.activeTableTab span { 13.8 + white-space:nowrap; 13.9 + padding-top:8px; 13.10 + padding-left:8px; 13.11 + display:block; 13.12 + float:left; 13.13 + background-image:url(resources/activetitlebar.gif); 13.14 + height:18px; 13.15 +} 13.16 +.contentContainer ul.blockList li.blockList caption span.tableTab span { 13.17 + white-space:nowrap; 13.18 + padding-top:8px; 13.19 + padding-left:8px; 13.20 + display:block; 13.21 + float:left; 13.22 + background-image:url(resources/titlebar.gif); 13.23 + height:18px; 13.24 +} 13.25 +.contentContainer ul.blockList li.blockList caption span.tableTab, .contentContainer ul.blockList li.blockList caption span.activeTableTab { 13.26 + padding-top:0px; 13.27 + padding-left:0px; 13.28 + background-image:none; 13.29 + float:none; 13.30 + display:inline; 13.31 +} 13.32 .overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd { 13.33 width:10px; 13.34 background-image:url(resources/titlebar_end.gif); 13.35 @@ -389,6 +414,24 @@ 13.36 position:relative; 13.37 float:left; 13.38 } 13.39 +.contentContainer ul.blockList li.blockList .activeTableTab .tabEnd { 13.40 + width:10px; 13.41 + margin-right:5px; 13.42 + background-image:url(resources/activetitlebar_end.gif); 13.43 + background-repeat:no-repeat; 13.44 + background-position:top right; 13.45 + position:relative; 13.46 + float:left; 13.47 +} 13.48 +.contentContainer ul.blockList li.blockList .tableTab .tabEnd { 13.49 + width:10px; 13.50 + margin-right:5px; 13.51 + background-image:url(resources/titlebar_end.gif); 13.52 + background-repeat:no-repeat; 13.53 + background-position:top right; 13.54 + position:relative; 13.55 + float:left; 13.56 +} 13.57 ul.blockList ul.blockList li.blockList table { 13.58 margin:0 0 12px 0px; 13.59 width:100%;
14.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java Mon Nov 19 11:38:49 2012 -0800 14.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java Mon Nov 19 16:10:34 2012 -0800 14.3 @@ -72,6 +72,9 @@ 14.4 return DocPath.create("index-" + n + ".html"); 14.5 } 14.6 14.7 + /** The name of the default javascript file. */ 14.8 + public static final DocPath JAVASCRIPT = DocPath.create("script.js"); 14.9 + 14.10 /** The name of the file for the overview frame. */ 14.11 public static final DocPath OVERVIEW_FRAME = DocPath.create("overview-frame.html"); 14.12
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodTypes.java Mon Nov 19 16:10:34 2012 -0800 15.3 @@ -0,0 +1,68 @@ 15.4 +/* 15.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 15.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.7 + * 15.8 + * This code is free software; you can redistribute it and/or modify it 15.9 + * under the terms of the GNU General Public License version 2 only, as 15.10 + * published by the Free Software Foundation. Oracle designates this 15.11 + * particular file as subject to the "Classpath" exception as provided 15.12 + * by Oracle in the LICENSE file that accompanied this code. 15.13 + * 15.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 15.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15.17 + * version 2 for more details (a copy is included in the LICENSE file that 15.18 + * accompanied this code). 15.19 + * 15.20 + * You should have received a copy of the GNU General Public License version 15.21 + * 2 along with this work; if not, write to the Free Software Foundation, 15.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 15.23 + * 15.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 15.25 + * or visit www.oracle.com if you need additional information or have any 15.26 + * questions. 15.27 + */ 15.28 + 15.29 +package com.sun.tools.doclets.internal.toolkit.util; 15.30 + 15.31 +/** 15.32 + * Enum representing method types. 15.33 + * 15.34 + * @author Bhavesh Patel 15.35 + */ 15.36 +public enum MethodTypes { 15.37 + ALL(0xffff, "All Methods", "t0", true), 15.38 + STATIC(0x1, "Static Methods", "t1", false), 15.39 + INSTANCE(0x2, "Instance Methods", "t2", false), 15.40 + ABSTRACT(0x4, "Abstract Methods", "t3", false), 15.41 + CONCRETE(0x8, "Concrete Methods", "t4", false), 15.42 + DEPRECATED(0x10, "Deprecated Methods", "t5", false); 15.43 + 15.44 + private final int value; 15.45 + private final String text; 15.46 + private final String tabId; 15.47 + private final boolean isDefaultTab; 15.48 + 15.49 + MethodTypes(int v, String t, String id, boolean dt) { 15.50 + this.value = v; 15.51 + this.text = t; 15.52 + this.tabId = id; 15.53 + this.isDefaultTab = dt; 15.54 + } 15.55 + 15.56 + public int value() { 15.57 + return value; 15.58 + } 15.59 + 15.60 + public String text() { 15.61 + return text; 15.62 + } 15.63 + 15.64 + public String tabId() { 15.65 + return tabId; 15.66 + } 15.67 + 15.68 + public boolean isDefaultTab() { 15.69 + return isDefaultTab; 15.70 + } 15.71 +}
16.1 --- a/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java Mon Nov 19 11:38:49 2012 -0800 16.2 +++ b/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java Mon Nov 19 16:10:34 2012 -0800 16.3 @@ -201,7 +201,15 @@ 16.4 "<caption><span>Fields</span><span class=\"tabEnd\"> </span></caption>" 16.5 }, 16.6 {BUG_ID + FS + "pkg1" + FS + "C1.html", 16.7 - "<caption><span>Methods</span><span class=\"tabEnd\"> </span></caption>" 16.8 + "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " + 16.9 + "Methods</span><span class=\"tabEnd\"> </span></span>" + 16.10 + "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" + 16.11 + "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>" + 16.12 + "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" + 16.13 + "Concrete Methods</a></span><span class=\"tabEnd\"> </span></span>" + 16.14 + "<span id=\"t5\" class=\"tableTab\"><span><a href=\"javascript:show(16);\">" + 16.15 + "Deprecated Methods</a></span><span class=\"tabEnd\"> </span></span>" + 16.16 + "</caption>" 16.17 }, 16.18 {BUG_ID + FS + "pkg2" + FS + "C2.html", 16.19 "<caption><span>Nested Classes</span><span class=\"tabEnd\"> </span></caption>"
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/test/com/sun/javadoc/testMethodTypes/TestMethodTypes.java Mon Nov 19 16:10:34 2012 -0800 17.3 @@ -0,0 +1,139 @@ 17.4 +/* 17.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 17.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.7 + * 17.8 + * This code is free software; you can redistribute it and/or modify it 17.9 + * under the terms of the GNU General Public License version 2 only, as 17.10 + * published by the Free Software Foundation. 17.11 + * 17.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 17.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 17.15 + * version 2 for more details (a copy is included in the LICENSE file that 17.16 + * accompanied this code). 17.17 + * 17.18 + * You should have received a copy of the GNU General Public License version 17.19 + * 2 along with this work; if not, write to the Free Software Foundation, 17.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17.21 + * 17.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 17.23 + * or visit www.oracle.com if you need additional information or have any 17.24 + * questions. 17.25 + */ 17.26 + 17.27 +/* 17.28 + * @test 17.29 + * @bug 8002304 17.30 + * @summary Test for various method types in the method summary table 17.31 + * @author Bhavesh Patel 17.32 + * @library ../lib/ 17.33 + * @build JavadocTester TestMethodTypes 17.34 + * @run main TestMethodTypes 17.35 + */ 17.36 + 17.37 +public class TestMethodTypes extends JavadocTester { 17.38 + 17.39 + //Test information. 17.40 + private static final String BUG_ID = "8002304"; 17.41 + 17.42 + //Javadoc arguments. 17.43 + private static final String[] ARGS = new String[] { 17.44 + "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1" 17.45 + }; 17.46 + 17.47 + private static final String[][] TEST = { 17.48 + {BUG_ID + FS + "pkg1" + FS + "A.html", 17.49 + "var methods = {" 17.50 + }, 17.51 + 17.52 + {BUG_ID + FS + "pkg1" + FS + "A.html", 17.53 + "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " + 17.54 + "Methods</span><span class=\"tabEnd\"> </span></span>" + 17.55 + "<span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:show(1);\">" + 17.56 + "Static Methods</a></span><span class=\"tabEnd\"> </span></span>" + 17.57 + "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" + 17.58 + "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>" + 17.59 + "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" + 17.60 + "Concrete Methods</a></span><span class=\"tabEnd\"> </span></span>" + 17.61 + "<span id=\"t5\" class=\"tableTab\"><span><a href=\"javascript:show(16);\">" + 17.62 + "Deprecated Methods</a></span><span class=\"tabEnd\"> </span></span>" + 17.63 + "</caption>" 17.64 + }, 17.65 + 17.66 + {BUG_ID + FS + "pkg1" + FS + "A.html", 17.67 + "<tr id=\"i0\" class=\"altColor\">" 17.68 + }, 17.69 + 17.70 + {BUG_ID + FS + "pkg1" + FS + "B.html", 17.71 + "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " + 17.72 + "Methods</span><span class=\"tabEnd\"> </span></span>" + 17.73 + "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" + 17.74 + "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>" + 17.75 + "<span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:show(4);\">" + 17.76 + "Abstract Methods</a></span><span class=\"tabEnd\"> </span></span>" + 17.77 + "</caption>" 17.78 + }, 17.79 + 17.80 + {BUG_ID + FS + "pkg1" + FS + "D.html", 17.81 + "var methods = {" 17.82 + }, 17.83 + 17.84 + {BUG_ID + FS + "pkg1" + FS + "D.html", 17.85 + "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " + 17.86 + "Methods</span><span class=\"tabEnd\"> </span></span>" + 17.87 + "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" + 17.88 + "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>" + 17.89 + "<span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:show(4);\">" + 17.90 + "Abstract Methods</a></span><span class=\"tabEnd\"> </span></span>" + 17.91 + "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" + 17.92 + "Concrete Methods</a></span><span class=\"tabEnd\"> </span></span>" + 17.93 + "<span id=\"t5\" class=\"tableTab\"><span><a href=\"javascript:show(16);\">" + 17.94 + "Deprecated Methods</a></span><span class=\"tabEnd\"> </span></span>" + 17.95 + "</caption>" 17.96 + }, 17.97 + 17.98 + {BUG_ID + FS + "pkg1" + FS + "D.html", 17.99 + "<tr id=\"i0\" class=\"altColor\">" 17.100 + }, 17.101 + }; 17.102 + private static final String[][] NEGATED_TEST = { 17.103 + {BUG_ID + FS + "pkg1" + FS + "A.html", 17.104 + "<caption><span>Methods</span><span class=\"tabEnd\"> </span>" + 17.105 + "</caption>" 17.106 + }, 17.107 + 17.108 + {BUG_ID + FS + "pkg1" + FS + "B.html", 17.109 + "<caption><span>Methods</span><span class=\"tabEnd\"> </span>" + 17.110 + "</caption>" 17.111 + }, 17.112 + 17.113 + {BUG_ID + FS + "pkg" + FS + "D.html", 17.114 + "<caption><span>Methods</span><span class=\"tabEnd\"> </span>" + 17.115 + "</caption>" 17.116 + }, 17.117 + }; 17.118 + 17.119 + /** 17.120 + * The entry point of the test. 17.121 + * @param args the array of command line arguments. 17.122 + */ 17.123 + public static void main(String[] args) { 17.124 + TestMethodTypes tester = new TestMethodTypes(); 17.125 + run(tester, ARGS, TEST, NEGATED_TEST); 17.126 + tester.printSummary(); 17.127 + } 17.128 + 17.129 + /** 17.130 + * {@inheritDoc} 17.131 + */ 17.132 + public String getBugId() { 17.133 + return BUG_ID; 17.134 + } 17.135 + 17.136 + /** 17.137 + * {@inheritDoc} 17.138 + */ 17.139 + public String getBugName() { 17.140 + return getClass().getName(); 17.141 + } 17.142 +}
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 18.2 +++ b/test/com/sun/javadoc/testMethodTypes/pkg1/A.java Mon Nov 19 16:10:34 2012 -0800 18.3 @@ -0,0 +1,77 @@ 18.4 +/* 18.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 18.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.7 + * 18.8 + * This code is free software; you can redistribute it and/or modify it 18.9 + * under the terms of the GNU General Public License version 2 only, as 18.10 + * published by the Free Software Foundation. 18.11 + * 18.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 18.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 18.15 + * version 2 for more details (a copy is included in the LICENSE file that 18.16 + * accompanied this code). 18.17 + * 18.18 + * You should have received a copy of the GNU General Public License version 18.19 + * 2 along with this work; if not, write to the Free Software Foundation, 18.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18.21 + * 18.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 18.23 + * or visit www.oracle.com if you need additional information or have any 18.24 + * questions. 18.25 + */ 18.26 + 18.27 +package pkg1; 18.28 + 18.29 +/** 18.30 + * This class has a mixture of different types of methods. The methods summary 18.31 + * table should appear with "All Methods", "Static Methods", "Instance Methods", 18.32 + * "Concrete Methods" and "Deprecated Methods". 18.33 + */ 18.34 +public class A { 18.35 + 18.36 + /** 18.37 + * This is the first concrete instance method. 18.38 + */ 18.39 + public void readObject() { 18.40 + } 18.41 + 18.42 + /** 18.43 + * This is the second concrete instance method. 18.44 + */ 18.45 + public final void setStub() { 18.46 + } 18.47 + 18.48 + /** 18.49 + * This is the third concrete instance method. 18.50 + */ 18.51 + public String getParameter() { 18.52 + return "test"; 18.53 + } 18.54 + 18.55 + /** 18.56 + * This is the first concrete instance deprecated method. 18.57 + * @deprecated This is a deprecated method that should appear in the tab. 18.58 + */ 18.59 + public void resize() { 18.60 + } 18.61 + 18.62 + /** 18.63 + * This is the fourth concrete instance method. 18.64 + */ 18.65 + public void showStatus() { 18.66 + } 18.67 + 18.68 + /** 18.69 + * This is the first concrete static method. 18.70 + */ 18.71 + public final static void staticMethod() { 18.72 + } 18.73 + 18.74 + /** 18.75 + * This is the second concrete instance deprecated method. 18.76 + */ 18.77 + @Deprecated 18.78 + public void init() { 18.79 + } 18.80 +}
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 19.2 +++ b/test/com/sun/javadoc/testMethodTypes/pkg1/B.java Mon Nov 19 16:10:34 2012 -0800 19.3 @@ -0,0 +1,56 @@ 19.4 +/* 19.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 19.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.7 + * 19.8 + * This code is free software; you can redistribute it and/or modify it 19.9 + * under the terms of the GNU General Public License version 2 only, as 19.10 + * published by the Free Software Foundation. 19.11 + * 19.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 19.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19.15 + * version 2 for more details (a copy is included in the LICENSE file that 19.16 + * accompanied this code). 19.17 + * 19.18 + * You should have received a copy of the GNU General Public License version 19.19 + * 2 along with this work; if not, write to the Free Software Foundation, 19.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19.21 + * 19.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19.23 + * or visit www.oracle.com if you need additional information or have any 19.24 + * questions. 19.25 + */ 19.26 + 19.27 +package pkg1; 19.28 + 19.29 +/** 19.30 + * This interface has different types of methods such as "Instance Methods" and 19.31 + * "Abstract Methods". All the tabs will display same list of methods. 19.32 + */ 19.33 +public interface B { 19.34 + 19.35 + /** 19.36 + * This is the first abstract instance method. 19.37 + */ 19.38 + public void setName(); 19.39 + 19.40 + /** 19.41 + * This is the second abstract instance method. 19.42 + */ 19.43 + public String getName(); 19.44 + 19.45 + /** 19.46 + * This is the third abstract instance method. 19.47 + */ 19.48 + public boolean addEntry(); 19.49 + 19.50 + /** 19.51 + * This is the fourth abstract instance method. 19.52 + */ 19.53 + public boolean removeEntry(); 19.54 + 19.55 + /** 19.56 + * This is the fifth abstract instance method. 19.57 + */ 19.58 + public String getPermissions(); 19.59 +}
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/test/com/sun/javadoc/testMethodTypes/pkg1/D.java Mon Nov 19 16:10:34 2012 -0800 20.3 @@ -0,0 +1,53 @@ 20.4 +/* 20.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.7 + * 20.8 + * This code is free software; you can redistribute it and/or modify it 20.9 + * under the terms of the GNU General Public License version 2 only, as 20.10 + * published by the Free Software Foundation. 20.11 + * 20.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 20.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 20.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20.15 + * version 2 for more details (a copy is included in the LICENSE file that 20.16 + * accompanied this code). 20.17 + * 20.18 + * You should have received a copy of the GNU General Public License version 20.19 + * 2 along with this work; if not, write to the Free Software Foundation, 20.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20.21 + * 20.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20.23 + * or visit www.oracle.com if you need additional information or have any 20.24 + * questions. 20.25 + */ 20.26 + 20.27 +package pkg1; 20.28 + 20.29 +/** 20.30 + * This class is marked as deprecated and has a mixture of different types of 20.31 + * methods such as "Instance Methods", "Abstract Methods" and "Concrete 20.32 + * Methods". None of the methods are marked as deprecated but since the class is 20.33 + * deprecated, the methods will also be deprecated and "Deprecated Methods" tab 20.34 + * will also be shown with all the methods. 20.35 + */ 20.36 +@Deprecated 20.37 +public abstract class D { 20.38 + 20.39 + /** 20.40 + * This is the first abstract instance method. 20.41 + */ 20.42 + public abstract void readObject(); 20.43 + 20.44 + /** 20.45 + * This is the first concrete instance method. 20.46 + */ 20.47 + public final void setStub() { 20.48 + } 20.49 + 20.50 + /** 20.51 + * This is the second concrete instance method. 20.52 + */ 20.53 + public String getParameter() { 20.54 + return "test"; 20.55 + } 20.56 +}
21.1 --- a/test/tools/javadoc/api/basic/APITest.java Mon Nov 19 11:38:49 2012 -0800 21.2 +++ b/test/tools/javadoc/api/basic/APITest.java Mon Nov 19 16:10:34 2012 -0800 21.3 @@ -201,8 +201,11 @@ 21.4 "pkg/package-tree.html", 21.5 "resources/background.gif", 21.6 "resources/tab.gif", 21.7 + "resources/activetitlebar_end.gif", 21.8 + "resources/activetitlebar.gif", 21.9 "resources/titlebar_end.gif", 21.10 "resources/titlebar.gif", 21.11 + "script.js", 21.12 "stylesheet.css" 21.13 )); 21.14 }