Currently, JAS uses Oracle Help For Java to implement the help system. Every attempt was made to encapsulate all help details in so that the expected switch to Sun's JavaHelp will be simple.
The help system is fundamentally implemented by the following file types:
- .oht
- links context-sensitive areas of the application to help pages (one per book)
- .hhc
- table of contents (for one book)
- .hhk
- index (not search index, but list of key words you see on the navigator) of key words for one book
- .htm
, .html - content files
- .jpg
, .gif - images .oht files follow a format prescribed by the Oracle Help For Java File Format Reference. They map an arbitrary keyword to the URL for a help page. This allows the programmers to hard-code keywords for each of the context-sensitive help topics and change the actual URLs that they reference without recompiling the classes or re-releasing the application. For example, a link on the OptionsDialog uses the keyword "TimedBackup" for a help page on timed backups and specifies that the topic is described is in the "jobs" book (by returning the value jas.util.Application.JOBS_BOOK when asked for a book index). The .oht file for the jobs book (called jobs.oht) maps that keyword to a URL by following the OHT file format. As far as I can tell, only Oracle Help For Java uses this format. It's easiest to edit these files by hand, but be warned: The parser is very picky so follow the format exactly. Your only clue that an error is found is that the book and its contents are absent from the help viewer. .hhc and .hhk files are generated by Microsoft's HTML Help Workshop, which provides a simple GUI that allows you to edit the index and contents files. Each book has a project file (.hhp ) which the help workshop uses to keep track of the files for that book. These formats are considered universal (they were proposed by Microsoft at the World Wide Web Consortium), and should be portable to Sun's JavaHelp. It's best not to edit these formats by hand. .htm and .jpg files are created in or handled by in Microsoft Front Page 98. The .html files are created by the javadoc tool, and it uses a set of .gif files on the pages it creates.
Therefore, if you create a new HTML file and add it to the help system completely, you must
.hhp file (but not from FrontPage, open from My Computer instead) for that book. For example, the project file for the jobs book is jobs.hhp . The help files are all in \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\ , where jas_version is the an envoronment variable that contains the directory name for the version you're interested in. .idx ). There is typically one .idx file for each book, but it is simpler for us just to have one for all of the books. I have a batch file (\\sldnt17\users\jgifford\help\index.bat ) that creates an index file like this: md temp\
set java_compiler=
copy \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\*.htm temp\
rem copy \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\api\jas\*.html temp\
rem copy \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\api\hep\*.html temp\
del temp\relnotes.htm
del temp\contents.htm
\\sldnt21\ohelp\tools\indexer-win\index temp\ \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\jobs.idx
rmdir temp\ /q/s
It creates an index file for the jobs book and places it in the web directory so that it can be accessed by users with internet access. The indexer tool comes with a download of Oracle Help For Java. I've commented out the lines that cause the javadoc pages to be indexed. These pages don't get indexed properly because they are in a different directory.
Java Analysis Studio allows users to have the help files dowloaded on their machines and allows them to access those files from the application. This is accomplished by creating a file that includes all of the help files, and by adding that file to the classpath for the JAS application.
By default, the application uses local help files if they are available (i.e., in the classpath). If the file is not in the classpath or if the property ReadHelpFromDisk is set to false, the application tries instead to read the files from the server. To set application properties, add or change entries in the file which is stored in the directory specified by .
The actual .jar file is created by a batch file at . The file looks like this:
set java_compiler= md jas\help\ md jas\help\api\jas md jas\help\api\hep md jas\help\api\jas\images md jas\help\api\hep\images javac -d .\ JASHelp.java copy \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\*.htm jas\help\ copy \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\*.hhc jas\help\ copy \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\*.hhk jas\help\ copy \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\*.idx jas\help\ copy \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\*.jpg jas\help\ copy \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\api\jas\*.html jas\help\api\jas\ copy \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\api\hep\*.html jas\help\api\hep\ copy \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\api\jas\images\*.gif jas\help\api\jas\images\ copy \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\api\hep\images\*.gif jas\help\api\hep\images\ del jas\help\relnotes.htm del jas\help\contents.htm del standalonehelp.jar jar -c jas\help\*.* > standalonehelp.jar del jas\help\*.class javac -d .\ HelpRef.java del builtinhelp.jar copy \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\*.oht jas\help\ jar -c jas\help\*.* > builtinhelp.jar rmdir jas\help\ /s/q
The batch file actually creates two files.
standalonehelp.jar , is used by a stand-alone application. This allows the user to run help totally separately from the JAS application. I invoke this stand-alone application using a batch file (\\sldnt17\users\jgifford\help\jashelp.bat ) that simply hasset java_compiler= java -classpath standalonehelp.jar;%classpath% jas.help.JASHelp
This file contains all of the images and HTML files in the help system, plus the table of contents and index files. It also contains the class which contains the main function for the application and provides a simple interface to the help system.
builtinhelp.jar , is used by the JAS application. Add this file to the classpath of the application to allow the application access to all of the help files locally. Like the first file, it contains all of the HTML files, images, and index and table of contents files. It also contains the .oht files to enable context-sensitive help, and a very simple class, jas.help.HelpRef , which allows the application to .jar file with all the help files has been added to the classpath The source files for the classes mentioned above are and .
Therefore, changes to the help system contents should be reflected in
.idx file, and .jar files, as well as the in the , , , and files for the book(s) that the changes were made to. The batch files that create these files should be run after any changes have been made to the help pages. Of course, the file should be created before the files because both the .jar files use the file and they should have the latest version available.
Ultimately, you must invoke the method on the instance of . This takes two arguments:
jas.util.Application class. For example, the index for the jobs book is jas.util.Application.JOBS_BOOK . The correct index for a user-added help book will be returned by the addHelpBook methods..oht file for the selected book maps to the string given as the second argument.Convenience help access is coded in for
- JASWizardPage
jas.util.HasHelpPage , the 'Help' button will enable. You must implement methods that return the two parameters listed above.
- JASDialog
setHelpTopic and setHelpBook before the dialog is shown, and you include the flag HELP_BUTTON among the button flags then an enabled help button will appear on the dialog.
- ErrorBox
ErrorBox constructor then an enabled help button will show on the error dialog. You can add as many books as you want by calling the addHelpBook methods on the application object (access by typing ). These methods will invoke corresponding methods on the help object and return the integer index you must use to refer to the newly created book. The documentation below is modified from the Oracle Help For Java documentation. It explains the parameters for the two methods.
public int addHelpBook(String baseURL, String baseName, String bookTitle)
public int addHelpBook(Class baseClass, String dirName, String baseName, String bookTitle)
I use the following batch file (which is ) to create the javadoc pages (note that the environment variable jas_root is the directory where all JAS source code is. For example, the source file for would be ):
set java_compiler= cd %jas_root% copy jas\histjp\*.java jas\hist\ java -mx40m -ms40m sun.tools.javadoc.Main -d \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\api\jas jas.swingstudio jas.hist jas.hist.test jas.util jas.jds.module jas.jds.module.pawserver jas.jds.module.flatfileserver jas.jds.module.hepevt jas.jds.module.hippo jas.jds.module.jdbc jas.jds.module.sld del jas\hist\*.java /q javadoc -d \\sldnt17\users\inetpub\wwwroot\jas\help\%jas_version%\api\hep hep.analysis hep.analysis.peer
Jonas Gifford, January 14, 2004