Skip to main content

RE: [JAVAHELP] Need help with Java Lightweight Component

No replies
Anonymous

Binky,
I think I have this figured out, it was just a matter of calling the right methods for the JHelp component and not the JHelpContentViewer. It turns out that I had to call the setHelpSetSpec and setCurrentId of the JHelp component.

I have another question related to this though. Whenever the JavaHelp browser does indeed switch helpsets now and displays the correct helpset and id, the history goes away. By that I mean, the Previous button becomes inactive. I traced through the JH code and found that the Previous button is built in the BasicHelpUI class. It appears that all the methods which seem useful are private. Do you know of another way I can maybe add something to the history? I'm assuming that the history is discarded after the JavaHelp browser changes helpsets.

The HelpModel object looks tempting but I don't see how I could use it, do you have any ideas?

Thanks!

-----Original Message-----
From: David Cagle [mailto:David.Cagle@SAS.COM]
Sent: Thursday, January 29, 2004 4:24 PM
To: JAVAHELP-INTEREST@JAVA.SUN.COM
Subject: [JAVAHELP] Need help with Java Lightweight Component

I'm looking to write a lightweight component that takes a helpset name and id as parameters. It will behave very similar to the JHSecondaryViewer object, but instead of bringing up a secondary window or popup window, the new object will refresh the current JavaHelp browser with the new helpset and id. I guess you could call it a cross-helpset link of sorts. The JHSecondaryViewer object has served as a great template but I'm running into a problem when I try to set the JavaHelp browser to the new helpset. The new id displays in the content pane correctly but the navigation (TOC, Index, and Search) remain on the original helpset. Furthermore, when I click on a TOC item I receive 'javax.help.plaf.basic.BasicTOCNavigatorUI@ca470 BadID' messages and for Index items 'BadID' messages.

In my html page, the tag looks like this:

My java code has a getter and setter for both 'helpSet' and 'ID' and the famous setViewData method. I made my new object a JLabel instead of JButton, so I'm using mouseClicked instead of actionPerformed to perform my actions.

When the user clicks on the label, the content pane refreshes with the new id but the navigation remains on the original helpset. Here is that Java code: Map.ID newId = null; newId = Map.ID.create( currId, hs ); ((JHelpContentViewer)container).getModel().setHelpSet(hs);
((JHelpContentViewer)container).setCurrentID( newId.id ); ((JHelpContentViewer)container).repaint();

currId and hs are the parameters passed in by the tag. 'container' is the JHelpContentViewer found when the setViewData method runs.

I'm thinking my problem is a simple refresh problem or I'm missing a method somewhere to update everything correctly.

Does anyone have any helpful tips or something I can try? Thanks for your time!

----------------------------------------
David Cagle
Applications Developer
Publications Technology Development
(919) 531-4814
SAS ... The Power to Know

********************************************************************************

You may leave the list at any time by sending message with no subject and "SIGNOFF JAVAHELP-INTEREST" in the body to LISTSERV@JAVA.SUN.COM. Archives are available at http://archives.java.sun.com/archives/javahelp-interest.html.
Submit bug reports at http://java.sun.com/cgi-bin/bugreport.cgi.

********************************************************************************

You may leave the list at any time by sending message with no subject and
"SIGNOFF JAVAHELP-INTEREST" in the body to LISTSERV@JAVA.SUN.COM. Archives
are available at http://archives.java.sun.com/archives/javahelp-interest.html.
Submit bug reports at http://java.sun.com/cgi-bin/bugreport.cgi.