27
27
28
28
import com .sun .source .doctree .DeprecatedTree ;
29
29
import java .util .List ;
30
+ import java .util .ListIterator ;
30
31
31
32
import javax .lang .model .element .Element ;
33
+
34
+ import jdk .javadoc .internal .doclets .formats .html .markup .HtmlStyle ;
32
35
import jdk .javadoc .internal .doclets .formats .html .markup .HtmlTree ;
33
36
import jdk .javadoc .internal .doclets .formats .html .Navigation .PageMode ;
34
37
import jdk .javadoc .internal .doclets .toolkit .Content ;
45
48
* If you write code that depends on this, you do so at your own risk.
46
49
* This code and its internal interfaces are subject to change or
47
50
* deletion without notice.</b>
48
- *
49
- * @see java.util.List
50
51
*/
51
52
public class DeprecatedListWriter extends SummaryListWriter <DeprecatedAPIListBuilder > {
52
53
54
+ private final static String TERMINALLY_DEPRECATED_KEY = "doclet.Terminally_Deprecated_Elements" ;
55
+
53
56
/**
54
57
* Constructor.
55
58
*
56
59
* @param configuration the configuration for this doclet
57
60
* @param filename the file to be generated
58
61
*/
59
-
60
62
public DeprecatedListWriter (HtmlConfiguration configuration , DocPath filename ) {
61
63
super (configuration , filename , PageMode .DEPRECATED , "deprecated elements" ,
62
64
configuration .contents .deprecatedAPI , "doclet.Window_Deprecated_List" );
@@ -80,17 +82,22 @@ public static void generate(HtmlConfiguration configuration) throws DocFileIOExc
80
82
81
83
@ Override
82
84
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
+ }
83
89
addSummaryAPI (list .getForRemoval (), HtmlIds .FOR_REMOVAL ,
84
- "doclet.For_Removal" , "doclet.Element" , content );
90
+ TERMINALLY_DEPRECATED_KEY , "doclet.Element" , content );
85
91
}
86
92
87
93
@ Override
88
94
protected void addExtraIndexLink (DeprecatedAPIListBuilder list , Content target ) {
89
95
if (!list .getForRemoval ().isEmpty ()) {
90
- addIndexLink (HtmlIds .FOR_REMOVAL , "doclet.For_Removal " , target );
96
+ addIndexLink (HtmlIds .FOR_REMOVAL , "doclet.Terminally_Deprecated " , target );
91
97
}
92
98
}
93
99
100
+ @ Override
94
101
protected void addComments (Element e , Content desc ) {
95
102
List <? extends DeprecatedTree > tags = utils .getDeprecatedTrees (e );
96
103
if (!tags .isEmpty ()) {
@@ -100,4 +107,28 @@ protected void addComments(Element e, Content desc) {
100
107
}
101
108
}
102
109
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
+ }
103
134
}
0 commit comments