org.openide.util
Class HelpCtx

java.lang.Object
  |
  +--org.openide.util.HelpCtx

public final class HelpCtx
extends Object

Provides help for any window or other feature in the system. It is designed to be JavaHelp-compatible and to use the same tactics when assigning help to JComponent instances.


Field Summary
static HelpCtx DEFAULT_HELP
          Default help page.
 
Constructor Summary
HelpCtx(Class clazz)
          Create a help context by class.
HelpCtx(String helpID)
          Create a help context by tag.
HelpCtx(URL helpCtx)
          Deprecated. Does not work nicely with JavaHelp.
 
Method Summary
 boolean equals(Object o)
           
static HelpCtx findHelp(Component comp)
          Find the help ID for a component.
 URL getHelp()
          Get a URL to the help page, if applicable.
 String getHelpID()
          Get the ID of the help page, if applicable.
 int hashCode()
           
static void setHelpIDString(JComponent comp, String helpID)
          Set the help ID for a component.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_HELP

public static final HelpCtx DEFAULT_HELP
Default help page. This (hopefully) points to a note explaining to the user that no help is available. Precisely, the Help ID is set to org.openide.util.HelpCtx.DEFAULT_HELP.
Constructor Detail

HelpCtx

public HelpCtx(URL helpCtx)
Deprecated. Does not work nicely with JavaHelp.

Create a help context by URL.
Parameters:
helpCtx - URL to point help to

HelpCtx

public HelpCtx(String helpID)
Create a help context by tag. You must provide an ID of the desired help for the item. The ID should refer to an already installed help; this can be easily installed by specifying a JavaHelp help set for the module (see the Modules API for details).
Parameters:
helpID - the JavaHelp ID of the help

HelpCtx

public HelpCtx(Class clazz)
Create a help context by class. Assigns the name of a class as the ID.
Parameters:
clazz - the class to take the name from
Method Detail

getHelp

public URL getHelp()
Get a URL to the help page, if applicable.
Returns:
a URL to the page, or null if the target was specified by ID

getHelpID

public String getHelpID()
Get the ID of the help page, if applicable.
Returns:
the JavaHelp ID string, or null if specified by URL

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

setHelpIDString

public static void setHelpIDString(JComponent comp,
                                   String helpID)
Set the help ID for a component.
Parameters:
comp - the visual component to associate help to
helpID - help ID, or null if the help ID should be removed

findHelp

public static HelpCtx findHelp(Component comp)
Find the help ID for a component. If the component is a top component, then TopComponent.getHelpCtx() is called. If the component has help attached by setHelpIDString(javax.swing.JComponent, java.lang.String), it returns that. Otherwise it checks the parent component recursively.
Parameters:
comp - the component to find help for
Returns:
the help for that component (never null)


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.