src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java

Sat, 13 Apr 2013 18:48:29 -0700

author
bpatel
date
Sat, 13 Apr 2013 18:48:29 -0700
changeset 1691
f10cffab99b4
parent 1568
5f0731e4e5e6
child 2023
cf37c3775397
permissions
-rw-r--r--

8009686: Generated javadoc documentation should be able to display type annotation on an array
Reviewed-by: jjg

bpatel@1568 1 /*
bpatel@1568 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
bpatel@1568 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bpatel@1568 4 *
bpatel@1568 5 * This code is free software; you can redistribute it and/or modify it
bpatel@1568 6 * under the terms of the GNU General Public License version 2 only, as
bpatel@1568 7 * published by the Free Software Foundation. Oracle designates this
bpatel@1568 8 * particular file as subject to the "Classpath" exception as provided
bpatel@1568 9 * by Oracle in the LICENSE file that accompanied this code.
bpatel@1568 10 *
bpatel@1568 11 * This code is distributed in the hope that it will be useful, but WITHOUT
bpatel@1568 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bpatel@1568 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
bpatel@1568 14 * version 2 for more details (a copy is included in the LICENSE file that
bpatel@1568 15 * accompanied this code).
bpatel@1568 16 *
bpatel@1568 17 * You should have received a copy of the GNU General Public License version
bpatel@1568 18 * 2 along with this work; if not, write to the Free Software Foundation,
bpatel@1568 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bpatel@1568 20 *
bpatel@1568 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bpatel@1568 22 * or visit www.oracle.com if you need additional information or have any
bpatel@1568 23 * questions.
bpatel@1568 24 */
bpatel@1568 25
bpatel@1568 26 package com.sun.tools.doclets.formats.html;
bpatel@1568 27
bpatel@1568 28 import java.io.*;
bpatel@1568 29 import java.util.*;
bpatel@1568 30
bpatel@1568 31 import com.sun.javadoc.*;
bpatel@1568 32 import com.sun.tools.javac.jvm.Profile;
bpatel@1568 33 import com.sun.tools.doclets.formats.html.markup.*;
bpatel@1568 34 import com.sun.tools.doclets.internal.toolkit.*;
bpatel@1568 35 import com.sun.tools.doclets.internal.toolkit.util.*;
bpatel@1568 36
bpatel@1568 37 /**
bpatel@1568 38 * Class to generate file for each profile contents in the right-hand
bpatel@1568 39 * frame. This will list all the packages and Class Kinds in the profile. A click on any
bpatel@1568 40 * class-kind will update the frame with the clicked class-kind page. A click on any
bpatel@1568 41 * package will update the frame with the clicked profile package page.
bpatel@1568 42 *
bpatel@1568 43 * <p><b>This is NOT part of any supported API.
bpatel@1568 44 * If you write code that depends on this, you do so at your own risk.
bpatel@1568 45 * This code and its internal interfaces are subject to change or
bpatel@1568 46 * deletion without notice.</b>
bpatel@1568 47 *
bpatel@1568 48 * @author Bhavesh Patel
bpatel@1568 49 */
bpatel@1568 50 public class ProfileWriterImpl extends HtmlDocletWriter
bpatel@1568 51 implements ProfileSummaryWriter {
bpatel@1568 52
bpatel@1568 53 /**
bpatel@1568 54 * The prev profile name in the alpha-order list.
bpatel@1568 55 */
bpatel@1568 56 protected Profile prevProfile;
bpatel@1568 57
bpatel@1568 58 /**
bpatel@1568 59 * The next profile name in the alpha-order list.
bpatel@1568 60 */
bpatel@1568 61 protected Profile nextProfile;
bpatel@1568 62
bpatel@1568 63 /**
bpatel@1568 64 * The profile being documented.
bpatel@1568 65 */
bpatel@1568 66 protected Profile profile;
bpatel@1568 67
bpatel@1568 68 /**
bpatel@1568 69 * Constructor to construct ProfileWriter object and to generate
bpatel@1568 70 * "profileName-summary.html" file.
bpatel@1568 71 *
bpatel@1568 72 * @param configuration the configuration of the doclet.
bpatel@1568 73 * @param profile Profile under consideration.
bpatel@1568 74 * @param prevProfile Previous profile in the sorted array.
bpatel@1568 75 * @param nextProfile Next profile in the sorted array.
bpatel@1568 76 */
bpatel@1568 77 public ProfileWriterImpl(ConfigurationImpl configuration,
bpatel@1568 78 Profile profile, Profile prevProfile, Profile nextProfile)
bpatel@1568 79 throws IOException {
bpatel@1568 80 super(configuration, DocPaths.profileSummary(profile.name));
bpatel@1568 81 this.prevProfile = prevProfile;
bpatel@1568 82 this.nextProfile = nextProfile;
bpatel@1568 83 this.profile = profile;
bpatel@1568 84 }
bpatel@1568 85
bpatel@1568 86 /**
bpatel@1568 87 * {@inheritDoc}
bpatel@1568 88 */
bpatel@1568 89 public Content getProfileHeader(String heading) {
bpatel@1568 90 String profileName = profile.name;
bpatel@1568 91 Content bodyTree = getBody(true, getWindowTitle(profileName));
bpatel@1568 92 addTop(bodyTree);
bpatel@1568 93 addNavLinks(true, bodyTree);
bpatel@1568 94 HtmlTree div = new HtmlTree(HtmlTag.DIV);
bpatel@1568 95 div.addStyle(HtmlStyle.header);
bpatel@1568 96 Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
bpatel@1568 97 HtmlStyle.title, profileLabel);
bpatel@1568 98 tHeading.addContent(getSpace());
bpatel@1568 99 Content profileHead = new RawHtml(heading);
bpatel@1568 100 tHeading.addContent(profileHead);
bpatel@1568 101 div.addContent(tHeading);
bpatel@1568 102 bodyTree.addContent(div);
bpatel@1568 103 return bodyTree;
bpatel@1568 104 }
bpatel@1568 105
bpatel@1568 106 /**
bpatel@1568 107 * {@inheritDoc}
bpatel@1568 108 */
bpatel@1568 109 public Content getContentHeader() {
bpatel@1568 110 HtmlTree div = new HtmlTree(HtmlTag.DIV);
bpatel@1568 111 div.addStyle(HtmlStyle.contentContainer);
bpatel@1568 112 return div;
bpatel@1568 113 }
bpatel@1568 114
bpatel@1568 115 /**
bpatel@1568 116 * {@inheritDoc}
bpatel@1568 117 */
bpatel@1568 118 public Content getSummaryHeader() {
bpatel@1568 119 HtmlTree li = new HtmlTree(HtmlTag.LI);
bpatel@1568 120 li.addStyle(HtmlStyle.blockList);
bpatel@1568 121 return li;
bpatel@1568 122 }
bpatel@1568 123
bpatel@1568 124 /**
bpatel@1568 125 * {@inheritDoc}
bpatel@1568 126 */
bpatel@1568 127 public Content getSummaryTree(Content summaryContentTree) {
bpatel@1568 128 HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
bpatel@1568 129 HtmlTree div = HtmlTree.DIV(HtmlStyle.summary, ul);
bpatel@1568 130 return div;
bpatel@1568 131 }
bpatel@1568 132
bpatel@1568 133 /**
bpatel@1568 134 * {@inheritDoc}
bpatel@1568 135 */
bpatel@1568 136 public Content getPackageSummaryHeader(PackageDoc pkg) {
bpatel@1568 137 Content pkgName = getTargetProfilePackageLink(pkg,
bpatel@1568 138 "classFrame", new StringContent(pkg.name()), profile.name);
bpatel@1568 139 Content heading = HtmlTree.HEADING(HtmlTag.H3, pkgName);
bpatel@1568 140 HtmlTree li = HtmlTree.LI(HtmlStyle.blockList, heading);
bpatel@1568 141 return li;
bpatel@1568 142 }
bpatel@1568 143
bpatel@1568 144 /**
bpatel@1568 145 * {@inheritDoc}
bpatel@1568 146 */
bpatel@1568 147 public Content getPackageSummaryTree(Content packageSummaryContentTree) {
bpatel@1568 148 HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, packageSummaryContentTree);
bpatel@1568 149 return ul;
bpatel@1568 150 }
bpatel@1568 151
bpatel@1568 152 /**
bpatel@1568 153 * {@inheritDoc}
bpatel@1568 154 */
bpatel@1568 155 public void addClassesSummary(ClassDoc[] classes, String label,
bpatel@1568 156 String tableSummary, String[] tableHeader, Content packageSummaryContentTree) {
bpatel@1568 157 addClassesSummary(classes, label, tableSummary, tableHeader,
bpatel@1568 158 packageSummaryContentTree, profile.value);
bpatel@1568 159 }
bpatel@1568 160
bpatel@1568 161 /**
bpatel@1568 162 * {@inheritDoc}
bpatel@1568 163 */
bpatel@1568 164 public void addProfileFooter(Content contentTree) {
bpatel@1568 165 addNavLinks(false, contentTree);
bpatel@1568 166 addBottom(contentTree);
bpatel@1568 167 }
bpatel@1568 168
bpatel@1568 169 /**
bpatel@1568 170 * {@inheritDoc}
bpatel@1568 171 */
bpatel@1568 172 public void printDocument(Content contentTree) throws IOException {
bpatel@1568 173 printHtmlDocument(configuration.metakeywords.getMetaKeywords(profile),
bpatel@1568 174 true, contentTree);
bpatel@1568 175 }
bpatel@1568 176
bpatel@1568 177 /**
bpatel@1568 178 * Get "PREV PROFILE" link in the navigation bar.
bpatel@1568 179 *
bpatel@1568 180 * @return a content tree for the previous link
bpatel@1568 181 */
bpatel@1568 182 public Content getNavLinkPrevious() {
bpatel@1568 183 Content li;
bpatel@1568 184 if (prevProfile == null) {
bpatel@1568 185 li = HtmlTree.LI(prevprofileLabel);
bpatel@1568 186 } else {
bpatel@1568 187 li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.profileSummary(
bpatel@1568 188 prevProfile.name)), prevprofileLabel, "", ""));
bpatel@1568 189 }
bpatel@1568 190 return li;
bpatel@1568 191 }
bpatel@1568 192
bpatel@1568 193 /**
bpatel@1568 194 * Get "NEXT PROFILE" link in the navigation bar.
bpatel@1568 195 *
bpatel@1568 196 * @return a content tree for the next link
bpatel@1568 197 */
bpatel@1568 198 public Content getNavLinkNext() {
bpatel@1568 199 Content li;
bpatel@1568 200 if (nextProfile == null) {
bpatel@1568 201 li = HtmlTree.LI(nextprofileLabel);
bpatel@1568 202 } else {
bpatel@1568 203 li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.profileSummary(
bpatel@1568 204 nextProfile.name)), nextprofileLabel, "", ""));
bpatel@1568 205 }
bpatel@1568 206 return li;
bpatel@1568 207 }
bpatel@1568 208 }

mercurial