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

Thu, 19 Mar 2009 19:00:54 -0700

author
bpatel
date
Thu, 19 Mar 2009 19:00:54 -0700
changeset 243
edd944553131
parent 1
9a66ca7c79fa
child 554
9d9f26857129
permissions
-rw-r--r--

6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
Reviewed-by: jjg

     1 /*
     2  * Copyright 1998-2005 Sun Microsystems, Inc.  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.  Sun designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    22  * CA 95054 USA or visit www.sun.com if you need additional information or
    23  * have any questions.
    24  */
    26 package com.sun.tools.doclets.formats.html;
    28 import com.sun.tools.doclets.internal.toolkit.util.*;
    30 import java.io.*;
    32 /**
    33  * Writes the style sheet for the doclet output.
    34  *
    35  * @author Atul M Dambalkar
    36  * @author Bhavesh Patel (Modified)
    37  */
    38 public class StylesheetWriter extends HtmlDocletWriter {
    40     /**
    41      * Constructor.
    42      */
    43     public StylesheetWriter(ConfigurationImpl configuration,
    44                             String filename) throws IOException {
    45         super(configuration, filename);
    46     }
    48     /**
    49      * Generate the style file contents.
    50      * @throws DocletAbortException
    51      */
    52     public static void generate(ConfigurationImpl configuration) {
    53         StylesheetWriter stylegen;
    54         String filename = "";
    55         try {
    56             filename = "stylesheet.css";
    57             stylegen = new StylesheetWriter(configuration, filename);
    58             stylegen.generateStyleFile();
    59             stylegen.close();
    60         } catch (IOException exc) {
    61             configuration.standardmessage.error(
    62                         "doclet.exception_encountered",
    63                         exc.toString(), filename);
    64             throw new DocletAbortException();
    65         }
    66     }
    68     /**
    69      * Generate the style file contents.
    70      */
    71     protected void generateStyleFile() {
    72         print("/* "); printText("doclet.Style_line_1"); println(" */");
    73         println("");
    75         print("/* "); printText("doclet.Style_line_2"); println(" */");
    76         println("");
    78         print("/* "); printText("doclet.Style_line_3"); println(" */");
    79         println("body { background-color: #FFFFFF; color:#000000 }");
    80         println("");
    82         print("/* "); printText("doclet.Style_Headings"); println(" */");
    83         println("h1 { font-size: 145% }");
    84         println("");
    86         print("/* "); printText("doclet.Style_line_4"); println(" */");
    87         print(".TableHeadingColor     { background: #CCCCFF; color:#000000 }");
    88         print(" /* "); printText("doclet.Style_line_5"); println(" */");
    89         print(".TableSubHeadingColor  { background: #EEEEFF; color:#000000 }");
    90         print(" /* "); printText("doclet.Style_line_6"); println(" */");
    91         print(".TableRowColor         { background: #FFFFFF; color:#000000 }");
    92         print(" /* "); printText("doclet.Style_line_7"); println(" */");
    93         println("");
    95         print("/* "); printText("doclet.Style_line_8"); println(" */");
    96         println(".FrameTitleFont   { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 }");
    97         println(".FrameHeadingFont { font-size:  90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }");
    98         println(".FrameItemFont    { font-size:  90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }");
    99         println("");
   101        // Removed doclet.Style_line_9 as no longer needed
   103         print("/* "); printText("doclet.Style_line_10"); println(" */");
   104         print(".NavBarCell1    { background-color:#EEEEFF; color:#000000}");
   105         print(" /* "); printText("doclet.Style_line_6"); println(" */");
   106         print(".NavBarCell1Rev { background-color:#00008B; color:#FFFFFF}");
   107         print(" /* "); printText("doclet.Style_line_11"); println(" */");
   109         print(".NavBarFont1    { font-family: Arial, Helvetica, sans-serif; color:#000000;");
   110         println("color:#000000;}");
   111         print(".NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;");
   112         println("color:#FFFFFF;}");
   113         println("");
   115         print(".NavBarCell2    { font-family: Arial, Helvetica, sans-serif; ");
   116         println("background-color:#FFFFFF; color:#000000}");
   117         print(".NavBarCell3    { font-family: Arial, Helvetica, sans-serif; ");
   118         println("background-color:#FFFFFF; color:#000000}");
   120         print("/* "); printText("doclet.Style_line_12"); println(" */");
   121         print(".TableCaption     { background: #CCCCFF; color:#000000; text-align: left; font-size: 150%; font-weight: bold; border-left: 2px ridge; border-right: 2px ridge; border-top: 2px ridge; padding-left: 5px; }");
   122         print(" /* "); printText("doclet.Style_line_5"); println(" */");
   123         print(".TableSubCaption  { background: #EEEEFF; color:#000000; text-align: left; font-weight: bold; border-left: 2px ridge; border-right: 2px ridge; border-top: 2px ridge; padding-left: 5px; }");
   124         print(" /* "); printText("doclet.Style_line_6"); println(" */");
   125         print(".TableHeader     { text-align: center; font-size: 80%; font-weight: bold; }");
   126         println("");
   128     }
   130 }

mercurial