RFR: JDK-8295088: Update External Spec page to show tabs for hosts

Andrey Turbanov aturbanov at openjdk.org
Tue Oct 11 07:51:52 UTC 2022


On Mon, 10 Oct 2022 19:03:21 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

> Please review a medium but interesting fix to display tabs on the `External Specifications` page to indicate the host name for the spec.
> 
> The underlying "fun" part is to update `Table` to be `Table<T>`, where `T` is the type parameter for the predicates used to classify each row to determine the tabs when it will be displayed.
> 
> The changes to `Table` are relatively simple, but there is a downstream cost to update all the existing use sites to avoid introducing any raw types (i.e. because `Table` now takes a type parameter).   While it would have been simple to just change existing uses from `Table` to `Table<Element>`, the changes are done more appropriately. In particular, if a table does not use tabs at all, the type parameter can be `Void`, and in other situations, the type parameter can be a subtype of `Element`, such as `ModuleElement`, `PackageElement` or `TypeElement`.
> 
> With `Table` updated to be `Table<T>`, the table in `ExternalSpecsWriter` can be `Table<URI>` with table-tab predicates examining the host name for the URL.
> 
> Eventually, it might be good to do a further upgrade to use a horizontal list of checkboxes instead of table tabs, for the potentially open-ended set of host names, but this will require an update to the JavaScript we use for checkboxes, which seems out of scope for the work presented here.   I note that in demo JDK docs, there are only about half-a-dozen spec hosts, so table tabs are a reasonable compromise for now.

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java line 87:

> 85:         if (!groupModuleMap.keySet().isEmpty()) {
> 86:             TableHeader tableHeader = new TableHeader(contents.moduleLabel, contents.descriptionLabel);
> 87:             var table =  new Table<ModuleElement>(HtmlStyle.summaryTable)

let's remove one redundant space
Suggestion:

            var table = new Table<ModuleElement>(HtmlStyle.summaryTable)

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java line 88:

> 86: 
> 87:         if (!groupPackageMap.keySet().isEmpty()) {
> 88:             var table =  new Table<PackageElement>(HtmlStyle.summaryTable)

Let's remove one redundant space
Suggestion:

            var table = new Table<PackageElement>(HtmlStyle.summaryTable)

-------------

PR: https://git.openjdk.org/jdk/pull/10636


More information about the javadoc-dev mailing list