Forum Stats

  • 3,839,563 Users
  • 2,262,504 Discussions
  • 7,900,993 Comments

Discussions

adding a glossary tab

I have some Java Swing skills and would like to add my own glossary tab. What class should I extend/create in order to create a GlossaryEngine much like HHCEngine or TOCEngine, etc.?

Thanks,
Jason

Comments

  • 312396
    312396 Member Posts: 165
    Hi, Jason.

    You can see an example of how to build a custom navigator (such as a Glossary) by unzipping the help-demo jar that is installed with OHJ. Take a look at the files EducationNavigator.java and EducationEngine.java

    Hope this helps,
    Ryan
  • 153220
    153220 Member Posts: 23
    Thanks! Is there Javadoc for these classes?
  • 312396
    312396 Member Posts: 165
    Sorry, Jason. We don't have Javadoc for these classes yet...we're meaning to add some documentation about creating custom navigators but haven't been able to do so. Hopefully the example I pointed you to will be sufficient information, but let us know if you have specific questions.

    Ryan
  • 153220
    153220 Member Posts: 23
    A basic discussion of the Navigator and DataEngine classes would be great. For example, what are all of the available methods? How do they interact? There are very few comments in EducationNavigator.java and EducationEngine.java to go by, so I'm not yet sure how much of the visible code is required for the EducationNavigator itself and how much could be re-used for my glossary tab.

    You could really increase the appeal of OHJ with better Javadoc. If creating custom tabs were clear and easy, all kinds of advanced help systems could be created. We've been looking on and off at Java-based ThinkMap technology, which would make an awesome addition to an OHJ helpset (especially one as large as ours) if only I could figure out how to integrate it.

    Can you guys put together a very short description of these two basic classes and their methods and/or write a short white paper on how to write a custom navigator? I don't need much to go by, but I don't think there's enough there to do it now without a whole lot of trial and error. Even just sending me new copies of EducationNavigator.java and EducationEngine.java with descriptive comments would be helpful.

    Thanks,
    Jason
  • 312396
    312396 Member Posts: 165
    Hi, Jason. We hope to provide better documentation about writing custom navigators over the next few months, but for now here's some basic info.

    Check the Oracle Help Guide for a bit of documentation about engines and navigators. Go to http://otn.oracle.com/docs/tech/java/help/htdocs/ohguide/ohff_hsfile.html#view%20element to see some examples of engines and corresponding navigators. Oracle has engines for processing different types of help control files, and then we have navigators that display the data created by the engines. FYI, the Navigator class is actually a direct subclass of JPanel, whereas the DataEngine class only extends Object.

    Your subclass of DataEngine is mainly used to process a text file and then construct a dataobject. DataEngine has the following abstract method:

    public abstract Object createDataObject(View view, String basePath, URL url, String encoding) throws IOException;

    Your implementation of Navigator then gets at this data by calling getViewData on a view object. Check out the EducationNavigator to see how this is done. Navigator also has the following abstract methods:

    public abstract void initNavigator(View[] initialViews);
    public abstract void addView(View view);
    public abstract void removeView(View view);
    public abstract Topic getCurrentSelection();
    public abstract String getDefaultLabel();


    So hopefully that gives you a little better idea of what you've got to do. I know that things aren't going to be crystal clear just from this, but take some time to play around with the Education navigator and hopefully you'll figure some things out.

    Good luck,
    Ryan
  • 153220
    153220 Member Posts: 23
    Done! Thanks! This was a lot easier than I thought it would be. I designed the GlossaryEngine to use the XML glossary file output by RoboHelp when it generates WebHelp (whgdata0.xml). This way we don't have to maintain separate, unrelated XML files and can use a feature of RoboHelp that we're not currently using.

  • Very cool!

    I've done something along these lines myself for
    glossaries, but we've yet to make it real enough to
    give out with the product. We will however work on
    documenting how to create a custom navigator, since
    as you discovered it is pretty easy to do!
This discussion has been closed.