< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.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.AnnotationTypeFieldWriter;
  40 import jdk.javadoc.internal.doclets.toolkit.Content;
  41 import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
  42 
  43 /**
  44  * Writes annotation type field documentation in HTML format.
  45  *
  46  *  <p><b>This is NOT part of any supported API.
  47  *  If you write code that depends on this, you do so at your own risk.
  48  *  This code and its internal interfaces are subject to change or
  49  *  deletion without notice.</b>
  50  *
  51  * @author Bhavesh Patel
  52  */
  53 public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
  54     implements AnnotationTypeFieldWriter, MemberSummaryWriter {


  88      */
  89     public void addMemberTree(Content memberSummaryTree, Content memberTree) {
  90         writer.addMemberTree(HtmlStyle.fieldSummary, memberSummaryTree, memberTree);
  91     }
  92 
  93     /**
  94      * {@inheritDoc}
  95      */
  96     public void addAnnotationFieldDetailsMarker(Content memberDetails) {
  97         memberDetails.add(MarkerComments.START_OF_ANNOTATION_TYPE_FIELD_DETAILS);
  98     }
  99 
 100     /**
 101      * {@inheritDoc}
 102      */
 103     public Content getAnnotationDetailsTreeHeader(TypeElement typeElement) {
 104         Content memberDetailsTree = new ContentBuilder();
 105         if (!writer.printedAnnotationFieldHeading) {
 106             Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
 107                     contents.fieldDetailsLabel);

 108             memberDetailsTree.add(links.createAnchor(
 109                     SectionName.ANNOTATION_TYPE_FIELD_DETAIL));
 110             memberDetailsTree.add(heading);
 111             writer.printedAnnotationFieldHeading = true;
 112         }
 113         return memberDetailsTree;
 114     }
 115 
 116     /**
 117      * {@inheritDoc}
 118      */
 119     public Content getAnnotationDocTreeHeader(Element member,
 120             Content annotationDetailsTree) {
 121         Content annotationDocTree = new ContentBuilder();
 122         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
 123         heading.add(links.createAnchor(name(member), new StringContent(name(member))));
 124         annotationDocTree.add(heading);

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












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

 173     }
 174 
 175     /**
 176      * {@inheritDoc}
 177      */
 178     public void addSummaryLabel(Content memberTree) {
 179         Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
 180                 contents.fieldSummaryLabel);
 181         memberTree.add(label);
 182     }
 183 
 184     /**
 185      * {@inheritDoc}
 186      */
 187     @Override
 188     public TableHeader getSummaryTableHeader(Element member) {
 189         return new TableHeader(contents.modifierAndTypeLabel, contents.fields,
 190                 contents.descriptionLabel);
 191     }
 192 




  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.AnnotationTypeFieldWriter;
  42 import jdk.javadoc.internal.doclets.toolkit.Content;
  43 import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
  44 
  45 /**
  46  * Writes annotation type field documentation in HTML format.
  47  *
  48  *  <p><b>This is NOT part of any supported API.
  49  *  If you write code that depends on this, you do so at your own risk.
  50  *  This code and its internal interfaces are subject to change or
  51  *  deletion without notice.</b>
  52  *
  53  * @author Bhavesh Patel
  54  */
  55 public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
  56     implements AnnotationTypeFieldWriter, MemberSummaryWriter {


  90      */
  91     public void addMemberTree(Content memberSummaryTree, Content memberTree) {
  92         writer.addMemberTree(HtmlStyle.fieldSummary, memberSummaryTree, memberTree);
  93     }
  94 
  95     /**
  96      * {@inheritDoc}
  97      */
  98     public void addAnnotationFieldDetailsMarker(Content memberDetails) {
  99         memberDetails.add(MarkerComments.START_OF_ANNOTATION_TYPE_FIELD_DETAILS);
 100     }
 101 
 102     /**
 103      * {@inheritDoc}
 104      */
 105     public Content getAnnotationDetailsTreeHeader(TypeElement typeElement) {
 106         Content memberDetailsTree = new ContentBuilder();
 107         if (!writer.printedAnnotationFieldHeading) {
 108             Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
 109                     contents.fieldDetailsLabel);
 110             memberDetailsTree.add(heading);
 111             memberDetailsTree.add(links.createAnchor(
 112                     SectionName.ANNOTATION_TYPE_FIELD_DETAIL));

 113             writer.printedAnnotationFieldHeading = true;
 114         }
 115         return memberDetailsTree;
 116     }
 117 
 118     /**
 119      * {@inheritDoc}
 120      */
 121     public Content getAnnotationDocTreeHeader(Element member,
 122             Content annotationDetailsTree) {
 123         Content annotationDocTree = new ContentBuilder();
 124         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
 125         heading.add(name(member));
 126         annotationDocTree.add(heading);
 127         annotationDocTree.add(links.createAnchor(name(member)));
 128         return HtmlTree.SECTION(HtmlStyle.detail, annotationDocTree);
 129     }
 130 
 131     /**
 132      * {@inheritDoc}
 133      */
 134     public Content getSignature(Element member) {
 135         Content pre = new HtmlTree(HtmlTag.PRE);
 136         writer.addAnnotationInfo(member, pre);
 137         addModifiers(member, pre);
 138         Content link =
 139                 writer.getLink(new LinkInfoImpl(configuration,
 140                         LinkInfoImpl.Kind.MEMBER, getType(member)));
 141         pre.add(link);
 142         pre.add(Entity.NO_BREAK_SPACE);
 143         if (configuration.linksource) {
 144             Content memberName = new StringContent(name(member));
 145             writer.addSrcLink(member, memberName, pre);
 146         } else {
 147             addName(name(member), pre);
 148         }
 149         return pre;
 150     }
 151 
 152     /**
 153      * {@inheritDoc}
 154      */
 155     public void addDeprecated(Element member, Content annotationDocTree) {
 156         addDeprecatedInfo(member, annotationDocTree);
 157     }
 158 
 159     /**
 160      * {@inheritDoc}
 161      */
 162     public void addComments(Element member, Content annotationDocTree) {
 163         addComment(member, annotationDocTree);
 164     }
 165 
 166     /**
 167      * {@inheritDoc}
 168      */
 169     public void addTags(Element member, Content annotationDocTree) {
 170         writer.addTagsInfo(member, annotationDocTree);
 171     }
 172 
 173     /**
 174      * {@inheritDoc}
 175      */
 176     public Content getAnnotationDetails(Content annotationDetailsTreeHeader, Content annotationDetailsTree) {
 177         Content annotationDetails = new ContentBuilder();
 178         annotationDetails.add(annotationDetailsTreeHeader);
 179         annotationDetails.add(annotationDetailsTree);
 180         return getMemberTree(HtmlTree.SECTION(HtmlStyle.fieldDetails, annotationDetails));
 181     }
 182 
 183     /**
 184      * {@inheritDoc}
 185      */
 186     public Content getAnnotationDoc(Content annotationDocTree,
 187             boolean isLastContent) {
 188         return getMemberTree(annotationDocTree, isLastContent);
 189     }
 190 
 191     /**
 192      * {@inheritDoc}
 193      */
 194     public void addSummaryLabel(Content memberTree) {
 195         Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
 196                 contents.fieldSummaryLabel);
 197         memberTree.add(label);
 198     }
 199 
 200     /**
 201      * {@inheritDoc}
 202      */
 203     @Override
 204     public TableHeader getSummaryTableHeader(Element member) {
 205         return new TableHeader(contents.modifierAndTypeLabel, contents.fields,
 206                 contents.descriptionLabel);
 207     }
 208 


< prev index next >