Thu, 31 Aug 2017 15:17:03 +0800
merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | package com.sun.tools.doclets.formats.html; |
aoqi@0 | 27 | |
aoqi@0 | 28 | import java.io.IOException; |
aoqi@0 | 29 | |
aoqi@0 | 30 | import com.sun.javadoc.*; |
aoqi@0 | 31 | import com.sun.tools.doclets.formats.html.markup.*; |
aoqi@0 | 32 | import com.sun.tools.doclets.internal.toolkit.*; |
aoqi@0 | 33 | import com.sun.tools.doclets.internal.toolkit.builders.*; |
aoqi@0 | 34 | import com.sun.tools.doclets.internal.toolkit.util.*; |
aoqi@0 | 35 | |
aoqi@0 | 36 | /** |
aoqi@0 | 37 | * Generate the Class Information Page. |
aoqi@0 | 38 | * |
aoqi@0 | 39 | * <p><b>This is NOT part of any supported API. |
aoqi@0 | 40 | * If you write code that depends on this, you do so at your own risk. |
aoqi@0 | 41 | * This code and its internal interfaces are subject to change or |
aoqi@0 | 42 | * deletion without notice.</b> |
aoqi@0 | 43 | * |
aoqi@0 | 44 | * @see com.sun.javadoc.ClassDoc |
aoqi@0 | 45 | * @see java.util.Collections |
aoqi@0 | 46 | * @see java.util.List |
aoqi@0 | 47 | * @see java.util.ArrayList |
aoqi@0 | 48 | * @see java.util.HashMap |
aoqi@0 | 49 | * |
aoqi@0 | 50 | * @author Atul M Dambalkar |
aoqi@0 | 51 | * @author Robert Field |
aoqi@0 | 52 | * @author Bhavesh Patel (Modified) |
aoqi@0 | 53 | */ |
aoqi@0 | 54 | public class AnnotationTypeWriterImpl extends SubWriterHolderWriter |
aoqi@0 | 55 | implements AnnotationTypeWriter { |
aoqi@0 | 56 | |
aoqi@0 | 57 | protected AnnotationTypeDoc annotationType; |
aoqi@0 | 58 | |
aoqi@0 | 59 | protected Type prev; |
aoqi@0 | 60 | |
aoqi@0 | 61 | protected Type next; |
aoqi@0 | 62 | |
aoqi@0 | 63 | /** |
aoqi@0 | 64 | * @param annotationType the annotation type being documented. |
aoqi@0 | 65 | * @param prevType the previous class that was documented. |
aoqi@0 | 66 | * @param nextType the next class being documented. |
aoqi@0 | 67 | */ |
aoqi@0 | 68 | public AnnotationTypeWriterImpl(ConfigurationImpl configuration, |
aoqi@0 | 69 | AnnotationTypeDoc annotationType, Type prevType, Type nextType) |
aoqi@0 | 70 | throws Exception { |
aoqi@0 | 71 | super(configuration, DocPath.forClass(annotationType)); |
aoqi@0 | 72 | this.annotationType = annotationType; |
aoqi@0 | 73 | configuration.currentcd = annotationType.asClassDoc(); |
aoqi@0 | 74 | this.prev = prevType; |
aoqi@0 | 75 | this.next = nextType; |
aoqi@0 | 76 | } |
aoqi@0 | 77 | |
aoqi@0 | 78 | /** |
aoqi@0 | 79 | * Get this package link. |
aoqi@0 | 80 | * |
aoqi@0 | 81 | * @return a content tree for the package link |
aoqi@0 | 82 | */ |
aoqi@0 | 83 | protected Content getNavLinkPackage() { |
aoqi@0 | 84 | Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY, |
aoqi@0 | 85 | packageLabel); |
aoqi@0 | 86 | Content li = HtmlTree.LI(linkContent); |
aoqi@0 | 87 | return li; |
aoqi@0 | 88 | } |
aoqi@0 | 89 | |
aoqi@0 | 90 | /** |
aoqi@0 | 91 | * Get the class link. |
aoqi@0 | 92 | * |
aoqi@0 | 93 | * @return a content tree for the class link |
aoqi@0 | 94 | */ |
aoqi@0 | 95 | protected Content getNavLinkClass() { |
aoqi@0 | 96 | Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, classLabel); |
aoqi@0 | 97 | return li; |
aoqi@0 | 98 | } |
aoqi@0 | 99 | |
aoqi@0 | 100 | /** |
aoqi@0 | 101 | * Get the class use link. |
aoqi@0 | 102 | * |
aoqi@0 | 103 | * @return a content tree for the class use link |
aoqi@0 | 104 | */ |
aoqi@0 | 105 | protected Content getNavLinkClassUse() { |
aoqi@0 | 106 | Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), useLabel); |
aoqi@0 | 107 | Content li = HtmlTree.LI(linkContent); |
aoqi@0 | 108 | return li; |
aoqi@0 | 109 | } |
aoqi@0 | 110 | |
aoqi@0 | 111 | /** |
aoqi@0 | 112 | * Get link to previous class. |
aoqi@0 | 113 | * |
aoqi@0 | 114 | * @return a content tree for the previous class link |
aoqi@0 | 115 | */ |
aoqi@0 | 116 | public Content getNavLinkPrevious() { |
aoqi@0 | 117 | Content li; |
aoqi@0 | 118 | if (prev != null) { |
aoqi@0 | 119 | Content prevLink = getLink(new LinkInfoImpl(configuration, |
aoqi@0 | 120 | LinkInfoImpl.Kind.CLASS, prev.asClassDoc()) |
aoqi@0 | 121 | .label(prevclassLabel).strong(true)); |
aoqi@0 | 122 | li = HtmlTree.LI(prevLink); |
aoqi@0 | 123 | } |
aoqi@0 | 124 | else |
aoqi@0 | 125 | li = HtmlTree.LI(prevclassLabel); |
aoqi@0 | 126 | return li; |
aoqi@0 | 127 | } |
aoqi@0 | 128 | |
aoqi@0 | 129 | /** |
aoqi@0 | 130 | * Get link to next class. |
aoqi@0 | 131 | * |
aoqi@0 | 132 | * @return a content tree for the next class link |
aoqi@0 | 133 | */ |
aoqi@0 | 134 | public Content getNavLinkNext() { |
aoqi@0 | 135 | Content li; |
aoqi@0 | 136 | if (next != null) { |
aoqi@0 | 137 | Content nextLink = getLink(new LinkInfoImpl(configuration, |
aoqi@0 | 138 | LinkInfoImpl.Kind.CLASS, next.asClassDoc()) |
aoqi@0 | 139 | .label(nextclassLabel).strong(true)); |
aoqi@0 | 140 | li = HtmlTree.LI(nextLink); |
aoqi@0 | 141 | } |
aoqi@0 | 142 | else |
aoqi@0 | 143 | li = HtmlTree.LI(nextclassLabel); |
aoqi@0 | 144 | return li; |
aoqi@0 | 145 | } |
aoqi@0 | 146 | |
aoqi@0 | 147 | /** |
aoqi@0 | 148 | * {@inheritDoc} |
aoqi@0 | 149 | */ |
aoqi@0 | 150 | public Content getHeader(String header) { |
aoqi@0 | 151 | String pkgname = (annotationType.containingPackage() != null)? |
aoqi@0 | 152 | annotationType.containingPackage().name(): ""; |
aoqi@0 | 153 | String clname = annotationType.name(); |
aoqi@0 | 154 | Content bodyTree = getBody(true, getWindowTitle(clname)); |
aoqi@0 | 155 | addTop(bodyTree); |
aoqi@0 | 156 | addNavLinks(true, bodyTree); |
aoqi@0 | 157 | bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA); |
aoqi@0 | 158 | HtmlTree div = new HtmlTree(HtmlTag.DIV); |
aoqi@0 | 159 | div.addStyle(HtmlStyle.header); |
aoqi@0 | 160 | if (pkgname.length() > 0) { |
aoqi@0 | 161 | Content pkgNameContent = new StringContent(pkgname); |
aoqi@0 | 162 | Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent); |
aoqi@0 | 163 | div.addContent(pkgNameDiv); |
aoqi@0 | 164 | } |
aoqi@0 | 165 | LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, |
aoqi@0 | 166 | LinkInfoImpl.Kind.CLASS_HEADER, annotationType); |
aoqi@0 | 167 | Content headerContent = new StringContent(header); |
aoqi@0 | 168 | Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true, |
aoqi@0 | 169 | HtmlStyle.title, headerContent); |
aoqi@0 | 170 | heading.addContent(getTypeParameterLinks(linkInfo)); |
aoqi@0 | 171 | div.addContent(heading); |
aoqi@0 | 172 | bodyTree.addContent(div); |
aoqi@0 | 173 | return bodyTree; |
aoqi@0 | 174 | } |
aoqi@0 | 175 | |
aoqi@0 | 176 | /** |
aoqi@0 | 177 | * {@inheritDoc} |
aoqi@0 | 178 | */ |
aoqi@0 | 179 | public Content getAnnotationContentHeader() { |
aoqi@0 | 180 | return getContentHeader(); |
aoqi@0 | 181 | } |
aoqi@0 | 182 | |
aoqi@0 | 183 | /** |
aoqi@0 | 184 | * {@inheritDoc} |
aoqi@0 | 185 | */ |
aoqi@0 | 186 | public void addFooter(Content contentTree) { |
aoqi@0 | 187 | contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA); |
aoqi@0 | 188 | addNavLinks(false, contentTree); |
aoqi@0 | 189 | addBottom(contentTree); |
aoqi@0 | 190 | } |
aoqi@0 | 191 | |
aoqi@0 | 192 | /** |
aoqi@0 | 193 | * {@inheritDoc} |
aoqi@0 | 194 | */ |
aoqi@0 | 195 | public void printDocument(Content contentTree) throws IOException { |
aoqi@0 | 196 | printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType), |
aoqi@0 | 197 | true, contentTree); |
aoqi@0 | 198 | } |
aoqi@0 | 199 | |
aoqi@0 | 200 | /** |
aoqi@0 | 201 | * {@inheritDoc} |
aoqi@0 | 202 | */ |
aoqi@0 | 203 | public Content getAnnotationInfoTreeHeader() { |
aoqi@0 | 204 | return getMemberTreeHeader(); |
aoqi@0 | 205 | } |
aoqi@0 | 206 | |
aoqi@0 | 207 | /** |
aoqi@0 | 208 | * {@inheritDoc} |
aoqi@0 | 209 | */ |
aoqi@0 | 210 | public Content getAnnotationInfo(Content annotationInfoTree) { |
aoqi@0 | 211 | return getMemberTree(HtmlStyle.description, annotationInfoTree); |
aoqi@0 | 212 | } |
aoqi@0 | 213 | |
aoqi@0 | 214 | /** |
aoqi@0 | 215 | * {@inheritDoc} |
aoqi@0 | 216 | */ |
aoqi@0 | 217 | public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree) { |
aoqi@0 | 218 | annotationInfoTree.addContent(new HtmlTree(HtmlTag.BR)); |
aoqi@0 | 219 | Content pre = new HtmlTree(HtmlTag.PRE); |
aoqi@0 | 220 | addAnnotationInfo(annotationType, pre); |
aoqi@0 | 221 | pre.addContent(modifiers); |
aoqi@0 | 222 | LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, |
aoqi@0 | 223 | LinkInfoImpl.Kind.CLASS_SIGNATURE, annotationType); |
aoqi@0 | 224 | Content annotationName = new StringContent(annotationType.name()); |
aoqi@0 | 225 | Content parameterLinks = getTypeParameterLinks(linkInfo); |
aoqi@0 | 226 | if (configuration.linksource) { |
aoqi@0 | 227 | addSrcLink(annotationType, annotationName, pre); |
aoqi@0 | 228 | pre.addContent(parameterLinks); |
aoqi@0 | 229 | } else { |
aoqi@0 | 230 | Content span = HtmlTree.SPAN(HtmlStyle.memberNameLabel, annotationName); |
aoqi@0 | 231 | span.addContent(parameterLinks); |
aoqi@0 | 232 | pre.addContent(span); |
aoqi@0 | 233 | } |
aoqi@0 | 234 | annotationInfoTree.addContent(pre); |
aoqi@0 | 235 | } |
aoqi@0 | 236 | |
aoqi@0 | 237 | /** |
aoqi@0 | 238 | * {@inheritDoc} |
aoqi@0 | 239 | */ |
aoqi@0 | 240 | public void addAnnotationTypeDescription(Content annotationInfoTree) { |
aoqi@0 | 241 | if(!configuration.nocomment) { |
aoqi@0 | 242 | if (annotationType.inlineTags().length > 0) { |
aoqi@0 | 243 | addInlineComment(annotationType, annotationInfoTree); |
aoqi@0 | 244 | } |
aoqi@0 | 245 | } |
aoqi@0 | 246 | } |
aoqi@0 | 247 | |
aoqi@0 | 248 | /** |
aoqi@0 | 249 | * {@inheritDoc} |
aoqi@0 | 250 | */ |
aoqi@0 | 251 | public void addAnnotationTypeTagInfo(Content annotationInfoTree) { |
aoqi@0 | 252 | if(!configuration.nocomment) { |
aoqi@0 | 253 | addTagsInfo(annotationType, annotationInfoTree); |
aoqi@0 | 254 | } |
aoqi@0 | 255 | } |
aoqi@0 | 256 | |
aoqi@0 | 257 | /** |
aoqi@0 | 258 | * {@inheritDoc} |
aoqi@0 | 259 | */ |
aoqi@0 | 260 | public void addAnnotationTypeDeprecationInfo(Content annotationInfoTree) { |
aoqi@0 | 261 | Content hr = new HtmlTree(HtmlTag.HR); |
aoqi@0 | 262 | annotationInfoTree.addContent(hr); |
aoqi@0 | 263 | Tag[] deprs = annotationType.tags("deprecated"); |
aoqi@0 | 264 | if (Util.isDeprecated(annotationType)) { |
aoqi@0 | 265 | Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); |
aoqi@0 | 266 | Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel); |
aoqi@0 | 267 | if (deprs.length > 0) { |
aoqi@0 | 268 | Tag[] commentTags = deprs[0].inlineTags(); |
aoqi@0 | 269 | if (commentTags.length > 0) { |
aoqi@0 | 270 | div.addContent(getSpace()); |
aoqi@0 | 271 | addInlineDeprecatedComment(annotationType, deprs[0], div); |
aoqi@0 | 272 | } |
aoqi@0 | 273 | } |
aoqi@0 | 274 | annotationInfoTree.addContent(div); |
aoqi@0 | 275 | } |
aoqi@0 | 276 | } |
aoqi@0 | 277 | |
aoqi@0 | 278 | /** |
aoqi@0 | 279 | * {@inheritDoc} |
aoqi@0 | 280 | */ |
aoqi@0 | 281 | protected Content getNavLinkTree() { |
aoqi@0 | 282 | Content treeLinkContent = getHyperLink(DocPaths.PACKAGE_TREE, |
aoqi@0 | 283 | treeLabel, "", ""); |
aoqi@0 | 284 | Content li = HtmlTree.LI(treeLinkContent); |
aoqi@0 | 285 | return li; |
aoqi@0 | 286 | } |
aoqi@0 | 287 | |
aoqi@0 | 288 | /** |
aoqi@0 | 289 | * Add summary details to the navigation bar. |
aoqi@0 | 290 | * |
aoqi@0 | 291 | * @param subDiv the content tree to which the summary detail links will be added |
aoqi@0 | 292 | */ |
aoqi@0 | 293 | protected void addSummaryDetailLinks(Content subDiv) { |
aoqi@0 | 294 | try { |
aoqi@0 | 295 | Content div = HtmlTree.DIV(getNavSummaryLinks()); |
aoqi@0 | 296 | div.addContent(getNavDetailLinks()); |
aoqi@0 | 297 | subDiv.addContent(div); |
aoqi@0 | 298 | } catch (Exception e) { |
aoqi@0 | 299 | e.printStackTrace(); |
aoqi@0 | 300 | throw new DocletAbortException(e); |
aoqi@0 | 301 | } |
aoqi@0 | 302 | } |
aoqi@0 | 303 | |
aoqi@0 | 304 | /** |
aoqi@0 | 305 | * Get summary links for navigation bar. |
aoqi@0 | 306 | * |
aoqi@0 | 307 | * @return the content tree for the navigation summary links |
aoqi@0 | 308 | */ |
aoqi@0 | 309 | protected Content getNavSummaryLinks() throws Exception { |
aoqi@0 | 310 | Content li = HtmlTree.LI(summaryLabel); |
aoqi@0 | 311 | li.addContent(getSpace()); |
aoqi@0 | 312 | Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li); |
aoqi@0 | 313 | MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder) |
aoqi@0 | 314 | configuration.getBuilderFactory().getMemberSummaryBuilder(this); |
aoqi@0 | 315 | Content liNavField = new HtmlTree(HtmlTag.LI); |
aoqi@0 | 316 | addNavSummaryLink(memberSummaryBuilder, |
aoqi@0 | 317 | "doclet.navField", |
aoqi@0 | 318 | VisibleMemberMap.ANNOTATION_TYPE_FIELDS, liNavField); |
aoqi@0 | 319 | addNavGap(liNavField); |
aoqi@0 | 320 | ulNav.addContent(liNavField); |
aoqi@0 | 321 | Content liNavReq = new HtmlTree(HtmlTag.LI); |
aoqi@0 | 322 | addNavSummaryLink(memberSummaryBuilder, |
aoqi@0 | 323 | "doclet.navAnnotationTypeRequiredMember", |
aoqi@0 | 324 | VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED, liNavReq); |
aoqi@0 | 325 | addNavGap(liNavReq); |
aoqi@0 | 326 | ulNav.addContent(liNavReq); |
aoqi@0 | 327 | Content liNavOpt = new HtmlTree(HtmlTag.LI); |
aoqi@0 | 328 | addNavSummaryLink(memberSummaryBuilder, |
aoqi@0 | 329 | "doclet.navAnnotationTypeOptionalMember", |
aoqi@0 | 330 | VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL, liNavOpt); |
aoqi@0 | 331 | ulNav.addContent(liNavOpt); |
aoqi@0 | 332 | return ulNav; |
aoqi@0 | 333 | } |
aoqi@0 | 334 | |
aoqi@0 | 335 | /** |
aoqi@0 | 336 | * Add the navigation summary link. |
aoqi@0 | 337 | * |
aoqi@0 | 338 | * @param builder builder for the member to be documented |
aoqi@0 | 339 | * @param label the label for the navigation |
aoqi@0 | 340 | * @param type type to be documented |
aoqi@0 | 341 | * @param liNav the content tree to which the navigation summary link will be added |
aoqi@0 | 342 | */ |
aoqi@0 | 343 | protected void addNavSummaryLink(MemberSummaryBuilder builder, |
aoqi@0 | 344 | String label, int type, Content liNav) { |
aoqi@0 | 345 | AbstractMemberWriter writer = ((AbstractMemberWriter) builder. |
aoqi@0 | 346 | getMemberSummaryWriter(type)); |
aoqi@0 | 347 | if (writer == null) { |
aoqi@0 | 348 | liNav.addContent(getResource(label)); |
aoqi@0 | 349 | } else { |
aoqi@0 | 350 | liNav.addContent(writer.getNavSummaryLink(null, |
aoqi@0 | 351 | ! builder.getVisibleMemberMap(type).noVisibleMembers())); |
aoqi@0 | 352 | } |
aoqi@0 | 353 | } |
aoqi@0 | 354 | |
aoqi@0 | 355 | /** |
aoqi@0 | 356 | * Get detail links for the navigation bar. |
aoqi@0 | 357 | * |
aoqi@0 | 358 | * @return the content tree for the detail links |
aoqi@0 | 359 | */ |
aoqi@0 | 360 | protected Content getNavDetailLinks() throws Exception { |
aoqi@0 | 361 | Content li = HtmlTree.LI(detailLabel); |
aoqi@0 | 362 | li.addContent(getSpace()); |
aoqi@0 | 363 | Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li); |
aoqi@0 | 364 | MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder) |
aoqi@0 | 365 | configuration.getBuilderFactory().getMemberSummaryBuilder(this); |
aoqi@0 | 366 | AbstractMemberWriter writerField = |
aoqi@0 | 367 | ((AbstractMemberWriter) memberSummaryBuilder. |
aoqi@0 | 368 | getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_FIELDS)); |
aoqi@0 | 369 | AbstractMemberWriter writerOptional = |
aoqi@0 | 370 | ((AbstractMemberWriter) memberSummaryBuilder. |
aoqi@0 | 371 | getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL)); |
aoqi@0 | 372 | AbstractMemberWriter writerRequired = |
aoqi@0 | 373 | ((AbstractMemberWriter) memberSummaryBuilder. |
aoqi@0 | 374 | getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED)); |
aoqi@0 | 375 | Content liNavField = new HtmlTree(HtmlTag.LI); |
aoqi@0 | 376 | if (writerField != null){ |
aoqi@0 | 377 | writerField.addNavDetailLink(annotationType.fields().length > 0, liNavField); |
aoqi@0 | 378 | } else { |
aoqi@0 | 379 | liNavField.addContent(getResource("doclet.navField")); |
aoqi@0 | 380 | } |
aoqi@0 | 381 | addNavGap(liNavField); |
aoqi@0 | 382 | ulNav.addContent(liNavField); |
aoqi@0 | 383 | if (writerOptional != null){ |
aoqi@0 | 384 | Content liNavOpt = new HtmlTree(HtmlTag.LI); |
aoqi@0 | 385 | writerOptional.addNavDetailLink(annotationType.elements().length > 0, liNavOpt); |
aoqi@0 | 386 | ulNav.addContent(liNavOpt); |
aoqi@0 | 387 | } else if (writerRequired != null){ |
aoqi@0 | 388 | Content liNavReq = new HtmlTree(HtmlTag.LI); |
aoqi@0 | 389 | writerRequired.addNavDetailLink(annotationType.elements().length > 0, liNavReq); |
aoqi@0 | 390 | ulNav.addContent(liNavReq); |
aoqi@0 | 391 | } else { |
aoqi@0 | 392 | Content liNav = HtmlTree.LI(getResource("doclet.navAnnotationTypeMember")); |
aoqi@0 | 393 | ulNav.addContent(liNav); |
aoqi@0 | 394 | } |
aoqi@0 | 395 | return ulNav; |
aoqi@0 | 396 | } |
aoqi@0 | 397 | |
aoqi@0 | 398 | /** |
aoqi@0 | 399 | * Add gap between navigation bar elements. |
aoqi@0 | 400 | * |
aoqi@0 | 401 | * @param liNav the content tree to which the gap will be added |
aoqi@0 | 402 | */ |
aoqi@0 | 403 | protected void addNavGap(Content liNav) { |
aoqi@0 | 404 | liNav.addContent(getSpace()); |
aoqi@0 | 405 | liNav.addContent("|"); |
aoqi@0 | 406 | liNav.addContent(getSpace()); |
aoqi@0 | 407 | } |
aoqi@0 | 408 | |
aoqi@0 | 409 | /** |
aoqi@0 | 410 | * {@inheritDoc} |
aoqi@0 | 411 | */ |
aoqi@0 | 412 | public AnnotationTypeDoc getAnnotationTypeDoc() { |
aoqi@0 | 413 | return annotationType; |
aoqi@0 | 414 | } |
aoqi@0 | 415 | } |