1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java Mon Nov 19 11:38:49 2012 -0800 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java Mon Nov 19 16:10:34 2012 -0800 1.3 @@ -26,6 +26,7 @@ 1.4 package com.sun.tools.doclets.formats.html; 1.5 1.6 import java.io.*; 1.7 +import java.util.*; 1.8 1.9 import com.sun.javadoc.*; 1.10 import com.sun.tools.doclets.formats.html.markup.*; 1.11 @@ -77,16 +78,71 @@ 1.12 * 1.13 * @param mw the writer for the member being documented 1.14 * @param cd the classdoc to be documented 1.15 + * @param tableContents list of summary table contents 1.16 + * @param showTabs true if the table needs to show tabs 1.17 * @return the content tree for the summary table 1.18 */ 1.19 - public Content getSummaryTableTree(AbstractMemberWriter mw, ClassDoc cd) { 1.20 + public Content getSummaryTableTree(AbstractMemberWriter mw, ClassDoc cd, 1.21 + List<Content> tableContents, boolean showTabs) { 1.22 + Content caption; 1.23 + if (showTabs) { 1.24 + caption = getTableCaption(mw.methodTypes); 1.25 + generateMethodTypesScript(mw.typeMap, mw.methodTypes); 1.26 + } 1.27 + else { 1.28 + caption = getTableCaption(mw.getCaption()); 1.29 + } 1.30 Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, 1.31 - mw.getTableSummary(), getTableCaption(mw.getCaption())); 1.32 + mw.getTableSummary(), caption); 1.33 table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(cd), "col")); 1.34 + for (int i = 0; i < tableContents.size(); i++) { 1.35 + table.addContent(tableContents.get(i)); 1.36 + } 1.37 return table; 1.38 } 1.39 1.40 /** 1.41 + * Get the summary table caption. 1.42 + * 1.43 + * @param methodTypes set comprising of method types to show as table caption 1.44 + * @return the caption for the summary table 1.45 + */ 1.46 + public Content getTableCaption(Set<MethodTypes> methodTypes) { 1.47 + Content tabbedCaption = new HtmlTree(HtmlTag.CAPTION); 1.48 + for (MethodTypes type : methodTypes) { 1.49 + Content captionSpan; 1.50 + Content span; 1.51 + if (type.isDefaultTab()) { 1.52 + captionSpan = HtmlTree.SPAN(new StringContent(type.text())); 1.53 + span = HtmlTree.SPAN(type.tabId(), 1.54 + HtmlStyle.activeTableTab, captionSpan); 1.55 + } else { 1.56 + captionSpan = HtmlTree.SPAN(getMethodTypeLinks(type)); 1.57 + span = HtmlTree.SPAN(type.tabId(), 1.58 + HtmlStyle.tableTab, captionSpan); 1.59 + } 1.60 + Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, getSpace()); 1.61 + span.addContent(tabSpan); 1.62 + tabbedCaption.addContent(span); 1.63 + } 1.64 + return tabbedCaption; 1.65 + } 1.66 + 1.67 + /** 1.68 + * Get the method type links for the table caption. 1.69 + * 1.70 + * @param methodType the method type to be displayed as link 1.71 + * @return the content tree for the method type link 1.72 + */ 1.73 + public Content getMethodTypeLinks(MethodTypes methodType) { 1.74 + StringBuilder jsShow = new StringBuilder("javascript:show("); 1.75 + jsShow.append(methodType.value()).append(");"); 1.76 + HtmlTree link = HtmlTree.A(jsShow.toString(), 1.77 + new StringContent(methodType.text())); 1.78 + return link; 1.79 + } 1.80 + 1.81 + /** 1.82 * Add the inherited summary header. 1.83 * 1.84 * @param mw the writer for the member being documented