< prev index next >

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

Print this page




  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 
  32 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
  33 import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
  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.Content;
  40 import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
  41 import jdk.javadoc.internal.doclets.toolkit.PropertyWriter;
  42 
  43 /**
  44  * Writes property 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 Robert Field
  52  * @author Atul M Dambalkar
  53  * @author Jamie Ho (rewrite)
  54  * @author Bhavesh Patel (Modified)


  72     }
  73 
  74     /**
  75      * {@inheritDoc}
  76      */
  77     @Override
  78     public void addMemberTree(Content memberSummaryTree, Content memberTree) {
  79         writer.addMemberTree(HtmlStyle.propertySummary, memberSummaryTree, memberTree);
  80     }
  81 
  82     /**
  83      * {@inheritDoc}
  84      */
  85     @Override
  86     public Content getPropertyDetailsTreeHeader(TypeElement typeElement,
  87             Content memberDetailsTree) {
  88         memberDetailsTree.add(MarkerComments.START_OF_PROPERTY_DETAILS);
  89         Content propertyDetailsTree = new ContentBuilder();
  90         Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
  91                 contents.propertyDetailsLabel);
  92         propertyDetailsTree.add(links.createAnchor(SectionName.PROPERTY_DETAIL));
  93         propertyDetailsTree.add(heading);

  94         return propertyDetailsTree;
  95     }
  96 
  97     /**
  98      * {@inheritDoc}
  99      */
 100     @Override
 101     public Content getPropertyDocTreeHeader(ExecutableElement property,
 102             Content propertyDetailsTree) {
 103         Content propertyDocTree = new ContentBuilder();
 104         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
 105         heading.add(links.createAnchor(name(property),
 106                 new StringContent(utils.getPropertyLabel(name(property)))));
 107         propertyDocTree.add(heading);

 108         return HtmlTree.SECTION(HtmlStyle.detail, propertyDocTree);
 109     }
 110 
 111     /**
 112      * {@inheritDoc}
 113      */
 114     @Override
 115     public Content getSignature(ExecutableElement property) {
 116         return new MemberSignature(property)
 117                 .addType(utils.getReturnType(property))
 118                 .toContent();












 119     }
 120 
 121     /**
 122      * {@inheritDoc}
 123      */
 124     @Override
 125     public void addDeprecated(ExecutableElement property, Content propertyDocTree) {
 126     }
 127 
 128     /**
 129      * {@inheritDoc}
 130      */
 131     @Override
 132     public void addComments(ExecutableElement property, Content propertyDocTree) {
 133         TypeElement holder = (TypeElement)property.getEnclosingElement();
 134         if (!utils.getFullBody(property).isEmpty()) {
 135             if (holder.equals(typeElement) ||
 136                     (!utils.isPublic(holder) || utils.isLinkable(holder))) {
 137                 writer.addInlineComment(property, propertyDocTree);
 138             } else {


 159      * {@inheritDoc}
 160      */
 161     @Override
 162     public void addTags(ExecutableElement property, Content propertyDocTree) {
 163         writer.addTagsInfo(property, propertyDocTree);
 164     }
 165 
 166     /**
 167      * {@inheritDoc}
 168      */
 169     @Override
 170     public Content getPropertyDetails(Content propertyDetailsTreeHeader, Content propertyDetailsTree) {
 171         Content propertyDetails = new ContentBuilder(propertyDetailsTreeHeader, propertyDetailsTree);
 172         return getMemberTree(HtmlTree.SECTION(HtmlStyle.propertyDetails, propertyDetails));
 173     }
 174 
 175     /**
 176      * {@inheritDoc}
 177      */
 178     @Override
 179     public Content getPropertyDoc(Content propertyDocTree) {
 180         return getMemberTree(propertyDocTree);

 181     }
 182 
 183     /**
 184      * {@inheritDoc}
 185      */
 186     @Override
 187     public void addSummaryLabel(Content memberTree) {
 188         Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
 189                 contents.propertySummaryLabel);
 190         memberTree.add(label);
 191     }
 192 
 193     /**
 194      * {@inheritDoc}
 195      */
 196     @Override
 197     public TableHeader getSummaryTableHeader(Element member) {
 198         return new TableHeader(contents.typeLabel, contents.propertyLabel,
 199                 contents.descriptionLabel);
 200     }




  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 
  32 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
  33 import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
  34 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
  35 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
  36 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
  37 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
  38 import jdk.javadoc.internal.doclets.formats.html.markup.Table;
  39 import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
  40 import jdk.javadoc.internal.doclets.toolkit.Content;
  41 import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
  42 import jdk.javadoc.internal.doclets.toolkit.PropertyWriter;
  43 
  44 /**
  45  * Writes property 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 Robert Field
  53  * @author Atul M Dambalkar
  54  * @author Jamie Ho (rewrite)
  55  * @author Bhavesh Patel (Modified)


  73     }
  74 
  75     /**
  76      * {@inheritDoc}
  77      */
  78     @Override
  79     public void addMemberTree(Content memberSummaryTree, Content memberTree) {
  80         writer.addMemberTree(HtmlStyle.propertySummary, memberSummaryTree, memberTree);
  81     }
  82 
  83     /**
  84      * {@inheritDoc}
  85      */
  86     @Override
  87     public Content getPropertyDetailsTreeHeader(TypeElement typeElement,
  88             Content memberDetailsTree) {
  89         memberDetailsTree.add(MarkerComments.START_OF_PROPERTY_DETAILS);
  90         Content propertyDetailsTree = new ContentBuilder();
  91         Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
  92                 contents.propertyDetailsLabel);

  93         propertyDetailsTree.add(heading);
  94         propertyDetailsTree.add(links.createAnchor(SectionName.PROPERTY_DETAIL));
  95         return propertyDetailsTree;
  96     }
  97 
  98     /**
  99      * {@inheritDoc}
 100      */
 101     @Override
 102     public Content getPropertyDocTreeHeader(ExecutableElement property,
 103             Content propertyDetailsTree) {
 104         Content propertyDocTree = new ContentBuilder();
 105         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
 106         heading.add(utils.getPropertyLabel(name(property)));

 107         propertyDocTree.add(heading);
 108         propertyDocTree.add(links.createAnchor(name(property)));
 109         return HtmlTree.SECTION(HtmlStyle.detail, propertyDocTree);
 110     }
 111 
 112     /**
 113      * {@inheritDoc}
 114      */
 115     @Override
 116     public Content getSignature(ExecutableElement property) {
 117         Content pre = new HtmlTree(HtmlTag.PRE);
 118         writer.addAnnotationInfo(property, pre);
 119         addModifiers(property, pre);
 120         Content propertylink = writer.getLink(new LinkInfoImpl(
 121                 configuration, LinkInfoImpl.Kind.MEMBER,
 122                 utils.getReturnType(property)));
 123         pre.add(propertylink);
 124         pre.add(" ");
 125         if (configuration.linksource) {
 126             Content propertyName = new StringContent(name(property));
 127             writer.addSrcLink(property, propertyName, pre);
 128         } else {
 129             addName(name(property), pre);
 130         }
 131         return pre;
 132     }
 133 
 134     /**
 135      * {@inheritDoc}
 136      */
 137     @Override
 138     public void addDeprecated(ExecutableElement property, Content propertyDocTree) {
 139     }
 140 
 141     /**
 142      * {@inheritDoc}
 143      */
 144     @Override
 145     public void addComments(ExecutableElement property, Content propertyDocTree) {
 146         TypeElement holder = (TypeElement)property.getEnclosingElement();
 147         if (!utils.getFullBody(property).isEmpty()) {
 148             if (holder.equals(typeElement) ||
 149                     (!utils.isPublic(holder) || utils.isLinkable(holder))) {
 150                 writer.addInlineComment(property, propertyDocTree);
 151             } else {


 172      * {@inheritDoc}
 173      */
 174     @Override
 175     public void addTags(ExecutableElement property, Content propertyDocTree) {
 176         writer.addTagsInfo(property, propertyDocTree);
 177     }
 178 
 179     /**
 180      * {@inheritDoc}
 181      */
 182     @Override
 183     public Content getPropertyDetails(Content propertyDetailsTreeHeader, Content propertyDetailsTree) {
 184         Content propertyDetails = new ContentBuilder(propertyDetailsTreeHeader, propertyDetailsTree);
 185         return getMemberTree(HtmlTree.SECTION(HtmlStyle.propertyDetails, propertyDetails));
 186     }
 187 
 188     /**
 189      * {@inheritDoc}
 190      */
 191     @Override
 192     public Content getPropertyDoc(Content propertyDocTree,
 193             boolean isLastContent) {
 194         return getMemberTree(propertyDocTree, isLastContent);
 195     }
 196 
 197     /**
 198      * {@inheritDoc}
 199      */
 200     @Override
 201     public void addSummaryLabel(Content memberTree) {
 202         Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
 203                 contents.propertySummaryLabel);
 204         memberTree.add(label);
 205     }
 206 
 207     /**
 208      * {@inheritDoc}
 209      */
 210     @Override
 211     public TableHeader getSummaryTableHeader(Element member) {
 212         return new TableHeader(contents.typeLabel, contents.propertyLabel,
 213                 contents.descriptionLabel);
 214     }


< prev index next >