langtools/src/share/classes/com/sun/tools/doclets/formats/html/StylesheetWriter.java
changeset 7694 68672dc4d96f
parent 7691 ec07a04e74e7
parent 7646 142129d8599d
child 7695 e15276b5c5cc
equal deleted inserted replaced
7691:ec07a04e74e7 7694:68672dc4d96f
     1 /*
       
     2  * Copyright (c) 1998, 2005, 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 
       
    26 package com.sun.tools.doclets.formats.html;
       
    27 
       
    28 import com.sun.tools.doclets.internal.toolkit.util.*;
       
    29 
       
    30 import java.io.*;
       
    31 
       
    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 {
       
    39 
       
    40     /**
       
    41      * Constructor.
       
    42      */
       
    43     public StylesheetWriter(ConfigurationImpl configuration,
       
    44                             String filename) throws IOException {
       
    45         super(configuration, filename);
       
    46     }
       
    47 
       
    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     }
       
    67 
       
    68     /**
       
    69      * Generate the style file contents.
       
    70      */
       
    71     protected void generateStyleFile() {
       
    72         print("/* "); printText("doclet.Style_line_1"); println(" */");
       
    73         println("");
       
    74 
       
    75         print("/* "); printText("doclet.Style_line_2"); println(" */");
       
    76         println("");
       
    77 
       
    78         print("/* "); printText("doclet.Style_line_3"); println(" */");
       
    79         println("body { background-color: #FFFFFF; color:#000000 }");
       
    80         println("");
       
    81 
       
    82         print("/* "); printText("doclet.Style_Headings"); println(" */");
       
    83         println("h1 { font-size: 145% }");
       
    84         println("");
       
    85 
       
    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("");
       
    94 
       
    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("");
       
   100 
       
   101        // Removed doclet.Style_line_9 as no longer needed
       
   102 
       
   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(" */");
       
   108 
       
   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("");
       
   114 
       
   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}");
       
   119 
       
   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("");
       
   127 
       
   128     }
       
   129 
       
   130 }