< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java

Print this page

        

@@ -34,10 +34,11 @@
 import javax.lang.model.type.TypeMirror;
 
 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
 import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.formats.html.markup.Table;
 import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
 import jdk.javadoc.internal.doclets.toolkit.Content;

@@ -107,12 +108,12 @@
     public Content getMethodDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) {
         memberDetailsTree.add(MarkerComments.START_OF_METHOD_DETAILS);
         Content methodDetailsTree = new ContentBuilder();
         Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
                 contents.methodDetailLabel);
-        methodDetailsTree.add(links.createAnchor(SectionName.METHOD_DETAIL));
         methodDetailsTree.add(heading);
+        methodDetailsTree.add(links.createAnchor(SectionName.METHOD_DETAIL));
         return methodDetailsTree;
     }
 
     /**
      * {@inheritDoc}

@@ -120,15 +121,16 @@
     @Override
     public Content getMethodDocTreeHeader(ExecutableElement method, Content methodDetailsTree) {
         String erasureAnchor;
         Content methodDocTree = new ContentBuilder();
         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
+        heading.add(name(method));
+        methodDocTree.add(heading);
         if ((erasureAnchor = getErasureAnchor(method)) != null) {
-            heading.add(links.createAnchor((erasureAnchor)));
+            methodDocTree.add(links.createAnchor((erasureAnchor)));
         }
-        heading.add(links.createAnchor(writer.getAnchor(method), new StringContent(name(method))));
-        methodDocTree.add(heading);
+        methodDocTree.add(links.createAnchor(writer.getAnchor(method)));
         return HtmlTree.SECTION(HtmlStyle.detail, methodDocTree);
     }
 
     /**
      * Get the signature for the given method.

@@ -136,16 +138,27 @@
      * @param method the method being documented.
      * @return a content object for the signature
      */
     @Override
     public Content getSignature(ExecutableElement method) {
-        return new MemberSignature(method)
-                .addTypeParameters(getTypeParameters(method))
-                .addReturnType(getReturnType(method))
-                .addParameters(getParameters(method, true))
-                .addExceptions(getExceptions(method))
-                .toContent();
+        HtmlTree pre = new HtmlTree(HtmlTag.PRE);
+        pre.setStyle(HtmlStyle.methodSignature);
+        writer.addAnnotationInfo(method, pre);
+        int annotationLength = pre.charCount();
+        addModifiers(method, pre);
+        addTypeParameters(method, pre);
+        addReturnType(method, pre);
+        if (configuration.linksource) {
+            Content methodName = new StringContent(name(method));
+            writer.addSrcLink(method, methodName, pre);
+        } else {
+            addName(name(method), pre);
+        }
+        int indent = pre.charCount() - annotationLength;
+        addParameters(method, pre, indent);
+        addExceptions(method, pre, indent);
+        return pre;
     }
 
     /**
      * {@inheritDoc}
      */

@@ -205,12 +218,13 @@
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public Content getMethodDoc(Content methodDocTree) {
-        return getMemberTree(methodDocTree);
+    public Content getMethodDoc(Content methodDocTree,
+            boolean isLastContent) {
+        return getMemberTree(methodDocTree, isLastContent);
     }
 
     /**
      * {@inheritDoc}
      */

@@ -383,21 +397,23 @@
             dl.add(dd);
         }
     }
 
     /**
-     * Get the return type for the given method.
+     * Add the return type.
      *
      * @param method the method being documented.
-     * @return content containing the return type
+     * @param htmltree the content tree to which the return type will be added
      */
-    protected Content getReturnType(ExecutableElement method) {
+    protected void addReturnType(ExecutableElement method, Content htmltree) {
         TypeMirror type = utils.getReturnType(method);
         if (type != null) {
-            return writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type));
+            Content linkContent = writer.getLink(
+                    new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type));
+            htmltree.add(linkContent);
+            htmltree.add(Entity.NO_BREAK_SPACE);
         }
-        return new ContentBuilder();
     }
 
     @Override
     public Content getMemberTreeHeader(){
         return writer.getMemberTreeHeader();
< prev index next >