< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.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 
  29 import javax.lang.model.element.Element;
  30 import javax.lang.model.element.TypeElement;
  31 import javax.lang.model.element.VariableElement;
  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.Content;
  40 import jdk.javadoc.internal.doclets.toolkit.EnumConstantWriter;
  41 import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
  42 
  43 /**
  44  * Writes enum constant 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 Jamie Ho
  52  * @author Bhavesh Patel (Modified)
  53  */
  54 public class EnumConstantWriterImpl extends AbstractMemberWriter


  75     }
  76 
  77     /**
  78      * {@inheritDoc}
  79      */
  80     @Override
  81     public void addMemberTree(Content memberSummaryTree, Content memberTree) {
  82         writer.addMemberTree(HtmlStyle.constantsSummary, memberSummaryTree, memberTree);
  83     }
  84 
  85     /**
  86      * {@inheritDoc}
  87      */
  88     @Override
  89     public Content getEnumConstantsDetailsTreeHeader(TypeElement typeElement,
  90             Content memberDetailsTree) {
  91         memberDetailsTree.add(MarkerComments.START_OF_ENUM_CONSTANT_DETAILS);
  92         Content enumConstantsDetailsTree = new ContentBuilder();
  93         Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
  94                 contents.enumConstantDetailLabel);

  95         enumConstantsDetailsTree.add(links.createAnchor(
  96                 SectionName.ENUM_CONSTANT_DETAIL));
  97         enumConstantsDetailsTree.add(heading);
  98         return enumConstantsDetailsTree;
  99     }
 100 
 101     /**
 102      * {@inheritDoc}
 103      */
 104     @Override
 105     public Content getEnumConstantsTreeHeader(VariableElement enumConstant,
 106             Content enumConstantsDetailsTree) {
 107         Content enumConstantsTree = new ContentBuilder();
 108         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
 109         heading.add(links.createAnchor(name(enumConstant), new StringContent(name(enumConstant))));
 110         enumConstantsTree.add(heading);

 111         return HtmlTree.SECTION(HtmlStyle.detail, enumConstantsTree);
 112     }
 113 
 114     /**
 115      * {@inheritDoc}
 116      */
 117     @Override
 118     public Content getSignature(VariableElement enumConstant) {
 119         return new MemberSignature(enumConstant)
 120                 .addType(enumConstant.asType())
 121                 .toContent();











 122     }
 123 
 124     /**
 125      * {@inheritDoc}
 126      */
 127     @Override
 128     public void addDeprecated(VariableElement enumConstant, Content enumConstantsTree) {
 129         addDeprecatedInfo(enumConstant, enumConstantsTree);
 130     }
 131 
 132     /**
 133      * {@inheritDoc}
 134      */
 135     @Override
 136     public void addComments(VariableElement enumConstant, Content enumConstantsTree) {
 137         addComment(enumConstant, enumConstantsTree);
 138     }
 139 
 140     /**
 141      * {@inheritDoc}


 143     @Override
 144     public void addTags(VariableElement enumConstant, Content enumConstantsTree) {
 145         writer.addTagsInfo(enumConstant, enumConstantsTree);
 146     }
 147 
 148     /**
 149      * {@inheritDoc}
 150      */
 151     @Override
 152     public Content getEnumConstantsDetails(Content enumConstantsDetailsTreeHeader,
 153             Content enumConstantsDetailsTree) {
 154         Content enumConstantsDetails =
 155                 new ContentBuilder(enumConstantsDetailsTreeHeader, enumConstantsDetailsTree);
 156         return getMemberTree(HtmlTree.SECTION(HtmlStyle.constantDetails, enumConstantsDetails));
 157     }
 158 
 159     /**
 160      * {@inheritDoc}
 161      */
 162     @Override
 163     public Content getEnumConstants(Content enumConstantsTree) {
 164         return getMemberTree(enumConstantsTree);

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




  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 
  29 import javax.lang.model.element.Element;
  30 import javax.lang.model.element.TypeElement;
  31 import javax.lang.model.element.VariableElement;
  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.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.EnumConstantWriter;
  42 import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
  43 
  44 /**
  45  * Writes enum constant 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  */
  55 public class EnumConstantWriterImpl extends AbstractMemberWriter


  76     }
  77 
  78     /**
  79      * {@inheritDoc}
  80      */
  81     @Override
  82     public void addMemberTree(Content memberSummaryTree, Content memberTree) {
  83         writer.addMemberTree(HtmlStyle.constantsSummary, memberSummaryTree, memberTree);
  84     }
  85 
  86     /**
  87      * {@inheritDoc}
  88      */
  89     @Override
  90     public Content getEnumConstantsDetailsTreeHeader(TypeElement typeElement,
  91             Content memberDetailsTree) {
  92         memberDetailsTree.add(MarkerComments.START_OF_ENUM_CONSTANT_DETAILS);
  93         Content enumConstantsDetailsTree = new ContentBuilder();
  94         Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
  95                 contents.enumConstantDetailLabel);
  96         enumConstantsDetailsTree.add(heading);
  97         enumConstantsDetailsTree.add(links.createAnchor(
  98                 SectionName.ENUM_CONSTANT_DETAIL));

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


 156     @Override
 157     public void addTags(VariableElement enumConstant, Content enumConstantsTree) {
 158         writer.addTagsInfo(enumConstant, enumConstantsTree);
 159     }
 160 
 161     /**
 162      * {@inheritDoc}
 163      */
 164     @Override
 165     public Content getEnumConstantsDetails(Content enumConstantsDetailsTreeHeader,
 166             Content enumConstantsDetailsTree) {
 167         Content enumConstantsDetails =
 168                 new ContentBuilder(enumConstantsDetailsTreeHeader, enumConstantsDetailsTree);
 169         return getMemberTree(HtmlTree.SECTION(HtmlStyle.constantDetails, enumConstantsDetails));
 170     }
 171 
 172     /**
 173      * {@inheritDoc}
 174      */
 175     @Override
 176     public Content getEnumConstants(Content enumConstantsTree,
 177             boolean isLastContent) {
 178         return getMemberTree(enumConstantsTree, isLastContent);
 179     }
 180 
 181     /**
 182      * {@inheritDoc}
 183      */
 184     @Override
 185     public void addSummaryLabel(Content memberTree) {
 186         Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
 187                 contents.enumConstantSummary);
 188         memberTree.add(label);
 189     }
 190 
 191     /**
 192      * {@inheritDoc}
 193      */
 194     @Override
 195     public TableHeader getSummaryTableHeader(Element member) {
 196         return new TableHeader(contents.enumConstantLabel, contents.descriptionLabel);
 197     }
 198 


< prev index next >