< prev index next >

test/langtools/jdk/javadoc/doclet/testFramesNoFrames/TestFramesNoFrames.java

Print this page




 284             checkFiles(!frames,
 285                     "allclasses.html");
 286 
 287             if (frames) {
 288                 checkOutput("allclasses-frame.html", true,
 289                         classes.stream()
 290                             .map(c -> "title=\"class in " + packagePart(c) + "\" target=\"classFrame\">" + classPart(c) + "</a>")
 291                             .toArray(String[]::new));
 292                 checkOutput("allclasses-noframe.html", false,
 293                             "target=\"classFrame\">");
 294             } else {
 295                 checkOutput("allclasses.html", false,
 296                             "target=\"classFrame\">");
 297 
 298             }
 299         }
 300 
 301         private void checkFrameFiles() {
 302             // these files are all only generated in frames mode
 303 
 304             // <module>-frame.html and <module>-type-frame.html files
 305             checkFiles(frames, classes.stream()
 306                 .filter(c -> isInModule(c))
 307                 .map(c -> modulePart(c))
 308                 .flatMap(m -> Arrays.asList(
 309                         m + "-frame.html",
 310                         m + "-type-frame.html").stream())
 311                 .collect(Collectors.toSet()));
 312 
 313             // <package>/package-frame.html files
 314             checkFiles(frames, classes.stream()
 315                     .map(c -> packagePart(c) + "/package-frame.html")
 316                     .collect(Collectors.toSet()));
 317         }
 318 
 319         private void checkHelpDoc() {
 320             // the Help page only describes Frame/NoFrames in frames mode
 321             checkOutput("help-doc.html", frames,
 322                         "<h2>Frames/No Frames</h2>");
 323         }
 324 
 325         private void checkIndex() {
 326             // the index.html page only contains frames and Javascript to default to no-frames view,
 327             // in frames mode
 328             checkOutput("index.html", frames,
 329                     "<iframe ",
 330                     "</iframe>",
 331                     "<body onload=\"loadFrames()\">\n"
 332                     + "<script type=\"text/javascript\">\n"
 333                     + "if (targetPage == \"\" || targetPage == \"undefined\")");
 334 
 335             // the index.html contains the overview if one


 343                     "<table class=\"overviewSummary\"");
 344 
 345             // the index.html file contains a redirect if
 346             // no frames and no overview
 347             checkOutput("index.html", !frames && !overview,
 348                     "<meta http-equiv=\"Refresh\" content=\"0;",
 349                     "<script type=\"text/javascript\">window.location.replace(");
 350 
 351             // the index.html file <meta> refresh should only use <noscript> in HTML 5
 352             if (!frames && !overview) {
 353                 checkOutput("index.html", hKind == HtmlKind.HTML5,
 354                         "<noscript>\n<meta http-equiv=\"Refresh\" content=\"0;");
 355             }
 356         }
 357 
 358         private void checkNavBar() {
 359             // the files containing a navigation bar should only
 360             // contain FRAMES/NO-FRAMES links in frames mode
 361             List<String> navbarFiles = new ArrayList<>();
 362             navbarFiles.addAll(classes.stream()
 363                     .map(c -> toHtml(packageClassPart(c)))
 364                     .collect(Collectors.toSet()));
 365             for (String f : navbarFiles) {
 366                 checkOutput(f, frames,
 367                         "target=\"_top\">Frames</a>",
 368                         "target=\"_top\">No&nbsp;Frames</a>");
 369             }
 370         }
 371 
 372         private void checkOverviewSummary() {
 373             // the overview-summary.html file only appears if
 374             // in frames mode and (overview requested or multiple packages)
 375             checkFiles(frames && overview,
 376                     "overview-summary.html");
 377         }
 378 
 379         private long getPackageCount() {
 380             return this.classes.stream()
 381                 .filter(name -> name.contains("."))
 382                 .map(name -> name.substring(0, name.lastIndexOf(".")))
 383                 .distinct()




 284             checkFiles(!frames,
 285                     "allclasses.html");
 286 
 287             if (frames) {
 288                 checkOutput("allclasses-frame.html", true,
 289                         classes.stream()
 290                             .map(c -> "title=\"class in " + packagePart(c) + "\" target=\"classFrame\">" + classPart(c) + "</a>")
 291                             .toArray(String[]::new));
 292                 checkOutput("allclasses-noframe.html", false,
 293                             "target=\"classFrame\">");
 294             } else {
 295                 checkOutput("allclasses.html", false,
 296                             "target=\"classFrame\">");
 297 
 298             }
 299         }
 300 
 301         private void checkFrameFiles() {
 302             // these files are all only generated in frames mode
 303 
 304             // <module>/module-frame.html and <module>/module-type-frame.html files
 305             checkFiles(frames, classes.stream()
 306                 .filter(c -> isInModule(c))
 307                 .map(c -> modulePart(c))
 308                 .flatMap(m -> Arrays.asList(
 309                         m + "/module-frame.html",
 310                         m + "/module-type-frame.html").stream())
 311                 .collect(Collectors.toSet()));
 312 
 313             // <package>/package-frame.html files
 314             checkFiles(frames, classes.stream()
 315                     .map(c -> (isInModule(c) ? (modulePart(c) + "/") : "") + packagePart(c) + "/package-frame.html")
 316                     .collect(Collectors.toSet()));
 317         }
 318 
 319         private void checkHelpDoc() {
 320             // the Help page only describes Frame/NoFrames in frames mode
 321             checkOutput("help-doc.html", frames,
 322                         "<h2>Frames/No Frames</h2>");
 323         }
 324 
 325         private void checkIndex() {
 326             // the index.html page only contains frames and Javascript to default to no-frames view,
 327             // in frames mode
 328             checkOutput("index.html", frames,
 329                     "<iframe ",
 330                     "</iframe>",
 331                     "<body onload=\"loadFrames()\">\n"
 332                     + "<script type=\"text/javascript\">\n"
 333                     + "if (targetPage == \"\" || targetPage == \"undefined\")");
 334 
 335             // the index.html contains the overview if one


 343                     "<table class=\"overviewSummary\"");
 344 
 345             // the index.html file contains a redirect if
 346             // no frames and no overview
 347             checkOutput("index.html", !frames && !overview,
 348                     "<meta http-equiv=\"Refresh\" content=\"0;",
 349                     "<script type=\"text/javascript\">window.location.replace(");
 350 
 351             // the index.html file <meta> refresh should only use <noscript> in HTML 5
 352             if (!frames && !overview) {
 353                 checkOutput("index.html", hKind == HtmlKind.HTML5,
 354                         "<noscript>\n<meta http-equiv=\"Refresh\" content=\"0;");
 355             }
 356         }
 357 
 358         private void checkNavBar() {
 359             // the files containing a navigation bar should only
 360             // contain FRAMES/NO-FRAMES links in frames mode
 361             List<String> navbarFiles = new ArrayList<>();
 362             navbarFiles.addAll(classes.stream()
 363                     .map(c -> (isInModule(c) ? (modulePart(c) + "/") : "") + toHtml(packageClassPart(c)))
 364                     .collect(Collectors.toSet()));
 365             for (String f : navbarFiles) {
 366                 checkOutput(f, frames,
 367                         "target=\"_top\">Frames</a>",
 368                         "target=\"_top\">No&nbsp;Frames</a>");
 369             }
 370         }
 371 
 372         private void checkOverviewSummary() {
 373             // the overview-summary.html file only appears if
 374             // in frames mode and (overview requested or multiple packages)
 375             checkFiles(frames && overview,
 376                     "overview-summary.html");
 377         }
 378 
 379         private long getPackageCount() {
 380             return this.classes.stream()
 381                 .filter(name -> name.contains("."))
 382                 .map(name -> name.substring(0, name.lastIndexOf(".")))
 383                 .distinct()


< prev index next >