Download presentation
Presentation is loading. Please wait.
Published byAlexander Hoover Modified over 8 years ago
1
Presented By:
2
What is JavaHelp: Most software developers do not look forward to spending time documenting and explaining their product. JavaSoft has developed the JavaHelp API: a full-featured, platform- independent, extensible help system that gives developers and authors the ability to efficiently incorporate an online help system into applications (both network and stand-alone), applets, JavaBean components, HTML pages, operating systems, and devices. To use JavaHelp in an application we need to prepare a set of files described below. With the exception of content files and search files, each file is expected to be in the XML format. For more information about XML see http://www.w3.org/TR/WD-xml- lang-970331.htmlhttp://www.w3.org/TR/WD-xml- lang-970331.html
3
1) Java Help API 2) HelpSet File - contains Helpset.hs 3) Map File - contains Map.jhm 4) Table of Contents(TOC) File (XML) 5) Index File (XML) 6) Help Content files. 7) Search Files( Database files) JavaHelp Configuration Files:
4
What needs to be done: Download and extract the JavaHelp API to the C:>, from http://java.sun.com/products/javahelp/ Set up the path for the java indexer used for making a search database for the content files c:\jh2.0\javahelp\bin Edit the java run time environment in your IDE( Eclipse, Netbeans or BlueJ, to include the java help api bin files…). Start Coding
5
HelpSet File - contains layout.hs HelpSet file allows JavaHelp to locate the configuration files for the different views. It also stores the location of the map file which is used to map the content files to ID tags used in context sensitive help. Layout of the HelpSet file.
6
Map File - contains layout.jhm The map file is used to map the content files to the ID tags. ID tags are used in context specific help and allow for abstraction of content file urls. Map file layout.
7
Table of Contents(TOC) File (XML) TOC represents a view that typically contains references to help topic IDs in a logically grouped order. Layout of TOC file
8
Index File (XML) Index view is very similar to a TOC view described before, but typically organizes references to help topics in alphabetical order. Layout of the index configuration file.
9
Content Files JavaHelp content files are stored in the HTML format. We can use one or more content files. The files can be stored locally or on a server. The map file stores the IDs and the URLs of the content files.
10
Search Files( Database files) The search view allows users to search through the content files for specific keywords. Every instance of the keyword is highlighted in the content files where they are present. Jhindexer: jhindexer is a utility which catalogs all the keywords found in the content files. Running the indexer: from the root directory of the project, at the command prompt type: jhindexer contentFilesDirectoryName JavaHelpSearch directory is created
11
Now Lets look at what to code You will be Surprised to know that using this API cuts down the number of lines of code to less than 20. Here is how you use the API and start coding …………………………..
12
HelpSet Class This class represents a collection of help information files we discussed above: HelpSet, table of contents (TOC), index, content, and map files. To create a HelpSet instance we must supply two parameters: a ClassLoader instance used to locate any classes required by the navigators in the help set, and the URL of the main HelpSet file. The following code shows a typical HelpSet instantiation, assuming the main HelpSet file, helpset.hs, is contained in the current running directory: ClassLoader loader = this.getClass().getClassLoader(); URL url = HelpSet.findHelpSet(loader, “helpset.hs"); HelpSet hs = new HelpSet(loader, url);
13
The HelpBroker interface This interface describes a component used to manage the presentation and interaction with a HelpSet. We can use the HelpSet.createHelpBroker() method to retrieve an instance of HelpBroker. We can then use HelpBroker’s enableHelpKey() method, specifying the String ID of a desired help topic, to enable JavaHelp on a given Component. HelpBroker hb = hs.createHelpBroker(); hb.enableHelpKey(myFrame.getRootPane(), "MyTopicID", hs);
14
The Map interface This interface defines a String ID to URL mapping. The inner class Map.ID is used to identify a help topic. It encapsulates a HelpSet reference / String ID pair. Given an ID we can get the associated URL and vice versa. Each HelpSet has an associated Map instance.
15
JHelp Class This class represents the main JavaHelp viewer capable of displaying help set data using JTree or JList navigators in a JTabbedPane, and a content viewer (normally a JEditorPane for HTML display). The current implementation of JavaHelp does not provide public access to this class via HelpSet or HelpBroker instances. You can do a lot more to customize your help viewers and add neat features such as context sensitive help etc.
16
Customize your Help Application It is really easy to customize your application by using the classes offered by the API, Such as HelpModel interface :It maintains IDs and URLs corresponding to the HelpSet being displayed JHelpNavigator : navigation control (JTree or JList) for the GUI presentation of help topic data CSH : context sensitive help TreeItem : user objects in a navigational view’s JTree or JList. HelpModelListener interface : listener which receives javax.help.event.HelpModelEvents when the current help topic is changed
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.