1/*
2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
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
26package jdk.javadoc.internal.doclets.toolkit;
27
28import java.util.*;
29
30import javax.lang.model.element.PackageElement;
31import javax.lang.model.element.TypeElement;
32import javax.lang.model.element.VariableElement;
33
34import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
35
36/**
37 * The interface for writing constants summary output.
38 *
39 *  <p><b>This is NOT part of any supported API.
40 *  If you write code that depends on this, you do so at your own risk.
41 *  This code and its internal interfaces are subject to change or
42 *  deletion without notice.</b>
43 *
44 * @author Jamie Ho
45 * @author Bhavesh Patel (Modified)
46 */
47
48public interface ConstantsSummaryWriter {
49
50    /**
51     * Get the header for the constant summary documentation.
52     *
53     * @return header that needs to be added to the documentation
54     */
55    public abstract Content getHeader();
56
57    /**
58     * Get the header for the constant content list.
59     *
60     * @return content header that needs to be added to the documentation
61     */
62    public abstract Content getContentsHeader();
63
64    /**
65     * Adds the given package name link to the constant content list tree.
66     *
67     * @param pkg                    the {@link PackageElement} to index.
68     * @param writtenPackageHeaders  the set of package headers that have already
69     *                               been indexed, we want to index utmost once.
70     * @param contentListTree        the content tree to which the link will be added
71     */
72    public abstract void addLinkToPackageContent(PackageElement pkg,
73            Set<PackageElement> writtenPackageHeaders, Content contentListTree);
74
75    /**
76     * Add the content list to the documentation tree.
77     *
78     * @param contentTree the tree to which the contents list will be added
79     * @param contentListTree the content that will be added to the list
80     */
81    public abstract void addContentsList(Content contentTree, Content contentListTree);
82
83    /**
84     * Get the constant summaries for the document.
85     *
86     * @return constant summaries header to be added to the documentation tree
87     */
88    public abstract Content getConstantSummaries();
89
90    /**
91     * Adds the given package name.
92     *
93     * @param pkg  the parsed package name.  We only Write the
94     *                          first 2 directory levels of the package
95     *                          name. For example, java.lang.ref would be
96     *                          indexed as java.lang.*.
97     * @param summariesTree the summaries documentation tree
98     * @param first true if the first package is listed
99     *                    be written
100     */
101    public abstract void addPackageName(PackageElement pkg, Content summariesTree, boolean first);
102
103    /**
104     * Get the class summary header for the constants summary.
105     *
106     * @return the header content for the class constants summary
107     */
108    public abstract Content getClassConstantHeader();
109
110    /**
111     * Add the content list to the documentation summaries tree.
112     *
113     * @param summariesTree the tree to which the class constants list will be added
114     * @param classConstantTree the class constant tree that will be added to the list
115     */
116    public abstract void addClassConstant(Content summariesTree, Content classConstantTree);
117
118    /**
119     * Adds the constant member table to the documentation tree.
120     *
121     * @param typeElement the class whose constants are being documented.
122     * @param fields the constants being documented.
123     * @param classConstantTree the documentation tree to which theconstant member
124     *                    table content will be added
125     */
126    public abstract void addConstantMembers(TypeElement typeElement, Collection<VariableElement> fields,
127            Content classConstantTree);
128
129    /**
130     * Add the summaries list to the content tree.
131     *
132     * @param contentTree the tree to which the summaries list will be added
133     * @param summariesTree the summaries content tree that will be added to the list
134     */
135    public abstract void addConstantSummaries(Content contentTree, Content summariesTree);
136
137    /**
138     * Adds the footer for the summary documentation.
139     *
140     * @param contentTree content tree to which the footer will be added
141     */
142    public abstract void addFooter(Content contentTree);
143
144    /**
145     * Print the constants summary document.
146     *
147     * @param contentTree content tree which should be printed
148     * @throws DocFileIOException if there is a problem while writing the document
149     */
150    public abstract void printDocument(Content contentTree) throws DocFileIOException;
151
152}
153