mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8203792: Remove "compatibility" features from Head.java
Reviewed-by: jjg, sundar
This commit is contained in:
parent
bc62b3a40e
commit
f1173ad06c
4 changed files with 102 additions and 28 deletions
|
@ -131,7 +131,7 @@ public class FrameOutputWriter extends HtmlDocletWriter {
|
|||
DocType htmlDocType = DocType.forVersion(configuration.htmlVersion);
|
||||
Content htmlComment = contents.newPage;
|
||||
Head head = new Head(path, configuration.htmlVersion, configuration.docletVersion)
|
||||
.setTimestamp(!configuration.notimestamp, false)
|
||||
.setTimestamp(!configuration.notimestamp)
|
||||
.setTitle(title)
|
||||
.setCharset(configuration.charset)
|
||||
.setStylesheets(configuration.getMainStylesheet(), configuration.getAdditionalStylesheets())
|
||||
|
|
|
@ -75,7 +75,7 @@ public class IndexRedirectWriter extends HtmlDocletWriter {
|
|||
DocType htmlDocType = DocType.forVersion(configuration.htmlVersion);
|
||||
Content htmlComment = contents.newPage;
|
||||
Head head = new Head(path, configuration.htmlVersion, configuration.docletVersion)
|
||||
.setTimestamp(true, false)
|
||||
.setTimestamp(true)
|
||||
.addDefaultScript(false);
|
||||
|
||||
String title = (configuration.windowtitle.length() > 0)
|
||||
|
|
|
@ -58,8 +58,6 @@ public class Head {
|
|||
private String charset;
|
||||
private final List<String> keywords;
|
||||
private boolean showTimestamp;
|
||||
private boolean showGeneratedBy; // temporary: for compatibility
|
||||
private boolean showMetaCreated; // temporary: for compatibility
|
||||
private boolean useModuleDirectories;
|
||||
private DocFile mainStylesheetFile;
|
||||
private List<DocFile> additionalStylesheetFiles = Collections.emptyList();
|
||||
|
@ -140,26 +138,6 @@ public class Head {
|
|||
// no 'Generated by javadoc' comment will be added.
|
||||
public Head setTimestamp(boolean timestamp) {
|
||||
showTimestamp = timestamp;
|
||||
showGeneratedBy = true;
|
||||
showMetaCreated = timestamp;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether or not timestamps should be recorded in the HEAD element.
|
||||
* The timestamp will be recorded in a comment, and possibly in an appropriate META
|
||||
* element, depending on the HTML version specified when this object was created.
|
||||
*
|
||||
* @param timestamp true if timestamps should be be added.
|
||||
* @param metaCreated true if a META element should be added containing the timestamp
|
||||
* @return this object
|
||||
*/
|
||||
// This method is for temporary compatibility. In time, all clients should use
|
||||
// {@code setTimestamp(boolean)}.
|
||||
public Head setTimestamp(boolean timestamp, boolean metaCreated) {
|
||||
showTimestamp = timestamp;
|
||||
showGeneratedBy = true;
|
||||
showMetaCreated = metaCreated;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -258,16 +236,14 @@ public class Head {
|
|||
Date now = showTimestamp ? calendar.getTime() : null;
|
||||
|
||||
HtmlTree tree = new HtmlTree(HtmlTag.HEAD);
|
||||
if (showGeneratedBy) {
|
||||
tree.addContent(getGeneratedBy(showTimestamp, now));
|
||||
}
|
||||
tree.addContent(getGeneratedBy(showTimestamp, now));
|
||||
tree.addContent(HtmlTree.TITLE(title));
|
||||
|
||||
if (charset != null) { // compatibility; should this be allowed?
|
||||
tree.addContent(HtmlTree.META("Content-Type", "text/html", charset));
|
||||
}
|
||||
|
||||
if (showMetaCreated) {
|
||||
if (showTimestamp) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
tree.addContent(HtmlTree.META(
|
||||
(htmlVersion == HtmlVersion.HTML5) ? "dc.created" : "date",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue