2727
2828import com .sun .source .doctree .DeprecatedTree ;
2929import java .util .List ;
30+ import java .util .ListIterator ;
3031
3132import javax .lang .model .element .Element ;
33+
34+ import jdk .javadoc .internal .doclets .formats .html .markup .HtmlStyle ;
3235import jdk .javadoc .internal .doclets .formats .html .markup .HtmlTree ;
3336import jdk .javadoc .internal .doclets .formats .html .Navigation .PageMode ;
3437import jdk .javadoc .internal .doclets .toolkit .Content ;
4548 * If you write code that depends on this, you do so at your own risk.
4649 * This code and its internal interfaces are subject to change or
4750 * deletion without notice.</b>
48- *
49- * @see java.util.List
5051 */
5152public class DeprecatedListWriter extends SummaryListWriter <DeprecatedAPIListBuilder > {
5253
54+ private final static String TERMINALLY_DEPRECATED_KEY = "doclet.Terminally_Deprecated_Elements" ;
55+
5356 /**
5457 * Constructor.
5558 *
5659 * @param configuration the configuration for this doclet
5760 * @param filename the file to be generated
5861 */
59-
6062 public DeprecatedListWriter (HtmlConfiguration configuration , DocPath filename ) {
6163 super (configuration , filename , PageMode .DEPRECATED , "deprecated elements" ,
6264 configuration .contents .deprecatedAPI , "doclet.Window_Deprecated_List" );
@@ -80,17 +82,22 @@ public static void generate(HtmlConfiguration configuration) throws DocFileIOExc
8082
8183 @ Override
8284 protected void addExtraSection (DeprecatedAPIListBuilder list , Content content ) {
85+ if (list .releases .size () > 1 ) {
86+ content .add (HtmlTree .SPAN (contents .getContent ("doclet.Deprecated_Tabs_Intro" ))
87+ .addStyle (HtmlStyle .helpNote ));
88+ }
8389 addSummaryAPI (list .getForRemoval (), HtmlIds .FOR_REMOVAL ,
84- "doclet.For_Removal" , "doclet.Element" , content );
90+ TERMINALLY_DEPRECATED_KEY , "doclet.Element" , content );
8591 }
8692
8793 @ Override
8894 protected void addExtraIndexLink (DeprecatedAPIListBuilder list , Content target ) {
8995 if (!list .getForRemoval ().isEmpty ()) {
90- addIndexLink (HtmlIds .FOR_REMOVAL , "doclet.For_Removal " , target );
96+ addIndexLink (HtmlIds .FOR_REMOVAL , "doclet.Terminally_Deprecated " , target );
9197 }
9298 }
9399
100+ @ Override
94101 protected void addComments (Element e , Content desc ) {
95102 List <? extends DeprecatedTree > tags = utils .getDeprecatedTrees (e );
96103 if (!tags .isEmpty ()) {
@@ -100,4 +107,28 @@ protected void addComments(Element e, Content desc) {
100107 }
101108 }
102109
110+ @ Override
111+ protected void addTableTabs (Table table , String headingKey ) {
112+ List <String > releases = configuration .deprecatedAPIListBuilder .releases ;
113+ if (!releases .isEmpty ()) {
114+ table .setDefaultTab (getTableCaption (headingKey )).setAlwaysShowDefaultTab (true );
115+ ListIterator <String > it = releases .listIterator (releases .size ());
116+ while (it .hasPrevious ()) {
117+ String release = it .previous ();
118+ Content tab = TERMINALLY_DEPRECATED_KEY .equals (headingKey )
119+ ? contents .getContent ("doclet.Terminally_Deprecated_In_Release" , release )
120+ : contents .getContent ("doclet.Deprecated_In_Release" , release );
121+ table .addTab (tab ,
122+ element -> release .equals (utils .getDeprecatedSince (element )));
123+ }
124+ getMainBodyScript ().append (table .getScript ());
125+ }
126+ }
127+
128+ @ Override
129+ protected Content getTableCaption (String headingKey ) {
130+ Content caption = contents .getContent (headingKey );
131+ return TERMINALLY_DEPRECATED_KEY .equals (headingKey )
132+ ? caption : contents .getContent ("doclet.Deprecated_Elements" , caption );
133+ }
103134}
0 commit comments