javax.help
Interface HelpBroker

All Known Implementing Classes:
DefaultHelpBroker, ServletHelpBroker

public interface HelpBroker

The HelpBroker is the default presentation of a HelpSet. A HelpBroker is an abstraction of the presentation for a HelpSet; a straight-forward implementation is a JHelp() on the HelpSet. A HelpBroker can be asked to show a given Navigational View, and can display a given ID (help topic).

See Also:
HelpSet, JHelpNavigator, javax.help.HelpVisitListener

Method Summary
 void enableHelp(java.awt.Component comp, java.lang.String id, HelpSet hs)
          Enables help for a component.
 void enableHelp(java.awt.MenuItem comp, java.lang.String id, HelpSet hs)
          Enables help for a MenuItem.
 void enableHelpKey(java.awt.Component comp, java.lang.String id, HelpSet hs)
          Enables the Help key on a component.
 void enableHelpKey(java.awt.Component comp, java.lang.String id, HelpSet hs, java.lang.String presentation, java.lang.String presentationName)
          Enables the Help key on a component.
 void enableHelpOnButton(java.awt.Component comp, java.lang.String id, HelpSet hs)
          Enables help for a component.
 void enableHelpOnButton(java.awt.MenuItem comp, java.lang.String id, HelpSet hs)
          Enables help for a MenuItem.
 void enableHelpOnButton(java.lang.Object obj, java.lang.String id, HelpSet hs, java.lang.String presentation, java.lang.String presentationName)
          Enables help for an object.
 Map.ID getCurrentID()
          Determines The currently displayed ID (if any).
 java.net.URL getCurrentURL()
          Determines the currently displayed ID.
 java.lang.String getCurrentView()
          Gets name of the current navigational view.
 java.awt.Font getFont()
          Gets the font for this HelpBroker.
 HelpSet getHelpSet()
          Gets the current HelpSet for this JavaHelp object.
 java.util.Locale getLocale()
          Returns the locale of this object.
 java.awt.Point getLocation()
          Gets the location of the presentation.
 int getScreen()
          Get ths the screen the presentation is displayed on This operation may throw an UnsupportedOperationException if the underlying implementation does not allow this.
 java.awt.Dimension getSize()
          Gets the size of the presentation.
 void initPresentation()
          Initializes the presentation.
 boolean isDisplayed()
          Determines if the presentation is visible.
 boolean isViewDisplayed()
          Determines if the Navigational View is visible.
 void setCurrentID(Map.ID id)
          Displays this ID.
 void setCurrentID(java.lang.String id)
          Displays this ID.
 void setCurrentURL(java.net.URL url)
          Displays this ID.
 void setCurrentView(java.lang.String name)
          Activates the Navigator view with a given name.
 void setDisplayed(boolean displayed)
          Displays the presentation to the user.
 void setFont(java.awt.Font f)
          Sets the font for this HelpBroker.
 void setHelpSet(HelpSet hs)
          Sets the current HelpSet for this HelpBroker.
 void setHelpSetPresentation(HelpSet.Presentation hsPres)
          Sets the presentation attributes from a HelpSet.Presentation.
 void setLocale(java.util.Locale l)
          Sets the locale of this HelpBroker.
 void setLocation(java.awt.Point p)
          Sets the position of the presentation.
 void setScreen(int screen)
          Set the screen the presentation is to be displayed on This operation may throw an UnsupportedOperationException if the underlying implementation does not allow this.
 void setSize(java.awt.Dimension d)
          Sets the size of the presentation.
 void setViewDisplayed(boolean displayed)
          Hides/Shows Navigational Views.
 void showID(Map.ID id, java.lang.String presentation, java.lang.String presentationName)
          Displays this ID in a given presentation
 void showID(java.lang.String id, java.lang.String presentation, java.lang.String presentationName)
          Displays this ID in a particular presentation
 

Method Detail

setHelpSet

public void setHelpSet(HelpSet hs)
Sets the current HelpSet for this HelpBroker.

Parameters:
hs - The HelpSet this JavaHelp is presenting.

getHelpSet

public HelpSet getHelpSet()
Gets the current HelpSet for this JavaHelp object.

Returns:
The HelpSet this JavaHelp is presenting.

setHelpSetPresentation

public void setHelpSetPresentation(HelpSet.Presentation hsPres)
Sets the presentation attributes from a HelpSet.Presentation. The HelpSet.Presentation must be in the current HelpSet.

Parameters:
hsPres - The HelpSet.Presentation
Since:
2.0

getLocale

public java.util.Locale getLocale()
Returns the locale of this object.

Returns:
The locale of this object.

setLocale

public void setLocale(java.util.Locale l)
Sets the locale of this HelpBroker.

Parameters:
l - The locale to become this component's locale.
See Also:
getLocale()

getFont

public java.awt.Font getFont()
Gets the font for this HelpBroker.


setFont

public void setFont(java.awt.Font f)
Sets the font for this HelpBroker.


setCurrentView

public void setCurrentView(java.lang.String name)
Activates the Navigator view with a given name.

Throws:
java.lang.IllegalArgumentException - if the name is not valid.

getCurrentView

public java.lang.String getCurrentView()
Gets name of the current navigational view.

Returns:
The name of the current navigational view.

initPresentation

public void initPresentation()
Initializes the presentation. This method allows the presentation to be initialized but not displayed. Typically this is done in a separate thread to reduce the intialization time.


setDisplayed

public void setDisplayed(boolean displayed)
                  throws UnsupportedOperationException
Displays the presentation to the user.

Parameters:
displayed - Makes the presentation visible or not.
Throws:
HelpBroker.UnsupportedOperationException - If the operation is not supported.
UnsupportedOperationException

isDisplayed

public boolean isDisplayed()
Determines if the presentation is visible.

Returns:
Whether the presentation is currently visible.

setLocation

public void setLocation(java.awt.Point p)
                 throws UnsupportedOperationException
Sets the position of the presentation. This operation may throw an UnsupportedOperationException if the underlying implementation does not allow this.

UnsupportedOperationException

getLocation

public java.awt.Point getLocation()
                           throws UnsupportedOperationException
Gets the location of the presentation. This operation may throw an UnsupportedOperationException if the underlying implementation does not allow this.

UnsupportedOperationException

setSize

public void setSize(java.awt.Dimension d)
             throws UnsupportedOperationException
Sets the size of the presentation. This operation may throw an UnsupportedOperationException if the underlying implementation does not allow this.

UnsupportedOperationException

getSize

public java.awt.Dimension getSize()
                           throws UnsupportedOperationException
Gets the size of the presentation. This operation may throw an UnsupportedOperationException if the underlying implementation does not allow this.

UnsupportedOperationException

setScreen

public void setScreen(int screen)
               throws UnsupportedOperationException
Set the screen the presentation is to be displayed on This operation may throw an UnsupportedOperationException if the underlying implementation does not allow this.

UnsupportedOperationException

getScreen

public int getScreen()
              throws UnsupportedOperationException
Get ths the screen the presentation is displayed on This operation may throw an UnsupportedOperationException if the underlying implementation does not allow this.

UnsupportedOperationException

setViewDisplayed

public void setViewDisplayed(boolean displayed)
Hides/Shows Navigational Views.

Parameters:
displayed - Make the navigational views visible or not.

isViewDisplayed

public boolean isViewDisplayed()
Determines if the Navigational View is visible.

Returns:
Whether the navigational views are visible.

showID

public void showID(Map.ID id,
                   java.lang.String presentation,
                   java.lang.String presentationName)
            throws InvalidHelpSetContextException
Displays this ID in a given presentation

Parameters:
id - An ID that identifies the topic to display.
presentation - The Presentation class to display the Help in.
presentationName - The name of a Presentation section from a HelpSet to use. For some Presentations this will also be the name to apply to the Presentation.
Throws:
InvalidHelpSetContextException - If id.hs is not contanied in the current HelpSet of this broker.
See Also:
Presentation

showID

public void showID(java.lang.String id,
                   java.lang.String presentation,
                   java.lang.String presentationName)
            throws BadIDException
Displays this ID in a particular presentation

Parameters:
id - A String identifying the topic to show relative to getHelpSet()
presentation - The Presentation class to display the Help in.
presentationName - The name of a Presentation section from a HelpSet to use. For some Presentations this will also be the name to apply to the Presentation.
Throws:
BadIDException - if the ID is not valid in the map.
See Also:
Presentation

setCurrentID

public void setCurrentID(Map.ID id)
                  throws InvalidHelpSetContextException
Displays this ID.

Parameters:
id - An ID that identifies the topic to display.
Throws:
InvalidHelpSetContextException - If id.hs is not contanied in the current HelpSet of this broker.
See Also:
HelpModel.setCurrentID(javax.help.Map.ID)

setCurrentID

public void setCurrentID(java.lang.String id)
                  throws BadIDException
Displays this ID. HelpVisitListeners are notified.

Parameters:
id - A String identifying the topic to show relative to getHelpSet()
Throws:
BadIDException - if the ID is not valid in the map.

getCurrentID

public Map.ID getCurrentID()
Determines The currently displayed ID (if any).

Returns:
The ID being shown.

setCurrentURL

public void setCurrentURL(java.net.URL url)
Displays this ID. HelpVisitListeners are notified. The currentID changes if there is a matching ID for this URL.

Parameters:
url - The URL to show

getCurrentURL

public java.net.URL getCurrentURL()
Determines the currently displayed ID.

Returns:
The URL being shown.

enableHelpKey

public void enableHelpKey(java.awt.Component comp,
                          java.lang.String id,
                          HelpSet hs)
Enables the Help key on a component. This method works best when the component is the rootPane of a JFrame in Swing implementations, or a java.awt.Window (or subclass thereof) in AWT implementations. This method sets the default helpID and HelpSet for the component and registers keyboard actions to trap the "Help" keypress. When the "Help" key is pressed, if the object with the current focus has a helpID, the helpID is displayed, otherwise the default helpID is displayed.

Parameters:
comp - The component to enable the keyboard actions on.
id - The default HelpID to be displayed.
hs - The default HelpSet to be displayed.

enableHelpKey

public void enableHelpKey(java.awt.Component comp,
                          java.lang.String id,
                          HelpSet hs,
                          java.lang.String presentation,
                          java.lang.String presentationName)
Enables the Help key on a component. This method works best when the component is the rootPane of a JFrame in Swing implementations, or a java.awt.Window (or subclass thereof) in AWT implementations. This method sets the default helpID and HelpSet for the component and registers keyboard actions to trap the "Help" keypress. When the "Help" key is pressed, if the object with the current focus has a helpID, the helpID is displayed, otherwise the default helpID is displayed.

Parameters:
comp - The component to enable the keyboard actions on.
id - The default HelpID to be displayed.
hs - The default HelpSet to be displayed.
presentation - The Presentation class to display the Help in.
presentationName - The name of a Presentation section from a HelpSet to use. For some Presentations this will also be the name to apply to the Presentation.
See Also:
Presentation

enableHelp

public void enableHelp(java.awt.Component comp,
                       java.lang.String id,
                       HelpSet hs)
Enables help for a component. This method sets a component's helpID and HelpSet.

See Also:
CSH.setHelpID, CSH.setHelpSet

enableHelp

public void enableHelp(java.awt.MenuItem comp,
                       java.lang.String id,
                       HelpSet hs)
Enables help for a MenuItem. This method sets a component's helpID and HelpSet.

See Also:
CSH.setHelpID, CSH.setHelpSet

enableHelpOnButton

public void enableHelpOnButton(java.awt.Component comp,
                               java.lang.String id,
                               HelpSet hs)
                        throws java.lang.IllegalArgumentException
Enables help for a component. This method sets a component's helpID and HelpSet and adds an ActionListener. When an action is performed it displays the component's helpID and HelpSet in the default viewer. If the component is not a javax.swing.AbstractButton or a java.awt.Button an IllegalArgumentException is thrown.

java.lang.IllegalArgumentException
See Also:
CSH.setHelpID, CSH.setHelpSet, AbstractButton, Button

enableHelpOnButton

public void enableHelpOnButton(java.awt.MenuItem comp,
                               java.lang.String id,
                               HelpSet hs)
Enables help for a MenuItem. This method sets a component's helpID and HelpSet and adds an ActionListener. When an action is performed it displays the component's helpID and HelpSet in the default viewer.

See Also:
CSH.setHelpID, CSH.setHelpSet, MenuItem

enableHelpOnButton

public void enableHelpOnButton(java.lang.Object obj,
                               java.lang.String id,
                               HelpSet hs,
                               java.lang.String presentation,
                               java.lang.String presentationName)
                        throws java.lang.IllegalArgumentException
Enables help for an object. This method sets a object's helpID and HelpSet and adds an ActionListener. When an action is performed it displays the component's helpID and HelpSet in the default viewer or the presenation if defined. If the component is not a javax.swing.AbstractButton or a java.awt.Button an IllegalArgumentException is thrown.

Parameters:
id - The default HelpID to be displayed.
hs - The default HelpSet to be displayed.
presentation - The Presentation class to display the Help in.
presentationName - The name of a Presentation section from a HelpSet to use. For some Presentations this will also be the name to apply to the Presentation.
java.lang.IllegalArgumentException
See Also:
Presentation, CSH.setHelpID, CSH.setHelpSet, AbstractButton, Button