< prev index next >

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

Print this page




 183     /**
 184      * {@inheritDoc}
 185      */
 186     public Content getParamHeader(String header) {
 187         HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.paramLabel,
 188                 new StringContent(header)));
 189         return result;
 190     }
 191 
 192     /**
 193      * {@inheritDoc}
 194      */
 195     @SuppressWarnings("preview")
 196     public Content paramTagOutput(Element element, DocTree paramTag, String paramName) {
 197         ContentBuilder body = new ContentBuilder();
 198         CommentHelper ch = utils.getCommentHelper(element);
 199         // define id attributes for state components so that generated descriptions may refer to them
 200         boolean defineID = (element.getKind() == ElementKind.RECORD)
 201                 && (paramTag instanceof ParamTree) && !((ParamTree) paramTag).isTypeParameter();
 202         Content nameTree = new StringContent(paramName);
 203         body.add(HtmlTree.CODE(defineID ? HtmlTree.A_ID("param-" + paramName, nameTree) : nameTree));
 204         body.add(" - ");
 205         List<? extends DocTree> description = ch.getDescription(configuration, paramTag);
 206         body.add(htmlWriter.commentTagsToContent(paramTag, element, description, false, inSummary));
 207         return HtmlTree.DD(body);
 208     }
 209 
 210     /**
 211      * {@inheritDoc}
 212      */
 213     public Content propertyTagOutput(Element element, DocTree tag, String prefix) {
 214         Content body = new ContentBuilder();
 215         CommentHelper ch = utils.getCommentHelper(element);
 216         body.add(new RawHtml(prefix));
 217         body.add(" ");
 218         body.add(HtmlTree.CODE(new RawHtml(ch.getText(tag))));
 219         body.add(".");
 220         Content result = HtmlTree.P(body);
 221         return result;
 222     }
 223 


 410 
 411     /**
 412      * {@inheritDoc}
 413      */
 414     public BaseConfiguration configuration() {
 415         return configuration;
 416     }
 417 
 418     @SuppressWarnings("preview")
 419     private Content createAnchorAndSearchIndex(Element element, String tagText, String desc, boolean isSystemProperty) {
 420         Content result = null;
 421         if (isFirstSentence && inSummary) {
 422             result = new StringContent(tagText);
 423         } else {
 424             String anchorName = htmlWriter.links.getName(tagText);
 425             int count = htmlWriter.indexAnchorTable
 426                     .compute(anchorName, (k, v) -> v == null ? 0 : v + 1);
 427             if (count > 0) {
 428                 anchorName += "-" + count;
 429             }
 430             result = HtmlTree.A_ID(HtmlStyle.searchTagResult, anchorName, new StringContent(tagText));
 431             if (configuration.createindex && !tagText.isEmpty()) {
 432                 SearchIndexItem si = new SearchIndexItem();
 433                 si.setSystemProperty(isSystemProperty);
 434                 si.setLabel(tagText);
 435                 si.setDescription(desc);
 436                 si.setUrl(htmlWriter.path.getPath() + "#" + anchorName);
 437                 new SimpleElementVisitor14<Void, Void>() {
 438 
 439                     @Override
 440                     public Void visitModule(ModuleElement e, Void p) {
 441                         si.setHolder(resources.getText("doclet.module")
 442                                              + " " + utils.getFullyQualifiedName(e));
 443                         return null;
 444                     }
 445 
 446                     @Override
 447                     public Void visitPackage(PackageElement e, Void p) {
 448                         si.setHolder(resources.getText("doclet.package")
 449                                              + " " + utils.getFullyQualifiedName(e));
 450                         return null;




 183     /**
 184      * {@inheritDoc}
 185      */
 186     public Content getParamHeader(String header) {
 187         HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.paramLabel,
 188                 new StringContent(header)));
 189         return result;
 190     }
 191 
 192     /**
 193      * {@inheritDoc}
 194      */
 195     @SuppressWarnings("preview")
 196     public Content paramTagOutput(Element element, DocTree paramTag, String paramName) {
 197         ContentBuilder body = new ContentBuilder();
 198         CommentHelper ch = utils.getCommentHelper(element);
 199         // define id attributes for state components so that generated descriptions may refer to them
 200         boolean defineID = (element.getKind() == ElementKind.RECORD)
 201                 && (paramTag instanceof ParamTree) && !((ParamTree) paramTag).isTypeParameter();
 202         Content nameTree = new StringContent(paramName);
 203         body.add(HtmlTree.CODE(defineID ? HtmlTree.SPAN_ID("param-" + paramName, nameTree) : nameTree));
 204         body.add(" - ");
 205         List<? extends DocTree> description = ch.getDescription(configuration, paramTag);
 206         body.add(htmlWriter.commentTagsToContent(paramTag, element, description, false, inSummary));
 207         return HtmlTree.DD(body);
 208     }
 209 
 210     /**
 211      * {@inheritDoc}
 212      */
 213     public Content propertyTagOutput(Element element, DocTree tag, String prefix) {
 214         Content body = new ContentBuilder();
 215         CommentHelper ch = utils.getCommentHelper(element);
 216         body.add(new RawHtml(prefix));
 217         body.add(" ");
 218         body.add(HtmlTree.CODE(new RawHtml(ch.getText(tag))));
 219         body.add(".");
 220         Content result = HtmlTree.P(body);
 221         return result;
 222     }
 223 


 410 
 411     /**
 412      * {@inheritDoc}
 413      */
 414     public BaseConfiguration configuration() {
 415         return configuration;
 416     }
 417 
 418     @SuppressWarnings("preview")
 419     private Content createAnchorAndSearchIndex(Element element, String tagText, String desc, boolean isSystemProperty) {
 420         Content result = null;
 421         if (isFirstSentence && inSummary) {
 422             result = new StringContent(tagText);
 423         } else {
 424             String anchorName = htmlWriter.links.getName(tagText);
 425             int count = htmlWriter.indexAnchorTable
 426                     .compute(anchorName, (k, v) -> v == null ? 0 : v + 1);
 427             if (count > 0) {
 428                 anchorName += "-" + count;
 429             }
 430             result = HtmlTree.SPAN(anchorName, HtmlStyle.searchTagResult, new StringContent(tagText));
 431             if (configuration.createindex && !tagText.isEmpty()) {
 432                 SearchIndexItem si = new SearchIndexItem();
 433                 si.setSystemProperty(isSystemProperty);
 434                 si.setLabel(tagText);
 435                 si.setDescription(desc);
 436                 si.setUrl(htmlWriter.path.getPath() + "#" + anchorName);
 437                 new SimpleElementVisitor14<Void, Void>() {
 438 
 439                     @Override
 440                     public Void visitModule(ModuleElement e, Void p) {
 441                         si.setHolder(resources.getText("doclet.module")
 442                                              + " " + utils.getFullyQualifiedName(e));
 443                         return null;
 444                     }
 445 
 446                     @Override
 447                     public Void visitPackage(PackageElement e, Void p) {
 448                         si.setHolder(resources.getText("doclet.package")
 449                                              + " " + utils.getFullyQualifiedName(e));
 450                         return null;


< prev index next >