< prev index next >

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

Print this page




  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.javadoc.internal.doclets.formats.html;
  27 
  28 import javax.lang.model.element.Element;
  29 import javax.lang.model.element.ExecutableElement;
  30 import javax.lang.model.element.TypeElement;
  31 import javax.lang.model.type.TypeMirror;
  32 
  33 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;

  34 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;

  35 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
  36 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
  37 import jdk.javadoc.internal.doclets.formats.html.markup.Table;
  38 import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
  39 import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeRequiredMemberWriter;
  40 import jdk.javadoc.internal.doclets.toolkit.Content;
  41 import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
  42 
  43 
  44 /**
  45  * Writes annotation type required member documentation in HTML format.
  46  *
  47  *  <p><b>This is NOT part of any supported API.
  48  *  If you write code that depends on this, you do so at your own risk.
  49  *  This code and its internal interfaces are subject to change or
  50  *  deletion without notice.</b>
  51  *
  52  * @author Jamie Ho
  53  * @author Bhavesh Patel (Modified)
  54  */


  90      */
  91     public void addMemberTree(Content memberSummaryTree, Content memberTree) {
  92         writer.addMemberTree(HtmlStyle.memberSummary, memberSummaryTree, memberTree);
  93     }
  94 
  95     /**
  96      * {@inheritDoc}
  97      */
  98     public void addAnnotationDetailsMarker(Content memberDetails) {
  99         memberDetails.add(MarkerComments.START_OF_ANNOTATION_TYPE_DETAILS);
 100     }
 101 
 102     /**
 103      * {@inheritDoc}
 104      */
 105     public Content getAnnotationDetailsTreeHeader(TypeElement te) {
 106         Content memberDetailsTree = new ContentBuilder();
 107         if (!writer.printedAnnotationHeading) {
 108             Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
 109                     contents.annotationTypeDetailsLabel);

 110             memberDetailsTree.add(links.createAnchor(
 111                     SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL));
 112             memberDetailsTree.add(heading);
 113             writer.printedAnnotationHeading = true;
 114         }
 115         return memberDetailsTree;
 116     }
 117 
 118     /**
 119      * {@inheritDoc}
 120      */
 121     @Override
 122     public Content getAnnotationDocTreeHeader(Element member, Content annotationDetailsTree) {
 123         String simpleName = name(member);
 124         Content annotationDocTree = new ContentBuilder();
 125         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
 126         heading.add(links.createAnchor(
 127                 simpleName + utils.signature((ExecutableElement) member), new StringContent(simpleName)));
 128         annotationDocTree.add(heading);


 129         return HtmlTree.SECTION(HtmlStyle.detail, annotationDocTree);
 130     }
 131 
 132     /**
 133      * {@inheritDoc}
 134      */
 135     public Content getSignature(Element member) {
 136         return new MemberSignature(member)
 137                 .addType(getType(member))
 138                 .toContent();












 139     }
 140 
 141     /**
 142      * {@inheritDoc}
 143      */
 144     public void addDeprecated(Element member, Content annotationDocTree) {
 145         addDeprecatedInfo(member, annotationDocTree);
 146     }
 147 
 148     /**
 149      * {@inheritDoc}
 150      */
 151     public void addComments(Element member, Content annotationDocTree) {
 152         addComment(member, annotationDocTree);
 153     }
 154 
 155     /**
 156      * {@inheritDoc}
 157      */
 158     public void addTags(Element member, Content annotationDocTree) {
 159         writer.addTagsInfo(member, annotationDocTree);
 160     }
 161 
 162     /**
 163      * {@inheritDoc}
 164      */
 165     public Content getAnnotationDetails(Content annotationDetailsTreeHeader, Content annotationDetailsTree) {
 166         Content annotationDetails = new ContentBuilder(annotationDetailsTreeHeader, annotationDetailsTree);
 167         return getMemberTree(HtmlTree.SECTION(HtmlStyle.memberDetails, annotationDetails));
 168     }
 169 
 170     /**
 171      * {@inheritDoc}
 172      */
 173     public Content getAnnotationDoc(Content annotationDocTree) {
 174         return getMemberTree(annotationDocTree);

 175     }
 176 
 177     /**
 178      * {@inheritDoc}
 179      */
 180     public void addSummaryLabel(Content memberTree) {
 181         Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
 182                 contents.annotateTypeRequiredMemberSummaryLabel);
 183         memberTree.add(label);
 184     }
 185 
 186     /**
 187      * Get the caption for the summary table.
 188      * @return the caption
 189      */
 190     // Overridden by AnnotationTypeOptionalMemberWriterImpl
 191     protected Content getCaption() {
 192         return contents.getContent("doclet.Annotation_Type_Required_Members");
 193     }
 194 




  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.javadoc.internal.doclets.formats.html;
  27 
  28 import javax.lang.model.element.Element;
  29 import javax.lang.model.element.ExecutableElement;
  30 import javax.lang.model.element.TypeElement;
  31 import javax.lang.model.type.TypeMirror;
  32 
  33 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
  34 import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
  35 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
  36 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
  37 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
  38 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
  39 import jdk.javadoc.internal.doclets.formats.html.markup.Table;
  40 import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
  41 import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeRequiredMemberWriter;
  42 import jdk.javadoc.internal.doclets.toolkit.Content;
  43 import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
  44 
  45 
  46 /**
  47  * Writes annotation type required member documentation in HTML format.
  48  *
  49  *  <p><b>This is NOT part of any supported API.
  50  *  If you write code that depends on this, you do so at your own risk.
  51  *  This code and its internal interfaces are subject to change or
  52  *  deletion without notice.</b>
  53  *
  54  * @author Jamie Ho
  55  * @author Bhavesh Patel (Modified)
  56  */


  92      */
  93     public void addMemberTree(Content memberSummaryTree, Content memberTree) {
  94         writer.addMemberTree(HtmlStyle.memberSummary, memberSummaryTree, memberTree);
  95     }
  96 
  97     /**
  98      * {@inheritDoc}
  99      */
 100     public void addAnnotationDetailsMarker(Content memberDetails) {
 101         memberDetails.add(MarkerComments.START_OF_ANNOTATION_TYPE_DETAILS);
 102     }
 103 
 104     /**
 105      * {@inheritDoc}
 106      */
 107     public Content getAnnotationDetailsTreeHeader(TypeElement te) {
 108         Content memberDetailsTree = new ContentBuilder();
 109         if (!writer.printedAnnotationHeading) {
 110             Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
 111                     contents.annotationTypeDetailsLabel);
 112             memberDetailsTree.add(heading);
 113             memberDetailsTree.add(links.createAnchor(
 114                     SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL));

 115             writer.printedAnnotationHeading = true;
 116         }
 117         return memberDetailsTree;
 118     }
 119 
 120     /**
 121      * {@inheritDoc}
 122      */
 123     @Override
 124     public Content getAnnotationDocTreeHeader(Element member, Content annotationDetailsTree) {
 125         String simpleName = name(member);
 126         Content annotationDocTree = new ContentBuilder();
 127         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
 128         heading.add(simpleName);

 129         annotationDocTree.add(heading);
 130         annotationDocTree.add(links.createAnchor(
 131                 simpleName + utils.signature((ExecutableElement) member)));
 132         return HtmlTree.SECTION(HtmlStyle.detail, annotationDocTree);
 133     }
 134 
 135     /**
 136      * {@inheritDoc}
 137      */
 138     public Content getSignature(Element member) {
 139         Content pre = new HtmlTree(HtmlTag.PRE);
 140         writer.addAnnotationInfo(member, pre);
 141         addModifiers(member, pre);
 142         Content link =
 143                 writer.getLink(new LinkInfoImpl(configuration,
 144                         LinkInfoImpl.Kind.MEMBER, getType(member)));
 145         pre.add(link);
 146         pre.add(Entity.NO_BREAK_SPACE);
 147         if (configuration.linksource) {
 148             Content memberName = new StringContent(name(member));
 149             writer.addSrcLink(member, memberName, pre);
 150         } else {
 151             addName(name(member), pre);
 152         }
 153         return pre;
 154     }
 155 
 156     /**
 157      * {@inheritDoc}
 158      */
 159     public void addDeprecated(Element member, Content annotationDocTree) {
 160         addDeprecatedInfo(member, annotationDocTree);
 161     }
 162 
 163     /**
 164      * {@inheritDoc}
 165      */
 166     public void addComments(Element member, Content annotationDocTree) {
 167         addComment(member, annotationDocTree);
 168     }
 169 
 170     /**
 171      * {@inheritDoc}
 172      */
 173     public void addTags(Element member, Content annotationDocTree) {
 174         writer.addTagsInfo(member, annotationDocTree);
 175     }
 176 
 177     /**
 178      * {@inheritDoc}
 179      */
 180     public Content getAnnotationDetails(Content annotationDetailsTreeHeader, Content annotationDetailsTree) {
 181         Content annotationDetails = new ContentBuilder(annotationDetailsTreeHeader, annotationDetailsTree);
 182         return getMemberTree(HtmlTree.SECTION(HtmlStyle.memberDetails, annotationDetails));
 183     }
 184 
 185     /**
 186      * {@inheritDoc}
 187      */
 188     public Content getAnnotationDoc(Content annotationDocTree,
 189             boolean isLastContent) {
 190         return getMemberTree(annotationDocTree, isLastContent);
 191     }
 192 
 193     /**
 194      * {@inheritDoc}
 195      */
 196     public void addSummaryLabel(Content memberTree) {
 197         Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
 198                 contents.annotateTypeRequiredMemberSummaryLabel);
 199         memberTree.add(label);
 200     }
 201 
 202     /**
 203      * Get the caption for the summary table.
 204      * @return the caption
 205      */
 206     // Overridden by AnnotationTypeOptionalMemberWriterImpl
 207     protected Content getCaption() {
 208         return contents.getContent("doclet.Annotation_Type_Required_Members");
 209     }
 210 


< prev index next >