Skip to main content

problem launching JavaHelp set

7 replies [Last post]
gboyer
Offline
Joined: 2003-12-31
Points: 0

Hi,

I recently upgraded to JH2.0 release candidate, j2sdk1.4.1_02, on Win2000. Here's what's up:

In the Java application the developers have created, there are two ways to display the helpset: you can press F1, or you can click on an html link, which is supposed to launch the helpset at the bookmarked page. Both of these methods worked fine in jdk 1.3.1/jh1.1.3. Now, however, you can only bring up the helpset by pressing F1. If you try to click the html link, no error messages show up in the debugger, but nothing happens.

I've had three different people help me verify that the links are all pointing in the right places. Any ideas?

thanks,

Gayle

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gboyer
Offline
Joined: 2003-12-31
Points: 0

The problem seems to go away when I go back to jh1.1.3 with jdk 1.4.1. So given our current deadlines, that's what we'll do for now, and see what we can figure out when we're a little less pressed.

Thanks for your help,

gkb

javatool
Offline
Joined: 2006-02-17
Points: 0

There is a very simple and good example to demostrate how to embed JavaHelp to app.

may download it from: http://www.pivotonic.com/jawahelpauthor/HelloJavaHelp.zip

We setup our javahelp system according to it..

very easy.

brinkley
Offline
Joined: 2003-06-06
Points: 0

I'd say this isn't a JavaHelp problem but a problem for your programmer. I'd look at how the F1 key was setup. Most likely you were using an ID. If it were me I wouldn't bother creating the URL, but pass the ID in the url. get the URL in string form and pass it to hb.setCurrentID.

I'd also investigate that getHelpBroker and getHelpSet are returning the right objects. Finally, there isn't any code in MalFormedURLException catch. If something is wrong there the code just continues on it's merry way passing a null to hb.setCurrentURL.

Binky

tedhill
Offline
Joined: 2005-05-31
Points: 0

Hi Binky,

Thank you for your help on our problem. I'm the programmer working on this issue. It's been a while since I've worked with this code (since it has been working fine for the last couple of years).

I'm not sure what you mean by how the F1 key is set up. But this is how we init the help system.

/**
* initialize the variables that provide access to JavaHelp on line help
*
* if and error is detected, log it
*/
private void initHelp( )
{
try
{
URL hsURL = HelpSet.findHelpSet(null, getHelpSetFileName());

if(hsURL == null)
{
Log.error("TomoUI.initHelp( ) hsURL is null");
// fall through to catch
}

helpSet = new HelpSet(null, hsURL);
helpBroker = helpSet.createHelpBroker( );
helpBroker.enableHelpKey(getRootPane( ), "0", helpSet);
}
catch(Exception exc)
{
Log.error("HelpSet not found");
}
}

Here is the Hyperlink Listener code snippet again:

/**
* Called when a hypertext link is entered/exited/clicked on. This
* method will show context sensitive help relating to the Next
* Steps box on the top panel.
*/
public void hyperlinkUpdate(HyperlinkEvent e)
{
if(e.getEventType( ) != HyperlinkEvent.EventType.ACTIVATED)
{
return;
}

// The URL located in the hypertext link from the next steps
// html file is used to open the tomoHelp to the appropriate
// context.
String url = e.getURL( ).toString();
int endOfPath = url.lastIndexOf("/");
String fileName = url.substring(endOfPath + 1);
HelpSet hs = getHelpSet();
URL base = hs.getHelpSetURL(); //location of tomohelp/
URL helpPage = null;

try
{
helpPage = new URL(base, fileName);
}
catch (MalformedURLException mue)
{
System.out.println("TopPanel.hyperlinkUpdate() mue CAUGHT");
}

HelpBroker hb = getHelpBroker();
hb.setCurrentURL(helpPage);//show context sensitvie help.
}
});

I believe that we are getting the correct HelpSet in the snippet above. I'm not positive about the HelpBroker, but at least it is not throwing a null ptr exception when making the call on it in the last line.

Could you please elaborate on how to get the argument to pass to
hb.setCurrentID() as you suggest doing?

Below I'm attaching the state shown in the debugger at the last line in our HyperLinkListener (perhaps you can spot some problem).

Thanks,

Ted Hill

======================= Debugger output below ========================

this = {com.tomotherapy.tomo.framework.ui.TopPanel$7@2334}

e: javax.swing.event.HyperlinkEvent = {javax.swing.event.HyperlinkEvent@2336}

url: java.lang.String = "file:/C:/ClearCase/HiArt_2.0/source/code/java/com/tomotherapy/tomo/resources/PS_Help/Output/CommonTasks9.htm#wp1001921"

endOfPath: int = 91

fileName: java.lang.String = "CommonTasks9.htm#wp1001921"

hs: javax.help.HelpSet = {javax.help.HelpSet@2344}
errorMsg: java.lang.String = null
listenerList: javax.help.event.EventListenerList = {javax.help.event.EventListenerList@2842}
publicIDString: java.lang.String = "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN"
publicIDString_V2: java.lang.String = "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 2.0//EN"
implRegistry: java.lang.Object = {java.lang.StringBuffer@2845}
helpBrokerClass: java.lang.String = "helpBroker/class"
helpBrokerLoader: java.lang.String = "helpBroker/loader"
kitTypeRegistry: java.lang.Object = {java.lang.StringBuffer@2848}
kitLoaderRegistry: java.lang.Object = {java.lang.StringBuffer@2849}
title: java.lang.String = "Planning Station Online Help"
map: javax.help.Map = {javax.help.FlatMap@2851}
combinedMap: javax.help.TryMap = null
helpset: java.net.URL = {java.net.URL@2345}
homeID: java.lang.String = "Title"
locale: java.util.Locale = {java.util.Locale@2853}
loader: java.lang.ClassLoader = null
views: java.util.Vector = {java.util.Vector@2854}
presentations: java.util.Vector = {java.util.Vector@2856}
defaultPresentation: javax.help.HelpSet$Presentation = null
helpsets: java.util.Vector = {java.util.Vector@2857}
defaultHelpBroker: javax.help.HelpBroker = null
subHelpSets: java.util.Vector = {java.util.Vector@2858}
defaultKeys: java.util.Hashtable = {java.util.Hashtable@2859}
localKeys: java.util.Hashtable = {java.util.Hashtable@2861}
changes: java.beans.PropertyChangeSupport = {java.beans.PropertyChangeSupport@2862}
debug: boolean = false
class$javax$help$event$HelpSetListener: java.lang.Class = null
class$java$lang$Object: java.lang.Class = null
class$javax$help$HelpSet: java.lang.Class = javax.help.HelpSet

base: java.net.URL = {java.net.URL@2345}
serialVersionUID: long = -7627629688361524110
protocolPathProp: java.lang.String = "java.protocol.handler.pkgs"
protocol: java.lang.String = "jar"
host: java.lang.String = ""
port: int = -1
file: java.lang.String = "file:/C:/ClearCase/HiArt_2.0/source/code/java/libs/PS_Help.jar!/PS_Help.hs"
query: java.lang.String = null
authority: java.lang.String = null
path: java.lang.String = "file:/C:/ClearCase/HiArt_2.0/source/code/java/libs/PS_Help.jar!/PS_Help.hs"
userInfo: java.lang.String = null
ref: java.lang.String = null
hostAddress: java.net.InetAddress = null
handler: java.net.URLStreamHandler = {sun.net.www.protocol.jar.Handler@2872}
hashCode: int = -1
specifyHandlerPerm: java.net.NetPermission = null
factory: java.net.URLStreamHandlerFactory = null
handlers: java.util.Hashtable = {java.util.Hashtable@2874}
streamHandlerLock: java.lang.Object = {java.lang.Object@2875}

helpPage: java.net.URL = {java.net.URL@2863}
serialVersionUID: long = -7627629688361524110
protocolPathProp: java.lang.String = "java.protocol.handler.pkgs"
protocol: java.lang.String = "jar"
host: java.lang.String = ""
port: int = -1
file: java.lang.String = "file:/C:/ClearCase/HiArt_2.0/source/code/java/libs/PS_Help.jar!/CommonTasks9.htm"
query: java.lang.String = null
authority: java.lang.String = null
path: java.lang.String = "file:/C:/ClearCase/HiArt_2.0/source/code/java/libs/PS_Help.jar!/CommonTasks9.htm"
userInfo: java.lang.String = null
ref: java.lang.String = "wp1001921"
hostAddress: java.net.InetAddress = null
handler: java.net.URLStreamHandler = {sun.net.www.protocol.jar.Handler@2872}
hashCode: int = -1
specifyHandlerPerm: java.net.NetPermission = null
factory: java.net.URLStreamHandlerFactory = null
handlers: java.util.Hashtable = {java.util.Hashtable@2874}
streamHandlerLock: java.lang.Object = {java.lang.Object@2875}

hb: javax.help.HelpBroker = {javax.help.DefaultHelpBroker@2864}
helpset: javax.help.HelpSet = null
frame: javax.swing.JFrame = null
jhelp: javax.help.JHelp = null
locale: java.util.Locale = null
font: java.awt.Font = null
dialog: javax.swing.JDialog = null
ownerWindow: java.awt.Window = null
modallyActivated: boolean = false
mw: javax.help.MainWindow = {javax.help.MainWindow@2865}
helpKeyHS: javax.help.HelpSet = null
helpKeyPresentation: java.lang.String = null
helpKeyPresentationName: java.lang.String = null
displayHelpFromFocus: java.awt.event.ActionListener = {javax.help.CSH$DisplayHelpFromFocus@2866}
displayHelpFromSource: java.awt.event.ActionListener = null
debug: boolean = false
class$javax$help$HelpSet: java.lang.Class = null
class$java$lang$String: java.lang.Class = null

brinkley
Offline
Joined: 2003-06-06
Points: 0

> Hi,
>
> I recently upgraded to JH2.0 release candidate,
> j2sdk1.4.1_02, on Win2000. Here's what's up:
>
> In the Java application the developers have created,
> there are two ways to display the helpset: you can
> press F1, or you can click on an html link, which is
> supposed to launch the helpset at the bookmarked
> page. Both of these methods worked fine in jdk
> 1.3.1/jh1.1.3. Now, however, you can only bring up
> the helpset by pressing F1. If you try to click the
> html link, no error messages show up in the debugger,
> but nothing happens.

What happens with jdk1.4.1 and jh 1.1.3? Same problem?

What do you mean by clik the html link?

Binky

gboyer
Offline
Joined: 2003-12-31
Points: 0

>What happens with jdk1.4.1 and jh 1.1.3? Same problem?
I don't know - I upgraded both at the same time, because I was running into search bugs with 1.1.3, so I was anxious to move up to jh2.0.

>What do you mean by clik the html link?

It's kind of hard to explain, but here goes: Our software application includes a JEditor Pane that displays some html text, which includes a hyperlink to a specific page in the helpset. The developer has added a HerperLinkListener to the JEditorPane, so that when the link is clicked, the HelpBroker gets called and the helpset is supposed to appear. Here's the relevant code; it hasn't changed since before the upgrade.

thanks,
gayle

whatsNextEditorPane.addHyperlinkListener( new HyperlinkListener( )
{
/**
* Called when a hypertext link is entered/exited/clicked on. This
* method will show context sensitive help relating to the whatsNext
* box on the top panel.
*/
public void hyperlinkUpdate(HyperlinkEvent e)
{
if(e.getEventType( ) != HyperlinkEvent.EventType.ACTIVATED)
{
return;
}
// The URL located in the hypertext link from the whatsNext
// html file is used to open the helpset to the appropriate
// context. The next few lines change the URL path from the
// creation directory to the correct build directory.
String url = e.getURL( ).toString();
int endOfPath = url.lastIndexOf("/");
String fileName = url.substring(endOfPath + 1);
HelpSet hs = getHelpSet();
URL base = hs.getHelpSetURL(); //location of helpset/
URL helpPage = null;

try
{
helpPage = new URL(base, fileName);
}
catch (MalformedURLException mue)
{
}

HelpBroker hb = getHelpBroker();
hb.setCurrentURL(helpPage);//show context sensitive help.
}
});

stephan
Offline
Joined: 2004-03-04
Points: 0

> there are two ways to display the helpset: you can
> press F1, or you can click on an html link, which is
> supposed to launch the helpset at the bookmarked
> page.

I'm not sure if I understand the question correctly.
Where can you click on an html link? In the content
pane of the JavaHelp browser? Are therefore the links
in the topic html files not working?

Stephan
--
[b]Software 7[/b] GmbH
*** [b]Helen 1.1[/b], the JavaHelp Authoring Tool ***
http://www.software7.biz