src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Table.java
changeset 50167 cc705c956798
parent 47861 4fab795915b6
child 51260 b7a307084247
equal deleted inserted replaced
50166:1d683e243d8d 50167:cc705c956798
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2018, 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
    70     private Set<String> tabs;
    70     private Set<String> tabs;
    71     private HtmlStyle activeTabStyle = HtmlStyle.activeTableTab;
    71     private HtmlStyle activeTabStyle = HtmlStyle.activeTableTab;
    72     private HtmlStyle tabStyle = HtmlStyle.tableTab;
    72     private HtmlStyle tabStyle = HtmlStyle.tableTab;
    73     private HtmlStyle tabEnd = HtmlStyle.tabEnd;
    73     private HtmlStyle tabEnd = HtmlStyle.tabEnd;
    74     private IntFunction<String> tabScript;
    74     private IntFunction<String> tabScript;
    75     private String tabScriptVariable;
       
    76     private Function<Integer, String> tabId = (i -> "t" + i);
    75     private Function<Integer, String> tabId = (i -> "t" + i);
    77     private TableHeader header;
    76     private TableHeader header;
    78     private List<HtmlStyle> columnStyles;
    77     private List<HtmlStyle> columnStyles;
    79     private int rowScopeColumnIndex;
    78     private int rowScopeColumnIndex;
    80     private List<HtmlStyle> stripedStyles = Arrays.asList(HtmlStyle.altColor, HtmlStyle.rowColor);
    79     private List<HtmlStyle> stripedStyles = Arrays.asList(HtmlStyle.altColor, HtmlStyle.rowColor);
   177      * @param f the function
   176      * @param f the function
   178      * @return this object
   177      * @return this object
   179      */
   178      */
   180     public Table setTabScript(IntFunction<String> f) {
   179     public Table setTabScript(IntFunction<String> f) {
   181         tabScript = f;
   180         tabScript = f;
   182         return this;
       
   183     }
       
   184 
       
   185     /**
       
   186      * Sets the name of the JavaScript variable used to contain the data for each tab.
       
   187      *
       
   188      * @param name the name
       
   189      * @return this object
       
   190      */
       
   191     public Table setTabScriptVariable(String name) {
       
   192         tabScriptVariable = name;
       
   193         return this;
   181         return this;
   194     }
   182     }
   195 
   183 
   196     /**
   184     /**
   197      * Sets the name of the styles used to display the tabs.
   185      * Sets the name of the styles used to display the tabs.
   535             throw new IllegalStateException();
   523             throw new IllegalStateException();
   536 
   524 
   537         StringBuilder sb = new StringBuilder();
   525         StringBuilder sb = new StringBuilder();
   538 
   526 
   539         // Add the variable defining the bitmask for each row
   527         // Add the variable defining the bitmask for each row
   540         sb.append("var ").append(tabScriptVariable).append(" = {");
   528         sb.append("var data").append(" = {");
   541         int rowIndex = 0;
   529         int rowIndex = 0;
   542         for (int mask : bodyRowMasks) {
   530         for (int mask : bodyRowMasks) {
   543             if (rowIndex > 0) {
   531             if (rowIndex > 0) {
   544                 sb.append(",");
   532                 sb.append(",");
   545             }
   533             }