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).
enableHelp
public void enableHelp(Component comp,
String id,
HelpSet hs)
Enables help for a component. This method sets a
component's helpID and HelpSet.
CSH.setHelpID
, CSH.setHelpSet
enableHelp
public void enableHelp(MenuItem comp,
String id,
HelpSet hs)
Enables help for a MenuItem. This method sets a
component's helpID and HelpSet.
CSH.setHelpID
, CSH.setHelpSet
enableHelpKey
public void enableHelpKey(Component comp,
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.
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(Component comp,
String id,
HelpSet hs,
String presentation,
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.
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.
enableHelpOnButton
public void enableHelpOnButton(Component comp,
String id,
HelpSet hs)
throws 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.
CSH.setHelpID
, CSH.setHelpSet
, javax.swing.AbstractButton
, java.awt.Button
enableHelpOnButton
public void enableHelpOnButton(MenuItem comp,
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.
CSH.setHelpID
, CSH.setHelpSet
, java.awt.MenuItem
enableHelpOnButton
public void enableHelpOnButton(Object obj,
String id,
HelpSet hs,
String presentation,
String presentationName)
throws 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.
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.
Presentation
, CSH.setHelpID
, CSH.setHelpSet
, javax.swing.AbstractButton
, java.awt.Button
getCurrentID
public Map.ID getCurrentID()
Determines The currently displayed ID (if any).
getCurrentURL
public URL getCurrentURL()
Determines the currently displayed ID.
getCurrentView
public String getCurrentView()
Gets name of the current navigational view.
- The name of the current navigational view.
getFont
public Font getFont()
Gets the font for this HelpBroker.
getHelpSet
public HelpSet getHelpSet()
Gets the current HelpSet for this JavaHelp object.
- The HelpSet this JavaHelp is presenting.
getLocale
public Locale getLocale()
Returns the locale of this object.
- The locale of this object.
getLocation
public Point getLocation()
throws UnsupportedOperationException
Gets the location of the presentation.
This operation may throw an UnsupportedOperationException if the
underlying implementation does not allow this.
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.
getSize
public Dimension getSize()
throws UnsupportedOperationException
Gets the size of the presentation.
This operation may throw an UnsupportedOperationException if the
underlying implementation does not allow this.
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.
isDisplayed
public boolean isDisplayed()
Determines if the presentation is visible.
- Whether the presentation is currently visible.
isViewDisplayed
public boolean isViewDisplayed()
Determines if the Navigational View is visible.
- Whether the navigational views are visible.
setCurrentID
public void setCurrentID(String id)
throws BadIDException
Displays this ID.
HelpVisitListeners are notified.
id
- A String identifying the topic to show relative to getHelpSet()
setCurrentURL
public void setCurrentURL(URL url)
Displays this ID.
HelpVisitListeners are notified.
The currentID changes if there is a matching ID for this URL.
setCurrentView
public void setCurrentView(String name)
Activates the Navigator view with a given name.
setDisplayed
public void setDisplayed(boolean displayed)
throws UnsupportedOperationException
Displays the presentation to the user.
displayed
- Makes the presentation visible or not.
setFont
public void setFont(Font f)
Sets the font for this HelpBroker.
setHelpSet
public void setHelpSet(HelpSet hs)
Sets the current HelpSet for this HelpBroker.
hs
- 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.
hsPres
- The HelpSet.Presentation
setLocale
public void setLocale(Locale l)
Sets the locale of this HelpBroker.
l
- The locale to become this component's locale.
setLocation
public void setLocation(Point p)
throws UnsupportedOperationException
Sets the position of the presentation.
This operation may throw an UnsupportedOperationException if the
underlying implementation does not allow this.
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.
setSize
public void setSize(Dimension d)
throws UnsupportedOperationException
Sets the size of the presentation.
This operation may throw an UnsupportedOperationException if the
underlying implementation does not allow this.
setViewDisplayed
public void setViewDisplayed(boolean displayed)
Hides/Shows Navigational Views.
displayed
- Make the navigational views visible or not.
showID
public void showID(String id,
String presentation,
String presentationName)
throws BadIDException
Displays this ID in a particular presentation
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.
showID
public void showID(Map.ID id,
String presentation,
String presentationName)
throws InvalidHelpSetContextException
Displays this ID in a given presentation
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.