8002304: Group methods by types in methods summary section
authorbpatel
Mon, 19 Nov 2012 16:10:34 -0800
changeset 14549 0599d73bf1da
parent 14548 aa687b312c97
child 14550 284da8fb4eaf
8002304: Group methods by types in methods summary section Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/MemberSummaryWriter.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/activetitlebar.gif
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/activetitlebar_end.gif
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/script.js
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodTypes.java
langtools/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java
langtools/test/com/sun/javadoc/testMethodTypes/TestMethodTypes.java
langtools/test/com/sun/javadoc/testMethodTypes/pkg1/A.java
langtools/test/com/sun/javadoc/testMethodTypes/pkg1/B.java
langtools/test/com/sun/javadoc/testMethodTypes/pkg1/D.java
langtools/test/tools/javadoc/api/basic/APITest.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Mon Nov 19 11:38:49 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Mon Nov 19 16:10:34 2012 -0800
@@ -52,6 +52,9 @@
     protected final ConfigurationImpl configuration;
     protected final SubWriterHolderWriter writer;
     protected final ClassDoc classdoc;
+    protected Map<String,Integer> typeMap = new LinkedHashMap<String,Integer>();
+    protected Set<MethodTypes> methodTypes = EnumSet.noneOf(MethodTypes.class);
+    private int methodTypesOr = 0;
     public final boolean nodepr;
 
     protected boolean printedSummaryHeader = false;
@@ -524,11 +527,11 @@
      * @param classDoc the class that is being documented
      * @param member the member being documented
      * @param firstSentenceTags the first sentence tags to be added to the summary
-     * @param tableTree the content tree to which the documentation will be added
-     * @param counter the counter for determing style for the table row
+     * @param tableContents the list of contents to which the documentation will be added
+     * @param counter the counter for determining id and style for the table row
      */
     public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
-            Tag[] firstSentenceTags, Content tableTree, int counter) {
+            Tag[] firstSentenceTags, List<Content> tableContents, int counter) {
         HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
         tdSummaryType.addStyle(HtmlStyle.colFirst);
         writer.addSummaryType(this, member, tdSummaryType);
@@ -538,11 +541,46 @@
         writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary);
         HtmlTree tr = HtmlTree.TR(tdSummaryType);
         tr.addContent(tdSummary);
+        if (member instanceof MethodDoc && !member.isAnnotationTypeElement()) {
+            int methodType = (member.isStatic()) ? MethodTypes.STATIC.value() :
+                    MethodTypes.INSTANCE.value();
+            methodType = (classdoc.isInterface() || ((MethodDoc)member).isAbstract()) ?
+                    methodType | MethodTypes.ABSTRACT.value() :
+                    methodType | MethodTypes.CONCRETE.value();
+            if (Util.isDeprecated(member) || Util.isDeprecated(classdoc)) {
+                methodType = methodType | MethodTypes.DEPRECATED.value();
+            }
+            methodTypesOr = methodTypesOr | methodType;
+            String tableId = "i" + counter;
+            typeMap.put(tableId, methodType);
+            tr.addAttr(HtmlAttr.ID, tableId);
+        }
         if (counter%2 == 0)
             tr.addStyle(HtmlStyle.altColor);
         else
             tr.addStyle(HtmlStyle.rowColor);
-        tableTree.addContent(tr);
+        tableContents.add(tr);
+    }
+
+    /**
+     * Generate the method types set and return true if the method summary table
+     * needs to show tabs.
+     *
+     * @return true if the table should show tabs
+     */
+    public boolean showTabs() {
+        int value;
+        for (MethodTypes type : EnumSet.allOf(MethodTypes.class)) {
+            value = type.value();
+            if ((value & methodTypesOr) == value) {
+                methodTypes.add(type);
+            }
+        }
+        boolean showTabs = methodTypes.size() > 1;
+        if (showTabs) {
+            methodTypes.add(MethodTypes.ALL);
+        }
+        return showTabs;
     }
 
     /**
@@ -595,10 +633,11 @@
      * Get the summary table tree for the given class.
      *
      * @param classDoc the class for which the summary table is generated
+     * @param tableContents list of contents to be displayed in the summary table
      * @return a content tree for the summary table
      */
-    public Content getSummaryTableTree(ClassDoc classDoc) {
-        return writer.getSummaryTableTree(this, classDoc);
+    public Content getSummaryTableTree(ClassDoc classDoc, List<Content> tableContents) {
+        return writer.getSummaryTableTree(this, classDoc, tableContents, showTabs());
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Mon Nov 19 11:38:49 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Mon Nov 19 16:10:34 2012 -0800
@@ -117,6 +117,8 @@
         copyResourceFile("tab.gif");
         copyResourceFile("titlebar.gif");
         copyResourceFile("titlebar_end.gif");
+        copyResourceFile("activetitlebar.gif");
+        copyResourceFile("activetitlebar_end.gif");
         // do early to reduce memory footprint
         if (configuration.classuse) {
             ClassUseWriter.generate(configuration, classtree);
@@ -152,10 +154,13 @@
         }
         // If a stylesheet file is not specified, copy the default stylesheet
         // and replace newline with platform-specific newline.
+        DocFile f;
         if (configuration.stylesheetfile.length() == 0) {
-            DocFile f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET);
+            f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET);
             f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), false, true);
         }
+        f = DocFile.createFileForOutput(configuration, DocPaths.JAVASCRIPT);
+        f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.JAVASCRIPT), true, true);
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Mon Nov 19 11:38:49 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Mon Nov 19 16:10:34 2012 -0800
@@ -327,6 +327,7 @@
             }
         }
         head.addContent(getStyleSheetProperties());
+        head.addContent(getScriptProperties());
         Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
                 head, body);
         Content htmlDocument = new HtmlDocument(htmlDocType,
@@ -1688,6 +1689,17 @@
     }
 
     /**
+     * Returns a link to the JavaScript file.
+     *
+     * @return an HtmlTree for the Script tag which provides the JavaScript location
+     */
+    public HtmlTree getScriptProperties() {
+        HtmlTree script = HtmlTree.SCRIPT("text/javascript",
+                pathToRoot.resolve(DocPaths.JAVASCRIPT).getPath());
+        return script;
+    }
+
+    /**
      * According to
      * <cite>The Java&trade; Language Specification</cite>,
      * all the outer classes and static nested classes are core classes.
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Mon Nov 19 11:38:49 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Mon Nov 19 16:10:34 2012 -0800
@@ -26,6 +26,7 @@
 package com.sun.tools.doclets.formats.html;
 
 import java.io.*;
+import java.util.*;
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.formats.html.markup.*;
@@ -77,16 +78,71 @@
      *
      * @param mw the writer for the member being documented
      * @param cd the classdoc to be documented
+     * @param tableContents list of summary table contents
+     * @param showTabs true if the table needs to show tabs
      * @return the content tree for the summary table
      */
-    public Content getSummaryTableTree(AbstractMemberWriter mw, ClassDoc cd) {
+    public Content getSummaryTableTree(AbstractMemberWriter mw, ClassDoc cd,
+            List<Content> tableContents, boolean showTabs) {
+        Content caption;
+        if (showTabs) {
+            caption = getTableCaption(mw.methodTypes);
+            generateMethodTypesScript(mw.typeMap, mw.methodTypes);
+        }
+        else {
+            caption = getTableCaption(mw.getCaption());
+        }
         Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0,
-                mw.getTableSummary(), getTableCaption(mw.getCaption()));
+                mw.getTableSummary(), caption);
         table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(cd), "col"));
+        for (int i = 0; i < tableContents.size(); i++) {
+            table.addContent(tableContents.get(i));
+        }
         return table;
     }
 
     /**
+     * Get the summary table caption.
+     *
+     * @param methodTypes set comprising of method types to show as table caption
+     * @return the caption for the summary table
+     */
+    public Content getTableCaption(Set<MethodTypes> methodTypes) {
+        Content tabbedCaption = new HtmlTree(HtmlTag.CAPTION);
+        for (MethodTypes type : methodTypes) {
+            Content captionSpan;
+            Content span;
+            if (type.isDefaultTab()) {
+                captionSpan = HtmlTree.SPAN(new StringContent(type.text()));
+                span = HtmlTree.SPAN(type.tabId(),
+                        HtmlStyle.activeTableTab, captionSpan);
+            } else {
+                captionSpan = HtmlTree.SPAN(getMethodTypeLinks(type));
+                span = HtmlTree.SPAN(type.tabId(),
+                        HtmlStyle.tableTab, captionSpan);
+            }
+            Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, getSpace());
+            span.addContent(tabSpan);
+            tabbedCaption.addContent(span);
+        }
+        return tabbedCaption;
+    }
+
+    /**
+     * Get the method type links for the table caption.
+     *
+     * @param methodType the method type to be displayed as link
+     * @return the content tree for the method type link
+     */
+    public Content getMethodTypeLinks(MethodTypes methodType) {
+        StringBuilder jsShow = new StringBuilder("javascript:show(");
+        jsShow.append(methodType.value()).append(");");
+        HtmlTree link = HtmlTree.A(jsShow.toString(),
+                new StringContent(methodType.text()));
+        return link;
+    }
+
+    /**
      * Add the inherited summary header.
      *
      * @param mw the writer for the member being documented
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java	Mon Nov 19 11:38:49 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java	Mon Nov 19 16:10:34 2012 -0800
@@ -37,6 +37,7 @@
  */
 public enum HtmlStyle {
     aboutLanguage,
+    activeTableTab,
     altColor,
     bar,
     block,
@@ -75,6 +76,7 @@
     summary,
     deprecatedContent,
     tabEnd,
+    tableTab,
     title,
     topNav;
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Mon Nov 19 11:38:49 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Mon Nov 19 16:10:34 2012 -0800
@@ -494,6 +494,20 @@
     }
 
     /**
+     * Generates a SCRIPT tag with the type and src attributes.
+     *
+     * @param type type of link
+     * @param src the path for the script
+     * @return an HtmlTree object for the SCRIPT tag
+     */
+    public static HtmlTree SCRIPT(String type, String src) {
+        HtmlTree htmltree = new HtmlTree(HtmlTag.SCRIPT);
+        htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
+        htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
+        return htmltree;
+    }
+
+    /**
      * Generates a SMALL tag with some content.
      *
      * @param body content for the tag
@@ -540,6 +554,23 @@
     }
 
     /**
+     * Generates a SPAN tag with id and style class attributes. It also encloses
+     * a content.
+     *
+     * @param id the id for the tag
+     * @param styleClass stylesheet class for the tag
+     * @param body content for the tag
+     * @return an HtmlTree object for the SPAN tag
+     */
+    public static HtmlTree SPAN(String id, HtmlStyle styleClass, Content body) {
+        HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body));
+        htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
+        if (styleClass != null)
+            htmltree.addStyle(styleClass);
+        return htmltree;
+    }
+
+    /**
      * Generates a Table tag with border, width and summary attributes and
      * some content.
      *
@@ -742,6 +773,9 @@
                 return (hasAttr(HtmlAttr.HREF) && !hasContent());
             case META :
                 return (hasAttr(HtmlAttr.CONTENT) && !hasContent());
+            case SCRIPT :
+                return ((hasAttr(HtmlAttr.TYPE) && hasAttr(HtmlAttr.SRC) && !hasContent()) ||
+                        (hasAttr(HtmlAttr.TYPE) && hasContent()));
             default :
                 return hasContent();
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Mon Nov 19 11:38:49 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Mon Nov 19 16:10:34 2012 -0800
@@ -26,6 +26,7 @@
 package com.sun.tools.doclets.formats.html.markup;
 
 import java.io.*;
+import java.util.*;
 
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -144,6 +145,8 @@
 
     private final Writer writer;
 
+    private Content script;
+
     /**
      * Constructor.
      *
@@ -301,7 +304,8 @@
         // Don't print windowtitle script for overview-frame, allclasses-frame
         // and package-frame
         if (includeScript) {
-            body.addContent(getWinTitleScript());
+            this.script = getWinTitleScript();
+            body.addContent(script);
             Content noScript = HtmlTree.NOSCRIPT(
                     HtmlTree.DIV(getResource("doclet.No_Script_Message")));
             body.addContent(noScript);
@@ -310,6 +314,53 @@
     }
 
     /**
+     * Generated javascript variables for the document.
+     *
+     * @param typeMap map comprising of method and type relationship
+     * @param methodTypes set comprising of all methods types for this class
+     */
+    public void generateMethodTypesScript(Map<String,Integer> typeMap,
+            Set<MethodTypes> methodTypes) {
+        String sep = "";
+        StringBuilder vars = new StringBuilder("var methods = {");
+        for (Map.Entry<String,Integer> entry : typeMap.entrySet()) {
+            vars.append(sep);
+            sep = ",";
+            vars.append("\"");
+            vars.append(entry.getKey());
+            vars.append("\":");
+            vars.append(entry.getValue());
+        }
+        vars.append("};").append(DocletConstants.NL);
+        sep = "";
+        vars.append("var tabs = {");
+        for (MethodTypes entry : methodTypes) {
+            vars.append(sep);
+            sep = ",";
+            vars.append(entry.value()).append(":");
+            vars.append("[").append("\"").append(entry.tabId());
+            vars.append("\"").append(sep).append("\"").append(entry.text()).append("\"]");
+        }
+        vars.append("};").append(DocletConstants.NL);
+        addStyles(HtmlStyle.altColor, vars);
+        addStyles(HtmlStyle.rowColor, vars);
+        addStyles(HtmlStyle.tableTab, vars);
+        addStyles(HtmlStyle.activeTableTab, vars);
+        script.addContent(new RawHtml(vars.toString()));
+    }
+
+    /**
+     * Adds javascript style variables to the document.
+     *
+     * @param style style to be added as a javascript variable
+     * @param vars variable string to which the style variable will be added
+     */
+    public void addStyles(HtmlStyle style, StringBuilder vars) {
+        vars.append("var ").append(style).append(" = \"").append(style)
+                .append("\";").append(DocletConstants.NL);
+    }
+
+    /**
      * Returns an HtmlTree for the TITLE tag.
      *
      * @return an HtmlTree for the TITLE tag
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/MemberSummaryWriter.java	Mon Nov 19 11:38:49 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/MemberSummaryWriter.java	Mon Nov 19 16:10:34 2012 -0800
@@ -58,9 +58,11 @@
      * Get the summary table for the given class.
      *
      * @param classDoc the class the summary table belongs to
+     * @param tableContents list of contents that will be added to the summary table
      * @return a content tree for the member summary table
      */
-    public Content getSummaryTableTree(ClassDoc classDoc);
+    public Content getSummaryTableTree(ClassDoc classDoc,
+            List<Content> tableContents);
 
     /**
      * Add the member summary for the given class and member.
@@ -68,11 +70,11 @@
      * @param classDoc the class the summary belongs to
      * @param member the member that is documented
      * @param firstSentenceTags the tags for the sentence being documented
-     * @param tableTree the content treeto which the information will be added
-     * @param counter the counter for determing style for the table row
+     * @param tableContents list of contents to which the summary will be added
+     * @param counter the counter for determining id and style for the table row
      */
     public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
-        Tag[] firstSentenceTags, Content tableTree, int counter);
+            Tag[] firstSentenceTags, List<Content> tableContents, int counter);
 
     /**
      * Get the inherited member summary header for the given class.
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Mon Nov 19 11:38:49 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Mon Nov 19 16:10:34 2012 -0800
@@ -308,7 +308,7 @@
                 configuration));
         if (members.size() > 0) {
             Collections.sort(members);
-            Content tableTree = writer.getSummaryTableTree(classDoc);
+            List<Content> tableContents = new LinkedList<Content>();
             for (int i = 0; i < members.size(); i++) {
                 ProgramElementDoc member = members.get(i);
                 Tag[] firstSentenceTags = member.firstSentenceTags();
@@ -317,14 +317,15 @@
                     //necessary.
                     DocFinder.Output inheritedDoc =
                             DocFinder.search(new DocFinder.Input((MethodDoc) member));
-                    if (inheritedDoc.holder != null &&
-                            inheritedDoc.holder.firstSentenceTags().length > 0) {
+                    if (inheritedDoc.holder != null
+                            && inheritedDoc.holder.firstSentenceTags().length > 0) {
                         firstSentenceTags = inheritedDoc.holder.firstSentenceTags();
                     }
                 }
-                writer.addMemberSummary(classDoc, member, firstSentenceTags, tableTree, i);
+                writer.addMemberSummary(classDoc, member, firstSentenceTags,
+                        tableContents, i);
             }
-            summaryTreeList.add(tableTree);
+            summaryTreeList.add(writer.getSummaryTableTree(classDoc, tableContents));
         }
     }
 
Binary file langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/activetitlebar.gif has changed
Binary file langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/activetitlebar_end.gif has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/script.js	Mon Nov 19 16:10:34 2012 -0800
@@ -0,0 +1,30 @@
+function show(type)
+{
+    count = 0;
+    for (var key in methods) {
+        var row = document.getElementById(key);
+        if ((methods[key] &  type) != 0) {
+            row.style.display = '';
+            row.className = (count++ % 2) ? rowColor : altColor;
+        }
+        else
+            row.style.display = 'none';
+    }
+    updateTabs(type);
+}
+
+function updateTabs(type)
+{
+    for (var value in tabs) {
+        var sNode = document.getElementById(tabs[value][0]);
+        var spanNode = sNode.firstChild;
+        if (value == type) {
+            sNode.className = activeTableTab;
+            spanNode.innerHTML = tabs[value][1];
+        }
+        else {
+            sNode.className = tableTab;
+            spanNode.innerHTML = "<a href=\"javascript:show("+ value + ");\">" + tabs[value][1] + "</a>";
+        }
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Mon Nov 19 11:38:49 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Mon Nov 19 16:10:34 2012 -0800
@@ -381,6 +381,31 @@
     background-image:url(resources/titlebar.gif);
     height:18px;
 }
+.contentContainer ul.blockList li.blockList caption span.activeTableTab span {
+    white-space:nowrap;
+    padding-top:8px;
+    padding-left:8px;
+    display:block;
+    float:left;
+    background-image:url(resources/activetitlebar.gif);
+    height:18px;
+}
+.contentContainer ul.blockList li.blockList caption span.tableTab span {
+    white-space:nowrap;
+    padding-top:8px;
+    padding-left:8px;
+    display:block;
+    float:left;
+    background-image:url(resources/titlebar.gif);
+    height:18px;
+}
+.contentContainer ul.blockList li.blockList caption span.tableTab, .contentContainer ul.blockList li.blockList caption span.activeTableTab {
+    padding-top:0px;
+    padding-left:0px;
+    background-image:none;
+    float:none;
+    display:inline;
+}
 .overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd {
     width:10px;
     background-image:url(resources/titlebar_end.gif);
@@ -389,6 +414,24 @@
     position:relative;
     float:left;
 }
+.contentContainer ul.blockList li.blockList .activeTableTab .tabEnd {
+    width:10px;
+    margin-right:5px;
+    background-image:url(resources/activetitlebar_end.gif);
+    background-repeat:no-repeat;
+    background-position:top right;
+    position:relative;
+    float:left;
+}
+.contentContainer ul.blockList li.blockList .tableTab .tabEnd {
+    width:10px;
+    margin-right:5px;
+    background-image:url(resources/titlebar_end.gif);
+    background-repeat:no-repeat;
+    background-position:top right;
+    position:relative;
+    float:left;
+}
 ul.blockList ul.blockList li.blockList table {
     margin:0 0 12px 0px;
     width:100%;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java	Mon Nov 19 11:38:49 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java	Mon Nov 19 16:10:34 2012 -0800
@@ -72,6 +72,9 @@
         return DocPath.create("index-" + n + ".html");
     }
 
+    /** The name of the default javascript file. */
+    public static final DocPath JAVASCRIPT = DocPath.create("script.js");
+
     /** The name of the file for the overview frame. */
     public static final DocPath OVERVIEW_FRAME = DocPath.create("overview-frame.html");
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodTypes.java	Mon Nov 19 16:10:34 2012 -0800
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2012, 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.util;
+
+/**
+ * Enum representing method types.
+ *
+ * @author Bhavesh Patel
+ */
+public enum MethodTypes {
+    ALL(0xffff, "All Methods", "t0", true),
+    STATIC(0x1, "Static Methods", "t1", false),
+    INSTANCE(0x2, "Instance Methods", "t2", false),
+    ABSTRACT(0x4, "Abstract Methods", "t3", false),
+    CONCRETE(0x8, "Concrete Methods", "t4", false),
+    DEPRECATED(0x10, "Deprecated Methods", "t5", false);
+
+    private final int value;
+    private final String text;
+    private final String tabId;
+    private final boolean isDefaultTab;
+
+    MethodTypes(int v, String t, String id, boolean dt) {
+        this.value = v;
+        this.text = t;
+        this.tabId = id;
+        this.isDefaultTab = dt;
+    }
+
+    public int value() {
+        return value;
+    }
+
+    public String text() {
+        return text;
+    }
+
+    public String tabId() {
+        return tabId;
+    }
+
+    public boolean isDefaultTab() {
+        return isDefaultTab;
+    }
+}
--- a/langtools/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java	Mon Nov 19 11:38:49 2012 -0800
+++ b/langtools/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java	Mon Nov 19 16:10:34 2012 -0800
@@ -201,7 +201,15 @@
             "<caption><span>Fields</span><span class=\"tabEnd\">&nbsp;</span></caption>"
         },
         {BUG_ID + FS + "pkg1" + FS + "C1.html",
-            "<caption><span>Methods</span><span class=\"tabEnd\">&nbsp;</span></caption>"
+            "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " +
+            "Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" +
+            "Instance Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" +
+            "Concrete Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t5\" class=\"tableTab\"><span><a href=\"javascript:show(16);\">" +
+            "Deprecated Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "</caption>"
         },
         {BUG_ID + FS + "pkg2" + FS + "C2.html",
             "<caption><span>Nested Classes</span><span class=\"tabEnd\">&nbsp;</span></caption>"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testMethodTypes/TestMethodTypes.java	Mon Nov 19 16:10:34 2012 -0800
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2012, 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      8002304
+ * @summary  Test for various method types in the method summary table
+ * @author   Bhavesh Patel
+ * @library  ../lib/
+ * @build    JavadocTester TestMethodTypes
+ * @run main TestMethodTypes
+ */
+
+public class TestMethodTypes extends JavadocTester {
+
+    //Test information.
+    private static final String BUG_ID = "8002304";
+
+    //Javadoc arguments.
+    private static final String[] ARGS = new String[] {
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"
+    };
+
+    private static final String[][] TEST = {
+        {BUG_ID + FS + "pkg1" + FS + "A.html",
+            "var methods = {"
+        },
+
+        {BUG_ID + FS + "pkg1" + FS + "A.html",
+            "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " +
+            "Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:show(1);\">" +
+            "Static Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" +
+            "Instance Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" +
+            "Concrete Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t5\" class=\"tableTab\"><span><a href=\"javascript:show(16);\">" +
+            "Deprecated Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "</caption>"
+        },
+
+        {BUG_ID + FS + "pkg1" + FS + "A.html",
+            "<tr id=\"i0\" class=\"altColor\">"
+        },
+
+        {BUG_ID + FS + "pkg1" + FS + "B.html",
+            "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " +
+            "Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" +
+            "Instance Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
+            "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "</caption>"
+        },
+
+        {BUG_ID + FS + "pkg1" + FS + "D.html",
+            "var methods = {"
+        },
+
+        {BUG_ID + FS + "pkg1" + FS + "D.html",
+            "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " +
+            "Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" +
+            "Instance Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
+            "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" +
+            "Concrete Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t5\" class=\"tableTab\"><span><a href=\"javascript:show(16);\">" +
+            "Deprecated Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "</caption>"
+        },
+
+        {BUG_ID + FS + "pkg1" + FS + "D.html",
+            "<tr id=\"i0\" class=\"altColor\">"
+        },
+    };
+    private static final String[][] NEGATED_TEST = {
+        {BUG_ID + FS + "pkg1" + FS + "A.html",
+            "<caption><span>Methods</span><span class=\"tabEnd\">&nbsp;</span>" +
+            "</caption>"
+        },
+
+        {BUG_ID + FS + "pkg1" + FS + "B.html",
+            "<caption><span>Methods</span><span class=\"tabEnd\">&nbsp;</span>" +
+            "</caption>"
+        },
+
+        {BUG_ID + FS + "pkg" + FS + "D.html",
+            "<caption><span>Methods</span><span class=\"tabEnd\">&nbsp;</span>" +
+            "</caption>"
+        },
+    };
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestMethodTypes tester = new TestMethodTypes();
+        run(tester, ARGS, TEST, NEGATED_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testMethodTypes/pkg1/A.java	Mon Nov 19 16:10:34 2012 -0800
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2012, 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;
+
+/**
+ * This class has a mixture of different types of methods. The methods summary
+ * table should appear with "All Methods", "Static Methods", "Instance Methods",
+ * "Concrete Methods" and "Deprecated Methods".
+ */
+public class A {
+
+    /**
+     * This is the first concrete instance method.
+     */
+    public void readObject() {
+    }
+
+    /**
+     * This is the second concrete instance method.
+     */
+    public final void setStub() {
+    }
+
+    /**
+     * This is the third concrete instance method.
+     */
+    public String getParameter() {
+         return "test";
+     }
+
+    /**
+     * This is the first concrete instance deprecated method.
+     * @deprecated This is a deprecated method that should appear in the tab.
+     */
+    public void resize() {
+    }
+
+    /**
+     * This is the fourth concrete instance method.
+     */
+    public void showStatus() {
+    }
+
+    /**
+     * This is the first concrete static method.
+     */
+    public final static void staticMethod() {
+    }
+
+    /**
+     * This is the second concrete instance deprecated method.
+     */
+    @Deprecated
+    public void init() {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testMethodTypes/pkg1/B.java	Mon Nov 19 16:10:34 2012 -0800
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2012, 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;
+
+/**
+ * This interface has different types of methods such as "Instance Methods" and
+ * "Abstract Methods". All the tabs will display same list of methods.
+ */
+public interface B {
+
+    /**
+     * This is the first abstract instance method.
+     */
+    public void setName();
+
+    /**
+     * This is the second abstract instance method.
+     */
+    public String getName();
+
+    /**
+     * This is the third abstract instance method.
+     */
+    public boolean addEntry();
+
+    /**
+     * This is the fourth abstract instance method.
+     */
+    public boolean removeEntry();
+
+    /**
+     * This is the fifth abstract instance method.
+     */
+    public String getPermissions();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testMethodTypes/pkg1/D.java	Mon Nov 19 16:10:34 2012 -0800
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2012, 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;
+
+/**
+ * This class is marked as deprecated and has a mixture of different types of
+ * methods such as "Instance Methods", "Abstract Methods" and "Concrete
+ * Methods". None of the methods are marked as deprecated but since the class is
+ * deprecated, the methods will also be deprecated and "Deprecated Methods" tab
+ * will also be shown with all the methods.
+ */
+@Deprecated
+public abstract class D {
+
+    /**
+     * This is the first abstract instance method.
+     */
+    public abstract void readObject();
+
+    /**
+     * This is the first concrete instance method.
+     */
+    public final void setStub() {
+    }
+
+    /**
+     * This is the second concrete instance method.
+     */
+    public String getParameter() {
+         return "test";
+     }
+}
--- a/langtools/test/tools/javadoc/api/basic/APITest.java	Mon Nov 19 11:38:49 2012 -0800
+++ b/langtools/test/tools/javadoc/api/basic/APITest.java	Mon Nov 19 16:10:34 2012 -0800
@@ -201,8 +201,11 @@
         "pkg/package-tree.html",
         "resources/background.gif",
         "resources/tab.gif",
+        "resources/activetitlebar_end.gif",
+        "resources/activetitlebar.gif",
         "resources/titlebar_end.gif",
         "resources/titlebar.gif",
+        "script.js",
         "stylesheet.css"
     ));
 }