Skip to main content

HelpBroker.setCurrentURL() question about behavior under JavaHelp version 2

1 reply [Last post]
Anonymous

Hello,

Our Java application displays a small panel with brief instructions to
the user.

This small panel displays text in html with hyperlinks.

If the user wants to get more information, they can click on the
hyperlink. This opens the JavaHelp frame and displays context sensitive
help information to the user.

This used to work with JavaHelp version 1 jh.jar, but does not work with
version 2 jh.jar. (See below for further info on jh.jar versions.)

Below I also show the code that is used to activate JavaHelp from a
HyperLinkListener.
I also describe the previous behavior under JavaHelp version 1 and the
new
behavior that we see with JavaHelp version 2.

Any suggestions for how to modify our application's code so that we can
still have our old behavior under JavaHelp ver 2 would be appreciated.

Thank you,

Ted Hill

Here are the lines of code that used to bring up the JavaHelp frame with
the
correct information displayed:

--------------- start example ------------------------------

HelpBroker hb = getHelpBroker();
hb.setCurrentURL(myURL);

Here is a typical example of what myURL looks like:

jar:file:/C:/ClearCase/HiArt_2.1/source/code/java/libs/PS_Help.jar!/Comm
onTasks10.htm#wp1025454

---------------- end example -----------------------------

Here are the lines above in context showing how the URL is built, etc:

------------ start snippet -------------------------

whatsNextEditorPane.addHyperlinkListener( new HyperlinkListener()
{
/**
* Called when a hypertext link is clicked on. This
* method will show context sensitive help relating to the Next
* Steps box on the instructions 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 JavaHelp 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 our help
directory
URL helpPage = null;

try
{
helpPage = new URL(base, fileName);

System.out.println("helpPage.toString() = " +
helpPage.toString());
}
catch (MalformedURLException mue)
{
System.out.println("TopPanel.hyperlinkUpdate() EXECEPTION: "
+ mue.toString());
}

HelpBroker hb = getHelpBroker();
hb.setCurrentURL(helpPage); //Open JavaHelp frame showing cs
help
}
});

------------ end snippet -------------------------

A few observations comparing the 'old' behavior with the 'new'
behaviour:

Old Behavior:
=============

Whether or not the JavaHelp frame was available (either showing on top
of the application or hidden behind it),

1. clicking on the hyperlink would bring the JavaHelp frame to the front
giving it the focus, and

2. display the correct information.

New Behavior:
=============

A. If the JavaHelp frame is not available (neither showing on top
of the application nor hidden behind it), clicking on the hyperlink
does nothing, i.e. it does not bring up the JavaHelp frame.

B. If the JavaHelp frame is already available (either showing on top
of the application or hidden behind it),

1. clicking on the hyperlink will correctly update the display in the
JavaHelp frame, however

2. it will not give the JavaHelp frame focus, the application's
frame retains the focus.

Information on JavaHelp versions:

Info from current jh.jar manifest (doesn't work with this version):
===================================
Manifest-Version: 1.0
Extension-Name: javax.help
Specification-Vendor: Sun Microsystems, Inc
Implementation-Vendor-Id: com.sun
Created-By: 1.4.0 (Sun Microsystems Inc.)
Implementation-Vendor: Sun Microsystems, Inc
Specification-Version: 2.0
Implementation-Version: 2.0_01

Info from previous jh.jar manifoest (used to work with this version):
======================================
Manifest-Version: 1.0
Extension-Name: javax.help
Specification-Vendor: Sun Microsystems, Inc
Implementation-Vendor-Id: com.sun
Created-By: 1.4.0 (Sun Microsystems Inc.)
Implementation-Vendor: Sun Microsystems, Inc
Specification-Version: 1.0
Implementation-Version: 1.1.3

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

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.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Roger Brinkley

Ted Hill wrote:

> Hello,
>
>
> Our Java application displays a small panel with brief instructions to
> the user.
>
> This small panel displays text in html with hyperlinks.
>
> If the user wants to get more information, they can click on the
> hyperlink. This opens the JavaHelp frame and displays context sensitive
> help information to the user.
>
> This used to work with JavaHelp version 1 jh.jar, but does not work with
> version 2 jh.jar. (See below for further info on jh.jar versions.)
>
> Below I also show the code that is used to activate JavaHelp from a
> HyperLinkListener.
> I also describe the previous behavior under JavaHelp version 1 and the
> new
> behavior that we see with JavaHelp version 2.
>
> Any suggestions for how to modify our application's code so that we can
> still have our old behavior under JavaHelp ver 2 would be appreciated.
>

Looks to me like you need a hb.setDisplayed(true); after you do the
setCurrentURL.

binky

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

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.