langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java
changeset 29429 964498d4dcec
parent 25874 83c19f00452c
child 29957 7740f9657f56
equal deleted inserted replaced
29428:f720ab1e8427 29429:964498d4dcec
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    53     /**
    53     /**
    54      * Number of packages specified on the command line.
    54      * Number of packages specified on the command line.
    55      */
    55      */
    56     int noOfPackages;
    56     int noOfPackages;
    57 
    57 
    58     private final String SCROLL_YES = "yes";
       
    59 
       
    60     /**
    58     /**
    61      * Constructor to construct FrameOutputWriter object.
    59      * Constructor to construct FrameOutputWriter object.
    62      *
    60      *
    63      * @param filename File to be generated.
    61      * @param filename File to be generated.
    64      */
    62      */
    94     /**
    92     /**
    95      * Generate the constants in the "index.html" file. Print the frame details
    93      * Generate the constants in the "index.html" file. Print the frame details
    96      * as well as warning if browser is not supporting the Html frames.
    94      * as well as warning if browser is not supporting the Html frames.
    97      */
    95      */
    98     protected void generateFrameFile() throws IOException {
    96     protected void generateFrameFile() throws IOException {
    99         Content frameset = getFrameDetails();
    97         Content frame = getFrameDetails();
       
    98         HtmlTree body = new HtmlTree(HtmlTag.BODY);
       
    99         body.addContent(frame);
   100         if (configuration.windowtitle.length() > 0) {
   100         if (configuration.windowtitle.length() > 0) {
   101             printFramesetDocument(configuration.windowtitle, configuration.notimestamp,
   101             printFramesDocument(configuration.windowtitle, configuration,
   102                     frameset);
   102                     body);
   103         } else {
   103         } else {
   104             printFramesetDocument(configuration.getText("doclet.Generated_Docs_Untitled"),
   104             printFramesDocument(configuration.getText("doclet.Generated_Docs_Untitled"),
   105                     configuration.notimestamp, frameset);
   105                     configuration, body);
   106         }
   106         }
   107     }
       
   108 
       
   109     /**
       
   110      * Add the code for issueing the warning for a non-frame capable web
       
   111      * client. Also provide links to the non-frame version documentation.
       
   112      *
       
   113      * @param contentTree the content tree to which the non-frames information will be added
       
   114      */
       
   115     protected void addFrameWarning(Content contentTree) {
       
   116         Content noframes = new HtmlTree(HtmlTag.NOFRAMES);
       
   117         Content noScript = HtmlTree.NOSCRIPT(
       
   118                 HtmlTree.DIV(getResource("doclet.No_Script_Message")));
       
   119         noframes.addContent(noScript);
       
   120         Content noframesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
       
   121                 getResource("doclet.Frame_Alert"));
       
   122         noframes.addContent(noframesHead);
       
   123         Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message",
       
   124                 getHyperLink(configuration.topFile,
       
   125                 configuration.getText("doclet.Non_Frame_Version"))));
       
   126         noframes.addContent(p);
       
   127         contentTree.addContent(noframes);
       
   128     }
   107     }
   129 
   108 
   130     /**
   109     /**
   131      * Get the frame sizes and their contents.
   110      * Get the frame sizes and their contents.
   132      *
   111      *
   133      * @return a content tree for the frame details
   112      * @return a content tree for the frame details
   134      */
   113      */
   135     protected Content getFrameDetails() {
   114     protected Content getFrameDetails() {
   136         HtmlTree frameset = HtmlTree.FRAMESET("20%,80%", null, "Documentation frame",
   115         HtmlTree leftContainerDiv = new HtmlTree(HtmlTag.DIV);
   137                 "top.loadFrames()");
   116         HtmlTree rightContainerDiv = new HtmlTree(HtmlTag.DIV);
       
   117         leftContainerDiv.addStyle(HtmlStyle.leftContainer);
       
   118         rightContainerDiv.addStyle(HtmlStyle.rightContainer);
   138         if (noOfPackages <= 1) {
   119         if (noOfPackages <= 1) {
   139             addAllClassesFrameTag(frameset);
   120             addAllClassesFrameTag(leftContainerDiv);
   140         } else if (noOfPackages > 1) {
   121         } else if (noOfPackages > 1) {
   141             HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames",
   122             addAllPackagesFrameTag(leftContainerDiv);
   142                 "top.loadFrames()");
   123             addAllClassesFrameTag(leftContainerDiv);
   143             addAllPackagesFrameTag(leftFrameset);
       
   144             addAllClassesFrameTag(leftFrameset);
       
   145             frameset.addContent(leftFrameset);
       
   146         }
   124         }
   147         addClassFrameTag(frameset);
   125         addClassFrameTag(rightContainerDiv);
   148         addFrameWarning(frameset);
   126         HtmlTree mainContainer = HtmlTree.DIV(HtmlStyle.mainContainer, leftContainerDiv);
   149         return frameset;
   127         mainContainer.addContent(rightContainerDiv);
       
   128         return mainContainer;
   150     }
   129     }
   151 
   130 
   152     /**
   131     /**
   153      * Add the FRAME tag for the frame that lists all packages.
   132      * Add the IFRAME tag for the frame that lists all packages.
   154      *
   133      *
   155      * @param contentTree the content tree to which the information will be added
   134      * @param contentTree the content tree to which the information will be added
   156      */
   135      */
   157     private void addAllPackagesFrameTag(Content contentTree) {
   136     private void addAllPackagesFrameTag(Content contentTree) {
   158         HtmlTree frame = HtmlTree.FRAME(DocPaths.OVERVIEW_FRAME.getPath(),
   137         HtmlTree frame = HtmlTree.IFRAME(DocPaths.OVERVIEW_FRAME.getPath(),
   159                 "packageListFrame", configuration.getText("doclet.All_Packages"));
   138                 "packageListFrame", configuration.getText("doclet.All_Packages"));
   160         contentTree.addContent(frame);
   139         HtmlTree leftTop = HtmlTree.DIV(HtmlStyle.leftTop, frame);
       
   140         contentTree.addContent(leftTop);
   161     }
   141     }
   162 
   142 
   163     /**
   143     /**
   164      * Add the FRAME tag for the frame that lists all classes.
   144      * Add the IFRAME tag for the frame that lists all classes.
   165      *
   145      *
   166      * @param contentTree the content tree to which the information will be added
   146      * @param contentTree the content tree to which the information will be added
   167      */
   147      */
   168     private void addAllClassesFrameTag(Content contentTree) {
   148     private void addAllClassesFrameTag(Content contentTree) {
   169         HtmlTree frame = HtmlTree.FRAME(DocPaths.ALLCLASSES_FRAME.getPath(),
   149         HtmlTree frame = HtmlTree.IFRAME(DocPaths.ALLCLASSES_FRAME.getPath(),
   170                 "packageFrame", configuration.getText("doclet.All_classes_and_interfaces"));
   150                 "packageFrame", configuration.getText("doclet.All_classes_and_interfaces"));
   171         contentTree.addContent(frame);
   151         HtmlTree leftBottom = HtmlTree.DIV(HtmlStyle.leftBottom, frame);
       
   152         contentTree.addContent(leftBottom);
   172     }
   153     }
   173 
   154 
   174     /**
   155     /**
   175      * Add the FRAME tag for the frame that describes the class in detail.
   156      * Add the IFRAME tag for the frame that describes the class in detail.
   176      *
   157      *
   177      * @param contentTree the content tree to which the information will be added
   158      * @param contentTree the content tree to which the information will be added
   178      */
   159      */
   179     private void addClassFrameTag(Content contentTree) {
   160     private void addClassFrameTag(Content contentTree) {
   180         HtmlTree frame = HtmlTree.FRAME(configuration.topFile.getPath(), "classFrame",
   161         HtmlTree frame = HtmlTree.IFRAME(configuration.topFile.getPath(), "classFrame",
   181                 configuration.getText("doclet.Package_class_and_interface_descriptions"),
   162                 configuration.getText("doclet.Package_class_and_interface_descriptions"));
   182                 SCROLL_YES);
   163         frame.addStyle(HtmlStyle.rightIframe);
   183         contentTree.addContent(frame);
   164         contentTree.addContent(frame);
   184     }
   165     }
   185 }
   166 }