langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java
author jjg
Fri, 04 Mar 2011 19:53:03 -0800
changeset 8631 664f84942e74
parent 7681 1f0819a3341f
child 14258 8d2148961366
permissions -rw-r--r--
6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup Reviewed-by: bpatel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
8631
664f84942e74 6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents: 7681
diff changeset
     2
 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2223
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2223
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2223
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2223
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2223
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.doclets.formats.html;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    28
import java.util.*;
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    29
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    30
import com.sun.javadoc.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
import com.sun.tools.doclets.internal.toolkit.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
import com.sun.tools.doclets.internal.toolkit.taglets.*;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    33
import com.sun.tools.doclets.formats.html.markup.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 * Generate serialized form for serializable fields.
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * Documentation denoted by the tags <code>serial</code> and
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * <code>serialField</code> is processed.
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * @author Joe Fialli
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    41
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
public class HtmlSerialFieldWriter extends FieldWriterImpl
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
    implements SerializedFormWriter.SerialFieldWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
    ProgramElementDoc[] members = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
    private boolean printedOverallAnchor = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
    public HtmlSerialFieldWriter(SubWriterHolderWriter writer,
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
                                    ClassDoc classdoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
        super(writer, classdoc);
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
    54
    public List<FieldDoc> members(ClassDoc cd) {
8631
664f84942e74 6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents: 7681
diff changeset
    55
        return Arrays.asList(cd.serializableFields());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
    protected void printTypeLinkNoDimension(Type type) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
        ClassDoc cd = type.asClassDoc();
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
        //Linking to package private classes in serialized for causes
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
        //broken links.  Don't link to them.
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
        if (type.isPrimitive() || cd.isPackagePrivate()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
            print(type.typeName());
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
            writer.printLink(new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
                LinkInfoImpl.CONTEXT_SERIAL_MEMBER, type));
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    70
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    71
     * Return the header for serializable fields section.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    72
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    73
     * @return a content tree for the header
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    74
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    75
    public Content getSerializableFieldsHeader() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    76
        HtmlTree ul = new HtmlTree(HtmlTag.UL);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    77
        ul.addStyle(HtmlStyle.blockList);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    78
        return ul;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    81
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    82
     * Return the header for serializable fields content section.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    83
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    84
     * @param isLastContent true if the cotent being documented is the last content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    85
     * @return a content tree for the header
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    86
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    87
    public Content getFieldsContentHeader(boolean isLastContent) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    88
        HtmlTree li = new HtmlTree(HtmlTag.LI);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    89
        if (isLastContent)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    90
            li.addStyle(HtmlStyle.blockListLast);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    91
        else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    92
            li.addStyle(HtmlStyle.blockList);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    93
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    97
     * Add serializable fields.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
     *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    99
     * @param heading the heading for the section
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   100
     * @param serializableFieldsTree the tree to be added to the serializable fileds
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   101
     *        content tree
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   102
     * @return a content tree for the serializable fields content
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   104
    public Content getSerializableFields(String heading, Content serializableFieldsTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   105
        HtmlTree li = new HtmlTree(HtmlTag.LI);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   106
        li.addStyle(HtmlStyle.blockList);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   107
        if (serializableFieldsTree.isValid()) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   108
            if (!printedOverallAnchor) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   109
                li.addContent(writer.getMarkerAnchor("serializedForm"));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   110
                printedOverallAnchor = true;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   111
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   112
            Content headingContent = new StringContent(heading);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   113
            Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   114
                    headingContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   115
            li.addContent(serialHeading);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   116
            li.addContent(serializableFieldsTree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   117
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   118
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   122
     * Add the member header.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   123
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   124
     * @param fieldsType the class document to be listed
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   125
     * @param fieldTypeStr the string for the filed type to be documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   126
     * @param fieldDimensions the dimensions of the field string to be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   127
     * @param firldName name of the field to be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   128
     * @param contentTree the content tree to which the member header will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   129
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   130
    public void addMemberHeader(ClassDoc fieldType, String fieldTypeStr,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   131
            String fieldDimensions, String fieldName, Content contentTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   132
        Content nameContent = new RawHtml(fieldName);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   133
        Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, nameContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   134
        contentTree.addContent(heading);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   135
        Content pre = new HtmlTree(HtmlTag.PRE);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   136
        if (fieldType == null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   137
            pre.addContent(fieldTypeStr);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   138
        } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   139
            Content fieldContent = new RawHtml(writer.getLink(new LinkInfoImpl(
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   140
                    LinkInfoImpl.CONTEXT_SERIAL_MEMBER, fieldType)));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   141
            pre.addContent(fieldContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   142
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   143
        pre.addContent(fieldDimensions + " ");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   144
        pre.addContent(fieldName);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   145
        contentTree.addContent(pre);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   146
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   147
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   148
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   149
     * Add the deprecated information for this member.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     * @param field the field to document.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   152
     * @param contentTree the tree to which the deprecated info will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   154
    public void addMemberDeprecatedInfo(FieldDoc field, Content contentTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   155
        addDeprecatedInfo(field, contentTree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   156
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   157
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   158
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   159
     * Add the description text for this member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   160
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   161
     * @param field the field to document.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   162
     * @param contentTree the tree to which the deprecated info will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   163
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   164
    public void addMemberDescription(FieldDoc field, Content contentTree) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
        if (field.inlineTags().length > 0) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   166
            writer.addInlineComment(field, contentTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
        Tag[] tags = field.tags("serial");
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
        if (tags.length > 0) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   170
            writer.addInlineComment(field, tags[0], contentTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   175
     * Add the description text for this member represented by the tag.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
     *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   177
     * @param serialFieldTag the field to document (represented by tag)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   178
     * @param contentTree the tree to which the deprecated info will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   180
    public void addMemberDescription(SerialFieldTag serialFieldTag, Content contentTree) {
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   181
        String serialFieldTagDesc = serialFieldTag.description().trim();
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   182
        if (!serialFieldTagDesc.isEmpty()) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   183
            Content serialFieldContent = new RawHtml(serialFieldTagDesc);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   184
            Content div = HtmlTree.DIV(HtmlStyle.block, serialFieldContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   185
            contentTree.addContent(div);
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   186
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   190
     * Add the tag information for this member.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
     * @param field the field to document.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   193
     * @param contentTree the tree to which the member tags info will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   195
    public void addMemberTags(FieldDoc field, Content contentTree) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
        TagletOutputImpl output = new TagletOutputImpl("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
        TagletWriter.genTagOuput(configuration().tagletManager, field,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   198
                configuration().tagletManager.getCustomTags(field),
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
                writer.getTagletWriterInstance(false), output);
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   200
        String outputString = output.toString().trim();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   201
        Content dlTags = new HtmlTree(HtmlTag.DL);
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   202
        if (!outputString.isEmpty()) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   203
            Content tagContent = new RawHtml(outputString);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   204
            dlTags.addContent(tagContent);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   206
        contentTree.addContent(dlTags);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
    }
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   208
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   209
    /**
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   210
     * Check to see if overview details should be printed. If
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   211
     * nocomment option set or if there is no text to be printed
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   212
     * for deprecation info, comment or tags, do not print overview details.
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   213
     *
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   214
     * @param field the field to check overview details for.
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   215
     * @return true if overview details need to be printed
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   216
     */
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   217
    public boolean shouldPrintOverview(FieldDoc field) {
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   218
        if (!configuration().nocomment) {
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   219
            if(!field.commentText().isEmpty() ||
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   220
                    writer.hasSerializationOverviewTags(field))
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   221
                return true;
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   222
        }
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   223
        if (field.tags("deprecated").length > 0)
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   224
            return true;
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   225
        return false;
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   226
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
}