< prev index next >

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

Print this page




  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 java.util.Arrays;
  29 import java.util.List;
  30 
  31 import javax.lang.model.element.Element;
  32 import javax.lang.model.element.TypeElement;
  33 import javax.lang.model.element.VariableElement;
  34 
  35 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
  36 import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
  37 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;

  38 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
  39 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
  40 import jdk.javadoc.internal.doclets.formats.html.markup.Table;
  41 import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
  42 import jdk.javadoc.internal.doclets.toolkit.Content;
  43 import jdk.javadoc.internal.doclets.toolkit.FieldWriter;
  44 import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
  45 
  46 /**
  47  * Writes field 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 Robert Field
  55  * @author Atul M Dambalkar
  56  * @author Jamie Ho (rewrite)
  57  * @author Bhavesh Patel (Modified)


  79         return memberTree;
  80     }
  81 
  82     /**
  83      * {@inheritDoc}
  84      */
  85     @Override
  86     public void addMemberTree(Content memberSummaryTree, Content memberTree) {
  87         writer.addMemberTree(HtmlStyle.fieldSummary, memberSummaryTree, memberTree);
  88     }
  89 
  90     /**
  91      * {@inheritDoc}
  92      */
  93     @Override
  94     public Content getFieldDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) {
  95         memberDetailsTree.add(MarkerComments.START_OF_FIELD_DETAILS);
  96         Content fieldDetailsTree = new ContentBuilder();
  97         Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
  98                 contents.fieldDetailsLabel);

  99         fieldDetailsTree.add(links.createAnchor(
 100                 SectionName.FIELD_DETAIL));
 101         fieldDetailsTree.add(heading);
 102         return fieldDetailsTree;
 103     }
 104 
 105     /**
 106      * {@inheritDoc}
 107      */
 108     @Override
 109     public Content getFieldDocTreeHeader(VariableElement field, Content fieldDetailsTree) {
 110         Content fieldTree = new ContentBuilder();
 111         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
 112         heading.add(links.createAnchor(name(field), new StringContent(name(field))));
 113         fieldTree.add(heading);

 114         return HtmlTree.SECTION(HtmlStyle.detail, fieldTree);
 115     }
 116 
 117     /**
 118      * {@inheritDoc}
 119      */
 120     @Override
 121     public Content getSignature(VariableElement field) {
 122         return new MemberSignature(field)
 123                 .addType(field.asType())
 124                 .toContent();











 125     }
 126 
 127     /**
 128      * {@inheritDoc}
 129      */
 130     @Override
 131     public void addDeprecated(VariableElement field, Content fieldTree) {
 132         addDeprecatedInfo(field, fieldTree);
 133     }
 134 
 135     /**
 136      * {@inheritDoc}
 137      */
 138     @Override
 139     public void addComments(VariableElement field, Content fieldTree) {
 140         if (!utils.getFullBody(field).isEmpty()) {
 141             writer.addInlineComment(field, fieldTree);
 142         }
 143     }
 144 


 146      * {@inheritDoc}
 147      */
 148     @Override
 149     public void addTags(VariableElement field, Content fieldTree) {
 150         writer.addTagsInfo(field, fieldTree);
 151     }
 152 
 153     /**
 154      * {@inheritDoc}
 155      */
 156     @Override
 157     public Content getFieldDetails(Content fieldDetailsTreeHeader, Content fieldDetailsTree) {
 158         Content fieldDetails = new ContentBuilder(fieldDetailsTreeHeader, fieldDetailsTree);
 159         return getMemberTree(HtmlTree.SECTION(HtmlStyle.fieldDetails, fieldDetails));
 160     }
 161 
 162     /**
 163      * {@inheritDoc}
 164      */
 165     @Override
 166     public Content getFieldDoc(Content fieldTree) {
 167         return getMemberTree(fieldTree);

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




  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 java.util.Arrays;
  29 import java.util.List;
  30 
  31 import javax.lang.model.element.Element;
  32 import javax.lang.model.element.TypeElement;
  33 import javax.lang.model.element.VariableElement;
  34 
  35 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
  36 import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
  37 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
  38 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
  39 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
  40 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
  41 import jdk.javadoc.internal.doclets.formats.html.markup.Table;
  42 import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
  43 import jdk.javadoc.internal.doclets.toolkit.Content;
  44 import jdk.javadoc.internal.doclets.toolkit.FieldWriter;
  45 import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
  46 
  47 /**
  48  * Writes field documentation in HTML format.
  49  *
  50  *  <p><b>This is NOT part of any supported API.
  51  *  If you write code that depends on this, you do so at your own risk.
  52  *  This code and its internal interfaces are subject to change or
  53  *  deletion without notice.</b>
  54  *
  55  * @author Robert Field
  56  * @author Atul M Dambalkar
  57  * @author Jamie Ho (rewrite)
  58  * @author Bhavesh Patel (Modified)


  80         return memberTree;
  81     }
  82 
  83     /**
  84      * {@inheritDoc}
  85      */
  86     @Override
  87     public void addMemberTree(Content memberSummaryTree, Content memberTree) {
  88         writer.addMemberTree(HtmlStyle.fieldSummary, memberSummaryTree, memberTree);
  89     }
  90 
  91     /**
  92      * {@inheritDoc}
  93      */
  94     @Override
  95     public Content getFieldDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) {
  96         memberDetailsTree.add(MarkerComments.START_OF_FIELD_DETAILS);
  97         Content fieldDetailsTree = new ContentBuilder();
  98         Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
  99                 contents.fieldDetailsLabel);
 100         fieldDetailsTree.add(heading);
 101         fieldDetailsTree.add(links.createAnchor(
 102                 SectionName.FIELD_DETAIL));

 103         return fieldDetailsTree;
 104     }
 105 
 106     /**
 107      * {@inheritDoc}
 108      */
 109     @Override
 110     public Content getFieldDocTreeHeader(VariableElement field, Content fieldDetailsTree) {
 111         Content fieldTree = new ContentBuilder();
 112         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
 113         heading.add(name(field));
 114         fieldTree.add(heading);
 115         fieldTree.add(links.createAnchor(name(field)));
 116         return HtmlTree.SECTION(HtmlStyle.detail, fieldTree);
 117     }
 118 
 119     /**
 120      * {@inheritDoc}
 121      */
 122     @Override
 123     public Content getSignature(VariableElement field) {
 124         Content pre = new HtmlTree(HtmlTag.PRE);
 125         writer.addAnnotationInfo(field, pre);
 126         addModifiers(field, pre);
 127         Content fieldlink = writer.getLink(new LinkInfoImpl(
 128                 configuration, LinkInfoImpl.Kind.MEMBER, field.asType()));
 129         pre.add(fieldlink);
 130         pre.add(" ");
 131         if (configuration.linksource) {
 132             Content fieldName = new StringContent(name(field));
 133             writer.addSrcLink(field, fieldName, pre);
 134         } else {
 135             addName(name(field), pre);
 136         }
 137         return pre;
 138     }
 139 
 140     /**
 141      * {@inheritDoc}
 142      */
 143     @Override
 144     public void addDeprecated(VariableElement field, Content fieldTree) {
 145         addDeprecatedInfo(field, fieldTree);
 146     }
 147 
 148     /**
 149      * {@inheritDoc}
 150      */
 151     @Override
 152     public void addComments(VariableElement field, Content fieldTree) {
 153         if (!utils.getFullBody(field).isEmpty()) {
 154             writer.addInlineComment(field, fieldTree);
 155         }
 156     }
 157 


 159      * {@inheritDoc}
 160      */
 161     @Override
 162     public void addTags(VariableElement field, Content fieldTree) {
 163         writer.addTagsInfo(field, fieldTree);
 164     }
 165 
 166     /**
 167      * {@inheritDoc}
 168      */
 169     @Override
 170     public Content getFieldDetails(Content fieldDetailsTreeHeader, Content fieldDetailsTree) {
 171         Content fieldDetails = new ContentBuilder(fieldDetailsTreeHeader, fieldDetailsTree);
 172         return getMemberTree(HtmlTree.SECTION(HtmlStyle.fieldDetails, fieldDetails));
 173     }
 174 
 175     /**
 176      * {@inheritDoc}
 177      */
 178     @Override
 179     public Content getFieldDoc(Content fieldTree,
 180             boolean isLastContent) {
 181         return getMemberTree(fieldTree, isLastContent);
 182     }
 183 
 184     /**
 185      * {@inheritDoc}
 186      */
 187     @Override
 188     public void addSummaryLabel(Content memberTree) {
 189         Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
 190                 contents.fieldSummaryLabel);
 191         memberTree.add(label);
 192     }
 193 
 194     /**
 195      * {@inheritDoc}
 196      */
 197     @Override
 198     public TableHeader getSummaryTableHeader(Element member) {
 199         return new TableHeader(contents.modifierAndTypeLabel, contents.fieldLabel,
 200                 contents.descriptionLabel);
 201     }


< prev index next >