< prev index next >

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

Print this page

        

@@ -71,10 +71,23 @@
 
     public AbstractExecutableMemberWriter(SubWriterHolderWriter writer) {
         super(writer);
     }
 
+    /**
+     * Add the type parameters for the executable member.
+     *
+     * @param member the member to write type parameters for.
+     * @param htmltree the content tree to which the parameters will be added.
+     */
+    protected void addTypeParameters(ExecutableElement member, Content htmltree) {
+        Content typeParameters = getTypeParameters(member);
+        if (!typeParameters.isEmpty()) {
+            htmltree.add(typeParameters);
+            htmltree.add(Entity.NO_BREAK_SPACE);
+        }
+    }
 
     /**
      * Get the type parameters for the executable member.
      *
      * @param member the member for which to get the type parameters.

@@ -119,11 +132,11 @@
         ExecutableElement ee = (ExecutableElement)member;
         Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink,
                 writer.getDocLink(context, te, ee,
                 name(ee), false));
         Content code = HtmlTree.CODE(memberLink);
-        addParameters(ee, code);
+        addParameters(ee, false, code, name(ee).length() - 1);
         tdSummary.add(code);
     }
 
     /**
      * Add the inherited summary link for the member.

@@ -159,11 +172,11 @@
     /**
      * Add the receiver annotations information.
      *
      * @param member the member to write receiver annotations for.
      * @param rcvrType the receiver type.
-     * @param annotationMirrors list of annotation descriptions.
+     * @param descList list of annotation description.
      * @param tree the content tree to which the information will be added.
      */
     protected void addReceiverAnnotations(ExecutableElement member, TypeMirror rcvrType,
             List<? extends AnnotationMirror> annotationMirrors, Content tree) {
         writer.addReceiverAnnotationInfo(member, rcvrType, annotationMirrors, tree);

@@ -180,50 +193,46 @@
      * Add all the parameters for the executable member.
      *
      * @param member the member to write parameters for.
      * @param htmltree the content tree to which the parameters information will be added.
      */
-    protected void addParameters(ExecutableElement member, Content htmltree) {
-        Content paramTree = getParameters(member, false);
-        if (paramTree.isEmpty()) {
-            htmltree.add("()");
-        } else {
-            htmltree.add(Entity.ZERO_WIDTH_SPACE);
-            htmltree.add("(");
-            htmltree.add(paramTree);
-            paramTree.add(")");
-        }
+    protected void addParameters(ExecutableElement member, Content htmltree, int indentSize) {
+        addParameters(member, true, htmltree, indentSize);
     }
 
     /**
      * Add all the parameters for the executable member.
      *
      * @param member the member to write parameters for.
      * @param includeAnnotations true if annotation information needs to be added.
-     * @return the content tree containing the parameter information
+     * @param htmltree the content tree to which the parameters information will be added.
      */
-    protected Content getParameters(ExecutableElement member, boolean includeAnnotations) {
+    protected void addParameters(ExecutableElement member,
+            boolean includeAnnotations, Content htmltree, int indentSize) {
         Content paramTree = new ContentBuilder();
         String sep = "";
         List<? extends VariableElement> parameters = member.getParameters();
+        CharSequence indent = makeSpace(indentSize + 1);
         TypeMirror rcvrType = member.getReceiverType();
         if (includeAnnotations && rcvrType != null && utils.isAnnotated(rcvrType)) {
             List<? extends AnnotationMirror> annotationMirrors = rcvrType.getAnnotationMirrors();
             addReceiverAnnotations(member, rcvrType, annotationMirrors, paramTree);
-            sep = "," + DocletConstants.NL;
+            sep = "," + DocletConstants.NL + indent;
         }
         int paramstart;
         for (paramstart = 0; paramstart < parameters.size(); paramstart++) {
             paramTree.add(sep);
             VariableElement param = parameters.get(paramstart);
 
             if (param.getKind() != ElementKind.INSTANCE_INIT) {
                 if (includeAnnotations) {
                     boolean foundAnnotations =
-                            writer.addAnnotationInfo(param, paramTree);
+                            writer.addAnnotationInfo(indent.length(),
+                            member, param, paramTree);
                     if (foundAnnotations) {
                         paramTree.add(DocletConstants.NL);
+                        paramTree.add(indent);
                     }
                 }
                 addParam(member, param,
                     (paramstart == parameters.size() - 1) && member.isVarArgs(), paramTree);
                 break;

@@ -231,46 +240,58 @@
         }
 
         for (int i = paramstart + 1; i < parameters.size(); i++) {
             paramTree.add(",");
             paramTree.add(DocletConstants.NL);
+            paramTree.add(indent);
             if (includeAnnotations) {
                 boolean foundAnnotations =
-                        writer.addAnnotationInfo(parameters.get(i),
+                        writer.addAnnotationInfo(indent.length(), member, parameters.get(i),
                         paramTree);
                 if (foundAnnotations) {
                     paramTree.add(DocletConstants.NL);
+                    paramTree.add(indent);
                 }
             }
             addParam(member, parameters.get(i), (i == parameters.size() - 1) && member.isVarArgs(),
                     paramTree);
         }
-
-        return paramTree;
+        if (paramTree.isEmpty()) {
+            htmltree.add("()");
+        } else {
+            htmltree.add(Entity.ZERO_WIDTH_SPACE);
+            htmltree.add("(");
+            htmltree.add(paramTree);
+            paramTree.add(")");
+        }
     }
 
     /**
-     * Get a content tree containing the exception information for the executable member.
+     * Add exceptions for the executable member.
      *
      * @param member the member to write exceptions for.
-     * @return the content tree containing the exceptions information.
+     * @param htmltree the content tree to which the exceptions information will be added.
      */
-    protected Content getExceptions(ExecutableElement member) {
+    protected void addExceptions(ExecutableElement member, Content htmltree, int indentSize) {
         List<? extends TypeMirror> exceptions = member.getThrownTypes();
-        Content htmltree = new ContentBuilder();
         if (!exceptions.isEmpty()) {
+            CharSequence indent = makeSpace(indentSize + 1 - 7);
+            htmltree.add(DocletConstants.NL);
+            htmltree.add(indent);
+            htmltree.add("throws ");
+            indent = makeSpace(indentSize + 1);
             Content link = writer.getLink(new LinkInfoImpl(configuration, MEMBER, exceptions.get(0)));
             htmltree.add(link);
             for(int i = 1; i < exceptions.size(); i++) {
                 htmltree.add(",");
                 htmltree.add(DocletConstants.NL);
+                htmltree.add(indent);
                 Content exceptionLink = writer.getLink(new LinkInfoImpl(configuration, MEMBER,
                         exceptions.get(i)));
                 htmltree.add(exceptionLink);
             }
         }
-        return htmltree;
     }
 
     protected TypeElement implementsMethodInIntfac(ExecutableElement method,
                                                 List<TypeElement> intfacs) {
         for (TypeElement intf : intfacs) {
< prev index next >