1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java Tue Nov 30 09:38:48 2010 -0800 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java Wed Dec 01 11:02:38 2010 -0800 1.3 @@ -25,11 +25,14 @@ 1.4 1.5 package com.sun.tools.doclets.formats.html; 1.6 1.7 -import com.sun.tools.doclets.internal.toolkit.util.*; 1.8 -import com.sun.javadoc.*; 1.9 import java.io.*; 1.10 import java.util.*; 1.11 1.12 +import com.sun.javadoc.*; 1.13 +import com.sun.tools.doclets.internal.toolkit.*; 1.14 +import com.sun.tools.doclets.internal.toolkit.util.*; 1.15 +import com.sun.tools.doclets.formats.html.markup.*; 1.16 + 1.17 /** 1.18 * Generate the file with list of all the classes in this run. This page will be 1.19 * used in the left-hand bottom frame, when "All Classes" link is clicked in 1.20 @@ -38,6 +41,7 @@ 1.21 * 1.22 * @author Atul M Dambalkar 1.23 * @author Doug Kramer 1.24 + * @author Bhavesh Patel (Modified) 1.25 */ 1.26 public class AllClassesFrameWriter extends HtmlDocletWriter { 1.27 1.28 @@ -57,6 +61,11 @@ 1.29 protected IndexBuilder indexbuilder; 1.30 1.31 /** 1.32 + * BR tag to be used within a document tree. 1.33 + */ 1.34 + final HtmlTree BR = new HtmlTree(HtmlTag.BR); 1.35 + 1.36 + /** 1.37 * Construct AllClassesFrameWriter object. Also initilises the indexbuilder 1.38 * variable in this class. 1.39 * @throws IOException 1.40 @@ -84,12 +93,12 @@ 1.41 try { 1.42 allclassgen = new AllClassesFrameWriter(configuration, 1.43 filename, indexbuilder); 1.44 - allclassgen.generateAllClassesFile(true); 1.45 + allclassgen.buildAllClassesFile(true); 1.46 allclassgen.close(); 1.47 filename = OUTPUT_FILE_NAME_NOFRAMES; 1.48 allclassgen = new AllClassesFrameWriter(configuration, 1.49 filename, indexbuilder); 1.50 - allclassgen.generateAllClassesFile(false); 1.51 + allclassgen.buildAllClassesFile(false); 1.52 allclassgen.close(); 1.53 } catch (IOException exc) { 1.54 configuration.standardmessage. 1.55 @@ -100,30 +109,34 @@ 1.56 } 1.57 1.58 /** 1.59 - * Print all the classes in table format in the file. 1.60 + * Print all the classes in the file. 1.61 * @param wantFrames True if we want frames. 1.62 */ 1.63 - protected void generateAllClassesFile(boolean wantFrames) throws IOException { 1.64 + protected void buildAllClassesFile(boolean wantFrames) throws IOException { 1.65 String label = configuration.getText("doclet.All_Classes"); 1.66 - 1.67 - printHtmlHeader(label, null, false); 1.68 - 1.69 - printAllClassesTableHeader(); 1.70 - printAllClasses(wantFrames); 1.71 - printAllClassesTableFooter(); 1.72 - 1.73 - printBodyHtmlEnd(); 1.74 + Content body = getBody(false, getWindowTitle(label)); 1.75 + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, 1.76 + HtmlStyle.bar, allclassesLabel); 1.77 + body.addContent(heading); 1.78 + Content ul = new HtmlTree(HtmlTag.UL); 1.79 + // Generate the class links and add it to the tdFont tree. 1.80 + addAllClasses(ul, wantFrames); 1.81 + Content div = HtmlTree.DIV(HtmlStyle.indexContainer, ul); 1.82 + body.addContent(div); 1.83 + printHtmlDocument(null, false, body); 1.84 } 1.85 1.86 /** 1.87 - * Use the sorted index of all the classes and print all the classes. 1.88 + * Use the sorted index of all the classes and add all the classes to the 1.89 + * content list. 1.90 * 1.91 + * @param content HtmlTree content to which all classes information will be added 1.92 * @param wantFrames True if we want frames. 1.93 */ 1.94 - protected void printAllClasses(boolean wantFrames) { 1.95 + protected void addAllClasses(Content content, boolean wantFrames) { 1.96 for (int i = 0; i < indexbuilder.elements().length; i++) { 1.97 Character unicode = (Character)((indexbuilder.elements())[i]); 1.98 - generateContents(indexbuilder.getMemberList(unicode), wantFrames); 1.99 + addContents(indexbuilder.getMemberList(unicode), wantFrames, content); 1.100 } 1.101 } 1.102 1.103 @@ -136,46 +149,25 @@ 1.104 * 1.105 * @param classlist Sorted list of classes. 1.106 * @param wantFrames True if we want frames. 1.107 + * @param content HtmlTree content to which the links will be added 1.108 */ 1.109 - protected void generateContents(List<Doc> classlist, boolean wantFrames) { 1.110 + protected void addContents(List<Doc> classlist, boolean wantFrames, 1.111 + Content content) { 1.112 for (int i = 0; i < classlist.size(); i++) { 1.113 ClassDoc cd = (ClassDoc)classlist.get(i); 1.114 if (!Util.isCoreClass(cd)) { 1.115 continue; 1.116 } 1.117 String label = italicsClassName(cd, false); 1.118 + Content linkContent; 1.119 if(wantFrames){ 1.120 - printLink(new LinkInfoImpl(LinkInfoImpl.ALL_CLASSES_FRAME, cd, 1.121 - label, "classFrame") 1.122 - ); 1.123 + linkContent = new RawHtml(getLink(new LinkInfoImpl( 1.124 + LinkInfoImpl.ALL_CLASSES_FRAME, cd, label, "classFrame"))); 1.125 } else { 1.126 - printLink(new LinkInfoImpl(cd, label)); 1.127 + linkContent = new RawHtml(getLink(new LinkInfoImpl(cd, label))); 1.128 } 1.129 - br(); 1.130 + Content li = HtmlTree.LI(linkContent); 1.131 + content.addContent(li); 1.132 } 1.133 } 1.134 - 1.135 - /** 1.136 - * Print the heading "All Classes" and also print Html table tag. 1.137 - */ 1.138 - protected void printAllClassesTableHeader() { 1.139 - fontSizeStyle("+1", "FrameHeadingFont"); 1.140 - strongText("doclet.All_Classes"); 1.141 - fontEnd(); 1.142 - br(); 1.143 - table(); 1.144 - tr(); 1.145 - tdNowrap(); 1.146 - fontStyle("FrameItemFont"); 1.147 - } 1.148 - 1.149 - /** 1.150 - * Print Html closing table tag. 1.151 - */ 1.152 - protected void printAllClassesTableFooter() { 1.153 - fontEnd(); 1.154 - tdEnd(); 1.155 - trEnd(); 1.156 - tableEnd(); 1.157 - } 1.158 }