Package Torello.JavaDoc
Class Upgrade
- java.lang.Object
-
- Torello.JavaDoc.Upgrade
-
public class Upgrade extends java.lang.Object
The primary builder and configuration class for the Java Doc Upgrade Process, having many customizations that may be requested using the customize-settings methods available here.
This is the class that 'Upgrades' the standard Java Doc'.html'
pages into the form that you are reading right now.Currently, This App Only Upgrades Java 11 Java-Doc HTML, and Earlier.
Building an Upgrader'JDVersion'
Configuration-Class will not be too much work (a few weeks, to a month). The pages you are currently reading right now were successfully upgraded from HTML Files generated by the Java-Doc Tool released with Java 11 (LTS).
What follows is an example where some of the initializer fields for this upgrader are actually used.
Example:
// An example use of a CIET/Type Canonical-Name Predicate to decide Which Classes/Types should // undergo have their FIELD's being HiLited (and which Types shouldn't show HiLited Fields) final Predicate<Object> dontHiLiteTheFields = StrFilter.strListREJECT_NOIOE ("Torello/Build/TXT/SkipAllFields.txt", false); new Upgrade ("javadoc/", "") .setLogFile ("log.html") .setFaviconFileFormat (Torello.HTML.Tools.Images.IF.JPG) .setEmbedTagsMapFile ("Torello/Build/global-external-html-ids.properties") .useHiLiteServerCache ("cache/") .setHiLiteAllFieldsFilter (dontHiLiteTheFields) .upgrade ();
Hi-Lited Source-Code:- View Here: Torello/JavaDoc/Upgrade.java
- Open New Browser-Tab: Torello/JavaDoc/Upgrade.java
File Size: 44,795 Bytes Line Count: 1,052 '\n' Characters Found
-
-
Field Summary
Fields Modifier and Type Field static String
FAVICON_FILE_NAME
static String
JAVA_SCRIPT_FILE_NAME
-
Constructor Summary
Constructors Constructor Description Upgrade(String rootJavaDocDirectory, String... rootSourceFileDirectories)
This returns a new instance of this class.
-
Method Summary
Start an Upgrade Process Modifier and Type Method static void
main(String[] argv)
Stats
upgrade()
Restrict the Upgrade-Process to only Upgrade these Explicitly Named Packages Modifier and Type Method Upgrade
setPackageList(Iterable<BuildPackage> packageList)
Upgrade
setPackageList(String... packageList)
Retrieve Copies of these Default-Files from the '.jar', as a java.lang.String Modifier and Type Method static CSSFiles
retrieveDefaultCSSFilesFromJAR()
static String
retrieveDefaultJSFileFromJAR()
SOME OF THE PRIMARY CONFIGURATIONS Modifier and Type Method Upgrade
setExtraTasks(Consumer<JavaDocHTMLFile> extraTasks)
Upgrade
setFaviconFileFormat(IF faviconFileFormat)
Upgrade
setVerbosityLevel(Verbosity verbosity)
Generate & Sort the JavaDoc Deprecated '-frame' Files Modifier and Type Method Upgrade
setGenerateFrames(boolean generateFrames)
Upgrade
setOverviewFrameSorter(String[] sectionNames, String[][] sectionContents)
Assign Alternate JavaDoc CSS File(s); Replace some or all Default CSS-File(s) Modifier and Type Method Upgrade
setCustomCSSFiles(CSSFiles cssFiles)
Set a Log-Appendable or Log-File for Backing-Up & Saving Upgrader Output-Text Modifier and Type Method Upgrade
setLogFile(Appendable logFile)
Upgrade
setLogFile(String logFileName)
Assign & Register a Global <EMBED>-Tag Map File (External-HTML '.properties' File) Modifier and Type Method Upgrade
setProjectGlobalEmbedTagsMap(ReadOnlyMap<String,String> tagIDMap)
Upgrade
setProjectGlobalEmbedTagsMapFile(String tagIDMapFileName)
Clean & Post-Process the Rows of all 'package-summary.html' File(s) Modifier and Type Method Upgrade
setPackageSummaryCleaner(Consumer<Vector<HTMLNode>> packageSummaryCleaner)
Upgrade
useDefaultPackageSummaryCleaner()
Change the Default Code-HiLiter Modifier and Type Method Upgrade
setHiLiter(HiLiter hiLiter)
Upgrade
useHiLiteServerCache(String hiLiteServerCacheDirectoryName)
Upgrade
useHiLiteServerCache(HiLiteMe.Cache cache)
Upgrade-Process Decision-Predicate's - ones that require a CIET/Type Name-String Predicate Modifier and Type Method Upgrade
setCSSTagsFilter(Predicate<? super String> cietCanonicalNameFilter)
Upgrade
setSummaryRemoveFilter(Predicate<? super String> cietCanonicalNameFilter)
Change Default Entity/Member Detail-HiLiting Decisions (with a Type-Name Predicate) Modifier and Type Method Upgrade
setHiLiteAllDetailsFilter(Entity entity, Predicate<? super String> cietCanonicalNameFilter)
Upgrade
setHiLiteSourceCodeFileFilter(Predicate<? super String> cietCanonicalNameFilter)
Request that Entity/Member Detail-Sections be Removed (with a Type-Name Predicate) Modifier and Type Method Upgrade
setRemoveAllDetailsFilter(Predicate<? super String> cietCanonicalNameFilter)
Upgrade
setRemoveAllDetailsFilter(Entity entity, Predicate<? super String> cietCanonicalNameFilter)
Turning off Torello.HTML.Balance Validity-Checking Modifier and Type Method Upgrade
setCheckBalance(boolean checkBalance)
Upgrade
setValidateHTMLFilter(Predicate<? super String> cietCanonicalNameFilter)
Change the Tabs-Policy for converting Tabs to Spaces during Code-HiLiting Modifier and Type Method Upgrade
setTabsPolicy(int spacesPerTab, boolean relativeOrAbsolute)
Add Extra HTML <META>-Tags (or other Tags) to the <HEAD> of all HTML-Files Modifier and Type Method Upgrade
addHeaderBlock(Vector<HTMLNode> headerStuff)
Upgrade
addHeaderTags(Iterable<TagNode> headerTags)
Request the Links-Checker be Run (for Checking Inter-Page <A HREF=...> Links/URL's) Modifier and Type Method Upgrade
runLinksChecker()
-
-
-
Field Detail
-
FAVICON_FILE_NAME
public static final java.lang.String FAVICON_FILE_NAME
The name of the favicon-file (without extension). This filename may not be changed.- See Also:
- Constant Field Values
-
JAVA_SCRIPT_FILE_NAME
public static final java.lang.String JAVA_SCRIPT_FILE_NAME
The name of the (very brief)'.js'
file.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Upgrade
public Upgrade(java.lang.String rootJavaDocDirectory, java.lang.String... rootSourceFileDirectories)
This returns a new instance of this class. It will have all empty and null settings, except the root-directory descriptors. It must be initialized with the various builder methods.
This constructor must tell the Upgrader (Builder) which directory contains'.java'
Source-Files, and which directory shall contain Java-Doc Generated HTML Documentation Pages.- Parameters:
rootJavaDocDirectory
- This is the output directory that was used for the last call to the JavaDoc Utility. The Upgrade Logic should expect to find all class, interface and enumerated types to be hilited in this directory. This parameter may not be null.rootSourceFileDirectories
- This is the location where the'.java'
source files for the classes, interfaces and enumerated types named by your list files are stored. This parameter may not be null; at least one directory must be passed. If you have multiple source-code directories, then pass all of them, and whenever a JavaDoc'.html'
file is loaded from disk, all source-code directories will be searched until the source-code is found.- Throws:
UpgradeException
- This exception will throw if either of these directories cannot be found, or may not be accessed. The'getCause()'
method of the exception will provide more details of the specific error that occurred.
-
-
Method Detail
-
upgrade
public Stats upgrade()
START THE UPGRADE, HERE
After all parameters have been set with this configuration-builder class (Upgrade
) ... this method needs to be invoked to start the processing. This runs the upgrader for all Java Doc generated'.html'
Files.
The log-file that may be set with this class is where printed character data is later stored / saved so that it may be reviewed after this upgrade completes. The printed data is minimal, unless'Verbose Mode'
has been requested.- Returns:
- This returns the statistics computed for the upgrade process. See class
Stats
for more information. A complete listing of the information contained by the tables in a'Stats'
instance may be viewed by clicking the'Stats'
link at the top-right of this page.
If the Upgrade-Process had unrecoverable errors, null is returned.
-
main
public static void main(java.lang.String[] argv) throws java.lang.Exception
Command Line Operation
The first and second Command Line Argument's are as belowargv[0]:
(REQUIRED) The output java-doc directoryargv[1]:
(OPTIONAL) TheHiLiteMe
Cache Directory
Running 'javadoc' First:
The actual'javadoc'
Utility, itself (the one provided by Oracle), must first be invoked on the source-code that is to be hilited before the Upgrade-Tool can be used!
Example:
While looking for a good Java-Based Spell-Checker, this package came up. After downloading the source-code, the commands were able to generate an "Upgraded Java-Doc" experience.
The first line below will run the Standard'javadoc'
Utility, and leave the contents in directory "~/javadoc/". The second command will "Upgrade" the pages that were just generated - inserting Code-HiLiting, adding CSS-Names (for a better CSS Look-And-Feel), and (of course) adding a favicon.
UNIX or DOS Shell Command:
cloudshell:~$ cloudshell:~$ javadoc com.inet.jortho com.inet.jorthodictionaries -d javadoc -docfilessubdirs -linksource -docencoding "UTF-8" -charset "UTF-8" --frames --allow-script-in-comments -sourcetab 4 cloudshell:~$ java Torello.JavaDoc.Upgrade javadoc/ jdcache/- Parameters:
argv
- This is the argument received from the command line.- Throws:
java.lang.Exception
-
setRemoveAllDetailsFilter
public Upgrade setRemoveAllDetailsFilter (java.util.function.Predicate<? super java.lang.String> cietCanonicalNameFilter)
Write an explanation
-
setRemoveAllDetailsFilter
public Upgrade setRemoveAllDetailsFilter (Entity entity, java.util.function.Predicate<? super java.lang.String> cietCanonicalNameFilter)
Requests that the entire HTML Details-Section for a particular Entity/Member Kind (for instance: Method's, Field's or Constructor's etc...) be removed in entirety.
There are Java Doc pages that, on occasion, might be more readable without extensive detail information. If this filter returns TRUE for any class, interface, enum, annotation or record (CIET) - all 'Details
' for that entity are removed.
By default this filter-predicate is inactive. It can be used to remvoe all details sections present on a Java Doc page.
Use in Java-HTML:
In the Java HTML JAR library, most of the search classes inside the packageTorello.HTML.NodeSearch
package do not contain any details sections. The methods are very repetitive, and generally resemble the types of functions that assembly languages offer.
Since a detailed description of those methods (and particularly all of their parameters) is offered at the top of those classes, a redundant-looking detail section is elmininated by using this very Filter-Predicate.- Parameters:
entity
- Specifies which HTML Detail-Section to remove.cietCanonicalNameFilter
- The file-name filter. ThisPredicate
needs to accept or reject the fully qualified name of aClass, Interface,
orEnum
.
It is usually very easy to provide a list of Canonical Type-Names - A Class-Name that includes the Package-Name and even any Container-Classes in which it resides - to aStrFilter
method. There are many "Accept" and "Reject" methods in that class which would take a list of CIET/Type Names.
-
setHiLiteAllDetailsFilter
public Upgrade setHiLiteAllDetailsFilter (Entity entity, java.util.function.Predicate<? super java.lang.String> cietCanonicalNameFilter)
Requests that all HTML Details be HiLited for a particular Entity/Member Kind (for instance: Method's, Field's or Constructor's etc...)
Default Settings:Entity Default Setting Method Bodies HiLited Field Declarations HiLited Constructor Bodies Not HiLited Enum-Constant Declarations Not HiLited Annotation Element Definitions HiLited
The filter-parameter ('cietCanonicalNameFilter'
) that needs to be passed here is just a JavaPredicate<String>
. ThisPredicate
receives the Fully-Qualified (Canonical) Class-Name of a Java CIET/Type (Class, Interface, Enumerated-Type etc...).'test(String)'
method will receive the fully-qualified name of a JavaClass, Interface,
orEnum
(CIET) whose source-code documentation-file is being Code-HiLited.
ThePredicate
should returnTRUE
if you would like to see the Detail-Source HiLited, andFALSE
if the Upgrader should skip hiliting the source for this CIET.
Using a StrFilter:
If you keep a short'.txt'
file that just lists the classes you do or do not want hilited, you may load that'.txt'
file into a JavaPredicate
using either:
TheHiLite Method Body
procedure is the one which creates segments on your Java Doc Pages that look like:
TheHiLite Field Declaration
procedure is the one which creates segments on your Java Doc Pages that look like:
- Parameters:
cietCanonicalNameFilter
- The file-name filter. ThisPredicate
needs to accept or reject the fully qualified name of aClass, Interface,
orEnum
.
It is usually very easy to provide a list of Canonical Type-Names - A Class-Name that includes the Package-Name and even any Container-Classes in which it resides - to aStrFilter
method. There are many "Accept" and "Reject" methods in that class which would take a list of CIET/Type Names.
-
setSummaryRemoveFilter
public Upgrade setSummaryRemoveFilter (java.util.function.Predicate<? super java.lang.String> cietCanonicalNameFilter)
This filter decides which Java-Doc Web-Pages will have their "Summary Descriptions" removed from the summary tables at the top of a JavaDoc generated web-page. By default this field is null, and when it is - all Java-Doc Pages will have their respective textual, abbreviated "Summary Descriptions" removed from the summary tables which are located at the top of the web-page.
The filter-parameter ('cietNameFilter'
) that needs to be passed here is just a JavaPredicate<String>
. ThisPredicate's 'test(String)'
method will receive the fully-qualified name of a JavaClass, Interface,
orEnum
(CIET) whose source-code documentation-file is being modified.
ThePredicate
should returnTRUE
if you would like to avoid removing theField
andMethod
Summary Text from theField Summaries
andMethod Summaries
for a particular CIET.
Default Setting:
The default configuration for this process is that this Upgrade Tool will remove the summary text for all Java-Doc'.html'
Pages!.
Generally, the English-Language (or any written, human language) HTML description in a Java Doc Comment looks reasonably nice in the details portion of Java-Doc Page. If you can remember that the Summary-Section imports the first sentence of the Description-Portion of a Detail-Section, it is possible to make the Summary-Sentences look all right.
However, when this is neglected, for just about anything but the most trivial of comments explanations, the JavaDoc Logic will not produce a nice enough looking'Summary Description'
to be useable. Therefore, the signature, by itself, is often sufficient.
Using a StrFilter:
If you keep a short'.txt'
file that just lists the classes you do or do not want hilited, you may load that'.txt'
file into a JavaPredicate
using either:
Cleaned Summaries look as in the picture below:
- Parameters:
cietCanonicalNameFilter
- The file-name filter. ThisPredicate
needs to accept or reject the fully qualified name of aClass, Interface,
orEnum
.
It is usually very easy to provide a list of Canonical Type-Names - A Class-Name that includes the Package-Name and even any Container-Classes in which it resides - to aStrFilter
method. There are many "Accept" and "Reject" methods in that class which would take a list of CIET/Type Names.
-
setHiLiteSourceCodeFileFilter
public Upgrade setHiLiteSourceCodeFileFilter (java.util.function.Predicate<? super java.lang.String> cietCanonicalNameFilter)
This filter decides which Java-Doc Web-Pages will get an HTML Anchor Link'<A HREF=...>'
that contains a local URL with an'.html' file
of the'.java'
Source-Code for the Java-Doc Page being updated. By default this field is null, and when it is - all Java-Doc Pages will have their respective source-code files hilited, and will have links such links placed on their their pages.
The filter-parameter ('cietNameFilter'
) that needs to be passed here is just a JavaPredicate<String>
. ThisPredicate's 'test(String)'
method will receive the fully-qualified name of a JavaClass, Interface,
orEnum
(CIET) whose source-code documentation-file is being Code-HiLited.
ThePredicate
should returnTRUE
if you would like to see the original Java Source-Code ('.java'
file) HiLited, andFALSE
if the Upgrader should skip the CIET.
Using a StrFilter:
If you keep a short'.txt'
file that just lists the classes you do or do not want hilited, you may load that'.txt'
file into a JavaPredicate
using either:
TheHiLited Source Code File
procedure is the one which creates links on your Java Doc Pages that look like:
- Parameters:
cietCanonicalNameFilter
- The file-name filter. ThisPredicate
needs to accept or reject the fully qualified name of aClass, Interface,
orEnum
.
It is usually very easy to provide a list of Canonical Type-Names - A Class-Name that includes the Package-Name and even any Container-Classes in which it resides - to aStrFilter
method. There are many "Accept" and "Reject" methods in that class which would take a list of CIET/Type Names.
-
setCSSTagsFilter
public Upgrade setCSSTagsFilter (java.util.function.Predicate<? super java.lang.String> cietCanonicalNameFilter)
This filter decides which Java-Doc Web-Pages will have internal Java-Doc HTML Elements updated to contain a series ofCSS 'CLASS'
andCSS 'ID'
tags. These tags may then be used with an external CSS-StyleSheet, which makes the task of adding color, font, and border-designs to a Java-Doc Page a lot easier. By default, this field is null - and all pages will haveCSS Tags
inserted.
By default, this filter is set to 'Always On' - meaning all Java-Doc Web-Pages will have CSSID
andCLASS
Attributes inserted.
The filter-parameter ('cietNameFilter'
) that needs to be passed here is just a JavaPredicate<String>
. ThisPredicate's 'test(String)'
method will receive the fully-qualified name of a JavaClass, Interface,
orEnum
(CIET) whose source-code documentation-file is being Code-HiLited.
ThePredicate
should returnTRUE
if you would like to see CSS Tags inserted into the HTML, andFALSE
if the Upgrader should skip insertingCSS Tags
into this CIET.
Using a StrFilter:
If you keep a short'.txt'
file that just lists the classes you do or do not want hilited, you may load that'.txt'
file into a JavaPredicate
using either:
TheInsert CSS Tags
procedure is the one which createsCSS CLASS
attributes in your Java Doc Pages that look:
Default'.css'
File
The defaultCSS File
used by this upgrader may be viewed here:
Default CSS File- Parameters:
cietCanonicalNameFilter
- The file-name filter. ThisPredicate
needs to accept or reject the fully qualified name of aClass, Interface,
orEnum
.
It is usually very easy to provide a list of Canonical Type-Names - A Class-Name that includes the Package-Name and even any Container-Classes in which it resides - to aStrFilter
method. There are many "Accept" and "Reject" methods in that class which would take a list of CIET/Type Names.
-
setValidateHTMLFilter
public Upgrade setValidateHTMLFilter (java.util.function.Predicate<? super java.lang.String> cietCanonicalNameFilter)
This sets the HTML Validation Filter. This filter accepts the name of a class-file, and must returnTRUE
orFALSE
, depending upon whether he would like the HTML Validated for a particular Java Doc File.
ThePredicate<String>
passed to this field should either accept or reject a class-file, based on its class-name.
By default, all class-files are passed through the validating HTML processor.
This filter allows you to turn off HTML Validation for some or all of the Class-Files in your Upgrade. HTML Validation can be an invaluable resources when debugging and fixing your Documentation; however there might be situations where less-than-valid HTML is needed. For instance, some packages have developers who refuse to close their<LI>
elements, or perhaps their<TD>'s
Note that there is also a "Check Balance" flag that can be set with thisUpgrade
Configuration-Class. When this flag is set toFALSE
its value 'takes precedence' over anything that is returned by thevalidateHTMLFilter
. To see this in action, view the example below:
Example:
Predicate<String> myClassesFilter = (String fullClassName) -> fullClassName.startsWith("org.company.tests") || fullClassName.startsWith("com.consulting.optimizer"); new Upgrade("javadoc", "src/main/java") .setCheckBalance(false) .setValidateHTMLFilter(myClassesFilter) ... .upgrade()
Configuration Precedence:
Because there is a call to the Configuration-MethodsetCheckBalance(false)
, the subsequent call tosetValidateHTMLFilter
is no different than a "No Op". This configuration will simply have no effect on the final processing.
The Check-Balance setting supersedes the results of this Filter-Predicate, and when it isfalse
, thisPredicate
is effectively ignored.<EMBED>
-Tag HTML Files:
The results of thisPredicate
do not affect the validation of Externally-Linked<EMBED CLASS='external-html'>
files. If you would like to avoid validating those files, you must request that the Check-Balance Flag be set toFALSE
.
All external-html files (imported with theEMBED
-tag) are checked for valid HTML before the Upgrade Process even starts.- Parameters:
cietCanonicalNameFilter
- The file-name filter. ThisPredicate
needs to accept or reject the fully qualified name of aClass, Interface,
orEnum
.
It is usually very easy to provide a list of Canonical Type-Names - A Class-Name that includes the Package-Name and even any Container-Classes in which it resides - to aStrFilter
method. There are many "Accept" and "Reject" methods in that class which would take a list of CIET/Type Names.
-
setVerbosityLevel
public Upgrade setVerbosityLevel(Verbosity verbosity)
Accepts an instance ofVerbosity
. This configures the output-text behavior of the Upgrade-Tool once processing begins.
The table below should delineate the different output behaviors which may be selected using this Configuration Method.Verbosity-Setting Upgrade Processing Text Output Silent
All Error Output is still printed to the terminal. A single period '.'
is emitted at the beginning of processing a new Java Package.Quiet
All Error Output is still printed to the terminal. Messaging is greatly abbreviated, as most notices are reduced a single period '.'
character.Normal
Normal, textual operations. Verbose
Extra amounts of notices are appended after processing each Java-Doc HTML File. - Parameters:
verbosity
- One of the four availableVerbosity
constants.
-
setLogFile
public Upgrade setLogFile(java.lang.Appendable logFile)
When the Upgrader outputs text to Terminal, that text may be stored into an internal buffer. That buffer's information will be duplicated to theAppendable
instance provided to this method.
Essentially, Log information may be sent and saved anywhere, using this parameter. As text output is sent the internalMessager
instance, this instance ofAppendable
may be used to duplicate that output so that log data is saved to a file (or any mechanism, of your chossing)) for reviewing the output at a later time.
In normal mode, the upgrader produces a reasonable amount of text-output; however, in verbose-mode quite a bit of text is sent to the terminal.- Parameters:
logFile
- AnAppendable
to be used for backing-up / saving Log-Writes.
-
setLogFile
public Upgrade setLogFile(java.lang.String logFileName)
When the Upgrader outputs text to Terminal, that text may be stored into an internal buffer. That buffer's information will be duplicated and written to the Text-File specified by this method's input parameter.
As text output is sent the internalMessager
instance, this file will duplicate the output so that log data is saved to a file for reviewing the output at a later time.
In normal mode, the upgrader produces a reasonable amount of text-output; however, in verbose-mode quite a bit of text is sent to the terminal.- Parameters:
logFileName
- File-Name of a writeable File, to be used for backuping-up Log-Writes- Throws:
UpgradeException
- If the File provided cannot be written to.- See Also:
UpgradeException.checkFileIsWriteable(String, String, String)
-
setProjectGlobalEmbedTagsMapFile
public Upgrade setProjectGlobalEmbedTagsMapFile (java.lang.String tagIDMapFileName)
Sets aProject Global Embed Tag ID Map
using atext file
on your file-system.
You have the ability to insert HTML'<EMBED>'
tags into the comments of your source-files, because this Upgrader will replace those HTML elements with the HTML found in the file named by this map. See the image below as an example: Notice that all that has to be provided to the tag is a'DATA-FIILE-ID'
. This'ID'
is mapped to a file-systemtext-file
using this map.
File Contents:
This text-file should contain lines of text with"DATA-FILE-ID's"
and'.html'
File-Name's - each on a separate line.
Java-HTML JAR Example:
The'embedTagIDTable'
is a really simple 'Map' that translates an'<EMBED>'
element'sDATA-FILE-ID
to an'.html'
file-name (that you have written) on the file-system.
TheEmbed Tags Map File
used by this JAR-Library's Build Script may be viewed below, as an example. This is an exhaustive list of all Global, Externally-Linked, HTML Pages for theJava HTML
library.
Global Embed Tags Map File- Parameters:
tagIDMapFileName
- A Java'.properties'
File-Name mapping File-ID's to Files.- Throws:
UpgradeException
- If there are any problems that occur while loading the file
-
setProjectGlobalEmbedTagsMap
public Upgrade setProjectGlobalEmbedTagsMap (ReadOnlyMap<java.lang.String,java.lang.String> tagIDMap)
Sets theProject Global Embed Tag ID Map
using a Javajava.util.Map<tring, String>
. The firstGeneric String-Parameter
of the map is for a'DATA-FILE-ID'
, and the second is expected to hold'.html'
file-names.
This stores the map of TagID fields to their respective HTML-File File-Names on the file-system. It is used in combination with JavaDoc Source-Code HTML Tags that request "External-HTML" be inserted into a JavaDoc HTML Web-Page.
This field holds the "Project" Global Embed Tag ID's." This upgrader also provides a means of saving package-specific external HTML files inside the source-code directory used by any Java Package. For instance, for Package "Torello.HTML", Package-Local HTML files are saved in directoryTorello/HTML/upgrade-files/external-html/
. There is also a Package-Local ID==>FileName Map. That file should be saved in a file named'external-html-ids.properties'
, using a standard Java Properties file format.
This Upgrader feature allows programmers to write more detailed code documentation (comments) for their Java Classes while reducing the 'clutter' in the code. If a particular method or field needs a lot of commenting, simply type up an external'.html'
file (leave off the HTML<HEADER>, <BODY>
tags) Then, in your'java'
Source-Code File, insert an HTML<EMBED>
-Tag.
The Upgrader will automatically converts all HTML <EMBED>-Tags into the actual HTML that is inside the file listed in the external-documentation file you have created for it.
WhatEMBED
-Tags Look Like:<EMBED CLASS="external-html" DATA-FILE-ID="SOME_ID">
You have the ability to insert these tags into the comments of your source-files, because this Upgrader will replace those HTML elements with the HTML found in the file named by this map. See the image below as an example: Notice that all that has to be provided to the tag is a'DATA-FIILE-ID'
attribute. This'ID'
is mapped to a file-systemtext-file
using this map.
Java-HTML JAR Example:
The'embedTagIDTable'
is a really simple 'Map' that translates an'<EMBED>'
element'sDATA-FILE-ID
to an'.html'
file-name (that you have written) on the file-system.
TheEmbed Tags Map File
used by this JAR-Library's Build Script may be viewed below, as an example. This is an exhaustive list of all Global, Externally-Linked, HTML Pages for theJava HTML
library.
Global Embed Tags Map File- Parameters:
tagIDMap
- This should map a'DATA-FILE-ID'
to an'.html'
File-Name
-
useHiLiteServerCache
public Upgrade useHiLiteServerCache(HiLiteMe.Cache cache)
Convenience Method
Invokes:HiLiter.getDefault(HiLiteMe.Cache, String, String)
And-Then:setHiLiter(HiLiter)
-
useHiLiteServerCache
public Upgrade useHiLiteServerCache (java.lang.String hiLiteServerCacheDirectoryName)
Configures the HiLiter to use the Default HiLiter, and use the provided Cache-Directory as the location for Caching HiLited HTML-Files.- Parameters:
hiLiteServerCacheDirectoryName
- The name of the File-System Directory which has previously saved HiLited HTML-Files.
NOTE: If this is the first time using this Cache Directory, and it doesn't exists yet, this directory will be created, and futureUpgrade
instances will save & cache HiLited-Source HTML to this directory.
-
setHiLiter
public Upgrade setHiLiter(HiLiter hiLiter)
-
retrieveDefaultCSSFilesFromJAR
public static CSSFiles retrieveDefaultCSSFilesFromJAR()
Returns the contents of the standard JavaDoc UpgradeCSS File
as aString
.
Lazy-Loading:
The CSS file that is loaded is actually stored in a data-file within the Java-HTML JAR-File. ThisString
remains, on disk, in the JAR unless this method is invoked.
Customizing'JavaDoc.css'
In order to customize the CSS to your liking, please review theString
that is returned by this method. The fonts, colors, and styles that are produced by the Default CSS-File are the ones used in this documentation page that you are reading right now.
These font, color, and style CSS-Definitions may be changed by retrieving this CSS Definition page (as ajava.lang.String
, and saving thatString
to a file).
Once the standard-issue CSS has been modified to fit your needs, using the new-updated definitions is done by invokingsetCustomJDCSSFile(String)
.
CSS Class & ID Names:
The actual CSSCLASS
andID
Tag's cannot be changed in this file. The styles, colors, fonts may be modified (and even deleted or augmented as needed) to follow any and all necessary design-choices.
However, there is no way to changeCLASS
orID
names of the CSS-Tags that are inserted by the Java-Doc Tool. There is also no way to change the names of Clases or ID's that were originally generated by the actual'javadoc'
Tool either.
The actual'.css'
file retrieved (as ajava.lang.String
) contains much explanation and commenting for each of theCLASS
andID
tags defined on the page.
This Method is'static'
This method may be invoked at any time, it does not require an instance of'Upgrade'
to be running. Reviewing CSS can be complicated, and changing the code 'off-line' is encouraged. You may edit the file at your leisure, and when finished use on subsequent Source-Builds.
The documentation for classCSSTags
also has a detailed explanation for each of theCLASS
andID
definitions inserted by this upgrader tool. Thisclass
should also be reviewed if the comments and documentation included in theString
/ file returned by this method are insufficient for understanding what is happening.- Returns:
- All Java-Doc Upgrader
'.css'
Files - See Also:
setCustomCSSFiles(CSSFiles)
-
setCustomCSSFiles
public Upgrade setCustomCSSFiles(CSSFiles cssFiles)
Set's the CSS Definitions file to a custom-made CSS file.
CSS Class & ID Names:
The actual CSSCLASS
andID
Tag's cannot be changed in this file. The styles, colors, fonts may be modified (and even deleted or augmented as needed) to follow any and all necessary design-choices.
However, there is no way to changeCLASS
orID
names of the CSS-Tags that are inserted by the Java-Doc Tool. There is also no way to change the names of Clases or ID's that were originally generated by the actual'javadoc'
Tool either.
Default'.css'
File:retrieveDefaultCSSFileFromJAR
will return the complete default'.css'
Definition-File. Review that method's documentation (and itsString
-Output) for more information about the original / default'.css'
File.
Simply invokeretrieveDefaultCSSFileFromJAR
, and save theString
that it returns to a file on your File-System. You may update & modify that file, making any changes that are necessary, to accomodate your Project's Design-Choices.
Afterwards, pass that file as aString
to this method - and your updated CSS style-definitions will be incorporated into the JavaDoc pages produced by this Upgrader Tool.
File-Contents:
The parameter to this method expects theCSS File
, itself, to be loaded in entiretiy into aString
, and passed.
This method is not requesting a file-name!
The File-Contents that are passed to this method will be written to a file named'JavaDoc.css'
. This file will be copied to the Root Java-Doc Root-Directory by the Upgrader.
A link to this CSS File will be inserted into each and every Java-Doc Page that is updated. This allows every Web-Page in your Documentation File-Tree to use this CSS File.
Viewing the Default Files:
The defaultCSS Files
may be viewed here:Upgrader Default-File File-Contents Explanation Original-Widgets.css CSS Rules & Designs that are to be applied Java-Doc Page Widgets that are inserted by the actual Sun / Oracle 'javadoc'
, not by any of the Ugrader Logic or Routines.Upgrader-Widgets.css CSS Rules & Designs to be applied to Java-Doc Widgets that have been created and inserted by the Upgrader Tool. User-Accessories.css CSS Rules & Designs that are used in conjunction, only, with Widgets that are manually placed onto Java-Doc Pages by the user. If the end user does not actually add any of these widgets, then the rules on the CSS Page will not be used. Pygments.org.css CSS Rules & Designs that are applied to any & all Page Syntax HiLiting Segments. List-Frames.css CSS Rules that are applied on 'package-frame.html'
and'overview-frame.html'
Files.NO DEFAULT FILE CSS Rules, provided by the user / programmer. Generally to be used with User-Supplied & User-Created HTML-Widgets. - Parameters:
cssFiles
- All Java-Doc Upgrader'.css'
Files- See Also:
retrieveDefaultCSSFilesFromJAR()
-
retrieveDefaultJSFileFromJAR
public static java.lang.String retrieveDefaultJSFileFromJAR()
There is an (extremely small / limited) '.js' (Java-Script) File that is copied to the output'javadoc/'
directory.- Returns:
- The entire contents of the
'.js'
File (read from disk), returned as aString
.
-
setFaviconFileFormat
public Upgrade setFaviconFileFormat(IF faviconFileFormat)
This is how to request that a favicon be added to all Java Doc Web-Pages. The file-format is just the Favicon's Image-Type ('.jpg', '.png'
etc...).
When this method is invoked, it requests that an HTML Favicon Link be inserted into each Java-Doc Documentation Web-Page. A Favicon is a small graphical image that appears in the top corner of Web-Page tabs when viewing the page.
Favicon File-Name:
The Favicon's File-Name must be'favicon'
- followed by the three-letter or four-letter extension of the File's Type. For instance, ifIF.PNG
were passed to this method, it would indicate that the Favicon Image-File has the name'favicon.png'
.
Copy the File:
After an Upgrade has completed, it is the User's Responsibility to actually copy the Favicon Image-File, itself, into the Java-Doc Root-Directory. If the Image-File isn't copied into the Java-Doc Directory, Web-Browsers won't actually be able to show the Favicon-Image on these Java-Doc Web-Pages.
HTML <LINK> Tag
When the image-type file-extension is set, an HTML Link-Tag will be inserted, as below:<LINK REL='icon' TYPE='image/jpg' HREF='../favicon.jpg' />'
This Tag will be inserted into each page of the Java-Doc Upgraded Pages.
The Upgrader works meticulously to ensure that the "Dot-Dots" Relative-Path is inserted into theHREF=...
Attribute so that each page can properly render a Favicon when it is placed inside the Root Java-Doc Directory.- Parameters:
faviconFileFormat
- An instance ofIF
- the Image-Format of the Favicon-File.
-
addHeaderTags
public Upgrade addHeaderTags(java.lang.Iterable<TagNode> headerTags)
This allows a user to request that HTML-Tags be inserted into Java Doc pages. When HTMLTagNode's
are provided to this list, all Java Doc HTML Pages will have those tags inserted into their headers.
IMPORTANT: The tags that are provided will be inserted into every'.html'
file inside the root Java Doc directory tree. Furthermore, it is not possible to specify differences for tags as they are inserted into the pages.
If there are tags that should be inserted into all pages, for example a canonicalURL
, some general'keywords'
, or possibly company, author, contact, or images-links, then providing those tags (as instances ofTagNode
) here would work great.
If there are HTML<HEAD>, <META>
or<LINK>
tags that will differ dependent into which file they are inserted, you will have to manually add them using one of the callback-hooks provided by the upgrader.
When this field is used, your pages will resemble the page screen-cap in the image below.
NOTE: There are no default tags - you must choose elements of your own and pass them to this configuration-setting field.
- Parameters:
headerTags
- HTML-Tags to be inserted into a page's<HEAD>...</HEAD>
Section
-
addHeaderBlock
public Upgrade addHeaderBlock(java.util.Vector<HTMLNode> headerStuff)
This accepts a full-fledgedVector
. This entireVector
will be inserted into the HTML...
section of all Java Doc Pages.- Parameters:
headerStuff
- HTML-Block to be inserted into a page's<HEAD>...</HEAD>
Section
-
runLinksChecker
public Upgrade runLinksChecker()
Requests that all Inter-Page<A HREF=...>
Links /URL's
be checked. This is a costly operation, and requires more time to complete an Upgrade. This operation, however, can be an invaluable tool if and when user has imported links from <EMBED>-Tag HTML Files.
Default Setting:
Note that it is much smarter to leave theLinksChecker
off as a default. It's default setting is "turned off."
-
setTabsPolicy
public Upgrade setTabsPolicy(int spacesPerTab, boolean relativeOrAbsolute)
Sets a tab-replacement policy for code-hilited HTML.- Parameters:
spacesPerTab
- The number of spaces that should be used as a substitue for a tab-character ('\t'
) when hiliting source-code.relativeOrAbsolute
- When this parameter receivesTRUE
, a tab-character is used to symbolize however many spaces are needed to place the cursor at the next rounded-integral number-of-spaces - modulo the value in'spacesPerTab'
.
If a tab-charcter is found at index13
in a line-of-code, and the value passed to'spacesPerTab'
were4
, then the number of spaces inserted would be3
. This is because precisely3
spaces would skip to index16
, which happens to be the next-highest rounded-multiple of4
.
When this parameter receivesFALSE
, a tab-character is always replaced by the exact number of space-characters specified byspacesPerTab
.- Throws:
java.lang.IllegalArgumentException
- If a number less than1
or greater than20
is passed to parameter'spacesPerTab'
- See Also:
StrIndent.setCodeIndent_WithTabsPolicyRelative(String, int, int)
,StrIndent.setCodeIndent_WithTabsPolicyAbsolute(String, int, String)
-
setCheckBalance
public Upgrade setCheckBalance(boolean checkBalance)
Turns the HTML balance-checker logic on or off. Read more about balance-checking in the documentation for field checkBalance, or in the class Torello.HTML.Balance. By default, this field is set to'TRUE'
.
This flagboolean
is, by default, set toTRUE
. ThisUpgrade
tool uses the class Torello.HTML.Balance to check for validity inside of all HTML files it encounters - including both the externally linked Embed-Tag HTML files, and the JavaDoc generated HTML files. The type of 'validity' that is checked is for unclosed HTML-tags.
There is more explanation of what consitutes a "Balanced HTML File" inclass Balance
. To summarize the information there, all that the code really does is to check (for all non-singleton tags, only), that there are an equal number of opening and closing versions of each HTML element. For example, the balance-checker counts the number of'<DIV>'
elements and the number of'</DIV>'
elements, and if there are not an equal number of them, an exception is thrown. (No more, no less)
Singleton Tags:
Singleton tags (such as<IMG ...>
) are not checked because they are not expected to be closed, they are stand-alone tags. The code, here, will also pass on checking Attribute Validity.
An HTML<IMG>
that (accidentally) uses anHREF=...
instead of aSRC=...
, though erroneous, is an error that is not caught by this checker. Future versions of this tool may work on this problem.
Dubious HTML Cases:
JavaDoc generates valid HTML. A programmer who inserts HTML into his Java-Doc Generated Web-Pages will certainly encounter errors where this check helps finding unclosed HTML Problems inside their documentation.
There are a number of 'Questionable Cases' or 'Boundary Cases' on what actually constitutes Valid-HTML. The<LI>
-Tag, for instance. There are some Web-Designers who feel that it is not necessary to close these tags with a'</LI>'
.
However, this checker will not allow this scenario. In order to allow for unclosed, non-singleton tags, this checker must be turned off.- Parameters:
checkBalance
- The value of this parameter can turn the balance checker on or off.
-
setExtraTasks
public Upgrade setExtraTasks (java.util.function.Consumer<JavaDocHTMLFile> extraTasks)
This allows a user to do his own, user-specified tasks to a java-doc vectorized-html page before it is written to disk. The "Extra Tasks"'Consumer'
will receive the same data that all of the primary-operations classes in this Upgrader package receive. To read all of the available datum that is retrieved for each Java Doc Class, Interface & Enumerated-Type, see the class JavaDocHTMLFile.
When the Upgrader is provided with anExtra Tasks
, the user may use that instance to modify the JavaDoc Web-OPage in any arbitrary way he chooses. A programmer might wish to add some recurring-automated comments to each method description, or perhaps insert an icon or glyph to all of the Classes inside of one his Package's.
Thisjava.util.function.Consumer<JavaDocHTMLFile>
will receive the same record-instance that is passed to all of the main-operation classes in this library. The most important part to remember is that any modifications to the JavaDoc Web-Page need to be performed on the'fileVec'
parameter.
Using Torello.HTML:
Modifying HTML is niether difficult, nor tedious, but it does require knowledge of the Classes, Interfaces, etc. in both theTorello.HTML
and theNodeSearch
Packages.
Regardless, just about everything you would need to know about a Java Doc HTML Page is provided in the parameters of the classJavaDocHTMLFile
- Parameters:
extraTasks
- This function-pointer may be used to, sort-of, do extra processing on a JavaDoc HTML Documentation File while the vectorized-html file is already loaded into memory - and parsed.
The classJavaDocHTMLFile
provides many accessor methods to retrieve the Summary Tables, and the HTML Details - along with reflection-classes about theMethod
's,Field
's, etc... that they describe
-
setPackageSummaryCleaner
public Upgrade setPackageSummaryCleaner (java.util.function.Consumer<java.util.Vector<HTMLNode>> packageSummaryCleaner)
Sets the cleaner. This is very simple concept, but it may be complex to implement. Java's 'AI' for putting a one-line or one-sentence summary as a description into the "Summary Pages" for Java Packages is sometimes horribly skewed. This occurs if there is any HTML inside a Java Doc Comment.
The best way to learn to use thisConsumer<Vector>
is to try writing a simple that just prints the HTML to the termainl, and see what can be done with it. The size of the problem is limited by how much code-comments you have put into the comment portions of the method's and field's in your source code files.
Try looking at the default-cleaner for this library. Since there is a Very large amount of documentation and code-comments (since this is actually a code-commenting package), the cleaner is a little difficult to understand - although what it is doing is very easy stuff.
Very often, when building the pagespackage-summary.html
for a particular JavaDoc package, theclasses
andinterfaces
that are inserted into the page will look horribly skewed - if the comment section of the classes contained any detailed HTML segments. Setting a Package Summary Cleaner will remove most of the text inserted into that page.- Parameters:
packageSummaryCleaner
- Java Lambda for modifying Vectorized-HTML.
-
useDefaultPackageSummaryCleaner
public Upgrade useDefaultPackageSummaryCleaner()
Requests using the default Package Description Summary Page Cleaner.
This may be viewed here:PackageSummaryHTML.defaultCleaner
-
setPackageList
public Upgrade setPackageList (java.lang.Iterable<BuildPackage> packageList)
Often, for the purposes of "development speed" during the development phase of a project, it can be of tremendous benefit to skip, altogether, the Upgrade Process of some of the Packages in a Project.
Filter Behavior:
Packages which are explicity named by the input parameter list'packageList'
are INCLUDED not EXCLUDED by the Internal Upgrder Logic.
Default Setting:
By default, initiating anupgrade
will cause this Package's internal Upgrade Logic to iterate ALL Packages found / present in the'javadoc/'
output directory.
Input-Parameter Type:
If Java-HTML Package "Build
" is not actually being utilized by your Project's Build-System, there is a nearly identical variant of this method that accept's Package-Names as JavaString's
, instead of instances of class "BuildPackage
".
(ClassBuildPackage
is one of the Primary Data-Classes for the Build ToolTorello.Java.Build
).- Parameters:
packageList
- A list of instances of theBuild
Package's classBuildPackage
.- Returns:
'this'
instance, for method-invocation chaining.- See Also:
setPackageList(String[])
-
setPackageList
public Upgrade setPackageList(java.lang.String... packageList)
Often, for the purposes of "development speed" during the development phase of a project, it can be of tremendous benefit to skip, altogether, the Upgrade Process of some of the Packages in a Project.
Filter Behavior:
Packages which are explicity named by the input parameter list'packageList'
are INCLUDED not EXCLUDED by the Internal Upgrder Logic.
Default Setting:
By default, initiating anupgrade
will cause this Package's internal Upgrade Logic to iterate ALL Packages found / present in the'javadoc/'
output directory.- Parameters:
packageList
- A list of Package-Name's as aString
.- Returns:
'this'
instance, for method-invocation chaining.- See Also:
setPackageList(Iterable)
-
setGenerateFrames
public Upgrade setGenerateFrames(boolean generateFrames)
A Configuration-Setting for requesting that the Upgrader Auto-Generate the original Java'package-frame.html'
&'overview-frame.html'
Files.
Back by Popular Demmand:
By default, the Upgrader actually will recreate the original HTML-<IFRAME>
Elements as existed on Java-Doc Web-Pages before and during Java-11 when they were deprecated. These frames were fully removed by Java LTS 17 (for why? I have no idea).
As an aside, as a "JavaDoc Professional" it is this programmers belief that Java-Doc becomes nearly "unusable" without the frame files, and I truly have little idea why they were elminated.
Anyway, below is shown the original HTML from the JDK-11 variant of JavaDoc. Some space-indentation has been added to the original HTML, merely to make the contents more readable here on this page.
HTML Elements:
<main role="main"> <div class="mainContainer"> <div class="leftContainer"> <div class="leftTop"> <iframe src="overview-frame.html" name="packageListFrame" title="All Packages"></iframe> </div> <div class="leftBottom"> <iframe src="allclasses-frame.html" name="packageFrame" title="All classes and interfaces (except non-static nested types)"></iframe> </div> </div> <div class="rightContainer"> <iframe src="overview-summary.html" name="classFrame" title="Package, class and interface descriptions" class="rightIframe"></iframe> </div> </div> </main>
- Parameters:
generateFrames
- Theboolean
-Setting for this Configuration-Field- Returns:
'this'
instance, for method-invocation chaining.- Throws:
UpgradeException
- If'generateFrames'
is passedFALSE
, but you have earlier configured / applied an'overview-frame.html'
sorter.- See Also:
PackageSummaryHTML.JD_FRAMES_WARNING_MESSAGE
-
setOverviewFrameSorter
public Upgrade setOverviewFrameSorter(java.lang.String[] sectionNames, java.lang.String[][] sectionContents)
Generate and sort an'overview-frame.html'
File.- Parameters:
sectionNames
- List of "Categories" or "Sections" for the packagessectionContents
- List of Packages for each Category / Section.- Returns:
'this'
instance, for method-invocation chaining.
-
-