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

changeset 766
90af8d87741f
parent 554
9d9f26857129
child 798
4868a36f6fd8
     1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java	Tue Nov 30 09:38:48 2010 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java	Wed Dec 01 11:02:38 2010 -0800
     1.3 @@ -25,9 +25,10 @@
     1.4  
     1.5  package com.sun.tools.doclets.formats.html;
     1.6  
     1.7 +import java.io.*;
     1.8  import com.sun.tools.doclets.internal.toolkit.util.*;
     1.9 -
    1.10 -import java.io.*;
    1.11 +import com.sun.tools.doclets.formats.html.markup.*;
    1.12 +import com.sun.tools.doclets.internal.toolkit.*;
    1.13  
    1.14  /**
    1.15   * Generate only one index file for all the Member Names with Indexing in
    1.16 @@ -36,6 +37,7 @@
    1.17   *
    1.18   * @see java.lang.Character
    1.19   * @author Atul M Dambalkar
    1.20 + * @author Bhavesh Patel (Modified)
    1.21   */
    1.22  public class SingleIndexWriter extends AbstractIndexWriter {
    1.23  
    1.24 @@ -82,34 +84,35 @@
    1.25       * Member Field, Method and Constructor Description.
    1.26       */
    1.27      protected void generateIndexFile() throws IOException {
    1.28 -        printHtmlHeader(configuration.getText("doclet.Window_Single_Index"),
    1.29 -            null, true);
    1.30 -        printTop();
    1.31 -        navLinks(true);
    1.32 -        printLinksForIndexes();
    1.33 -
    1.34 -        hr();
    1.35 -
    1.36 +        String title = configuration.getText("doclet.Window_Single_Index");
    1.37 +        Content body = getBody(true, getWindowTitle(title));
    1.38 +        addTop(body);
    1.39 +        addNavLinks(true, body);
    1.40 +        HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
    1.41 +        divTree.addStyle(HtmlStyle.contentContainer);
    1.42 +        addLinksForIndexes(divTree);
    1.43          for (int i = 0; i < indexbuilder.elements().length; i++) {
    1.44              Character unicode = (Character)((indexbuilder.elements())[i]);
    1.45 -            generateContents(unicode, indexbuilder.getMemberList(unicode));
    1.46 +            addContents(unicode, indexbuilder.getMemberList(unicode), divTree);
    1.47          }
    1.48 -
    1.49 -        printLinksForIndexes();
    1.50 -        navLinks(false);
    1.51 -
    1.52 -        printBottom();
    1.53 -        printBodyHtmlEnd();
    1.54 +        addLinksForIndexes(divTree);
    1.55 +        body.addContent(divTree);
    1.56 +        addNavLinks(false, body);
    1.57 +        addBottom(body);
    1.58 +        printHtmlDocument(null, true, body);
    1.59      }
    1.60  
    1.61      /**
    1.62 -     * Print Links for all the Index Files per unicode character.
    1.63 +     * Add links for all the Index Files per unicode character.
    1.64 +     *
    1.65 +     * @param contentTree the content tree to which the links for indexes will be added
    1.66       */
    1.67 -    protected void printLinksForIndexes() {
    1.68 +    protected void addLinksForIndexes(Content contentTree) {
    1.69          for (int i = 0; i < indexbuilder.elements().length; i++) {
    1.70              String unicode = (indexbuilder.elements())[i].toString();
    1.71 -            printHyperLink("#_" + unicode + "_", unicode);
    1.72 -            print(' ');
    1.73 +            contentTree.addContent(
    1.74 +                    getHyperLink("#_" + unicode + "_", new StringContent(unicode)));
    1.75 +            contentTree.addContent(getSpace());
    1.76          }
    1.77      }
    1.78  }

mercurial