javax.help

Class JHelp

Implemented Interfaces:
Accessible, java.util.EventListener, HelpSetListener

public class JHelp
extends JComponent
implements HelpSetListener, Accessible

Displays HelpSet data with navigators and a content viewer.

Nested Class Summary

protected class
JHelp.AccessibleJHelp
The class used to obtain the accessible role for this object.

Field Summary

protected JHelpContentViewer
contentViewer
protected TextHelpModel
helpModel
protected HelpHistoryModel
historyModel
protected HelpSet.Presentation
hsPres
protected boolean
navDisplayed
protected Vector
navigators
protected boolean
toolbarDisplayed

Constructor Summary

JHelp()
Create a JHelp component without a TextHelpModel.
JHelp(HelpSet hs)
Create a JHelp with a JHelpContentViewer and all Navigators requested in the HelpSet.
JHelp(TextHelpModel model)
Create a JHelp using the TextHelpModel.
JHelp(TextHelpModel model, HelpHistoryModel history, HelpSet.Presentation hsPres)
Create a JHelp using the TextHelpModel and HelpHistoryModel

Method Summary

void
addHelpNavigator(JHelpNavigator navigator)
A JHelp can have a number of navigators.
AccessibleContext
getAccessibleContext()
Get the AccessibleContext associated with this JComponent.
JHelpContentViewer
getContentViewer()
Retrieves what is the current content viewer Read-Only property?
JHelpNavigator
getCurrentNavigator()
Enumeration
getHelpNavigators()
HelpSet.Presentation
getHelpSetPresentation()
URL
getHelpSetURL()
HelpHistoryModel
getHistoryModel()
Returns The HelpHistoryModel
TextHelpModel
getModel()
TreeItem[]
getSelectedItems()
Returns a list of selected items from the current navigator
HelpUI
getUI()
Returns the HelpUI that is providing the current look and feel.
String
getUIClassID()
void
helpSetAdded(HelpSetEvent e)
Adds a new HelpSet to "our" HelpSet.
void
helpSetRemoved(HelpSetEvent e)
Removes a HelpSet from "our" HelpSet.
boolean
isNavigatorDisplayed()
Determines if the Navigators are hidden/displayed in the HelpUI.
boolean
isToolbarDisplayed()
Determines if the Navigators are hidden/displayed in the HelpUI.
void
removeHelpNavigator(JHelpNavigator navigator)
Removes a navigator.
void
setCurrentID(String id)
Convenience version of the above.
void
setCurrentID(Map.ID id)
Visits a given ID.
void
setCurrentID(Map.ID id, String historyName, JHelpNavigator navigator)
Visits a given ID.
void
setCurrentNavigator(JHelpNavigator navigator)
Sets the current navigator in the HelpUI.
void
setCurrentURL(URL url)
Visits a given URL.
void
setCurrentURL(URL url, String historyName, JHelpNavigator navigator)
Visits a given URL.
void
setHelpSetPresentation(HelpSet.Presentation hsPres)
Set the HelpSet.Presentation.
void
setHelpSetSpec(String spec)
Set the URL to the HelpSet.
void
setModel(TextHelpModel newModel)
Sets the HelpModel that provides the data.
void
setNavigatorDisplayed(boolean displayed)
Hidess/Displays the Navigators in the HelpUI.
void
setToolbarDisplayed(boolean displayed)
Hidess/Displays the Toolbar in the HelpUI.
void
setUI(HelpUI ui)
Sets the HelpUI that will provide the current look and feel.
protected void
setupNavigators()
void
updateUI()
Replaces the UI with the latest version from the default UIFactory.

Field Details

contentViewer

protected JHelpContentViewer contentViewer

helpModel

protected TextHelpModel helpModel

historyModel

protected HelpHistoryModel historyModel

hsPres

protected HelpSet.Presentation hsPres

navDisplayed

protected boolean navDisplayed

navigators

protected Vector navigators

toolbarDisplayed

protected boolean toolbarDisplayed

Constructor Details

JHelp

public JHelp()
Create a JHelp component without a TextHelpModel.

JHelp

public JHelp(HelpSet hs)
Create a JHelp with a JHelpContentViewer and all Navigators requested in the HelpSet.
Parameters:
hs - The HelpSet. If hs is null the JHelp is created with a TextHelpModel with no HelpSet.

JHelp

public JHelp(TextHelpModel model)
Create a JHelp using the TextHelpModel.
Parameters:
model - A model to use for the content and all the navigators. If model is null it is the same as creating without a TextHelpModel

JHelp

public JHelp(TextHelpModel model,
             HelpHistoryModel history,
             HelpSet.Presentation hsPres)
Create a JHelp using the TextHelpModel and HelpHistoryModel
Parameters:
model - A model to use for the content and all the navigators. If model is null it is the same as creating without a TextHelpModel
history - A history model. If <<tt>history is null it is the same as creating without HelpHistoryModel

Method Details

addHelpNavigator

public void addHelpNavigator(JHelpNavigator navigator)
A JHelp can have a number of navigators. One of navigators is active. How they are presented depends on the UI, but they may be a collection of tabs, with the active tab being at the front.
Each navigator listens to changes to the HelpModel. A navigator can also tell the model to change--the change is propagated to the other navigators, this component, and the content viewer if they all use the same HelpModel instance.
Parameters:
navigator - The Navigator to explicitly add to the JHelp.

getAccessibleContext

public AccessibleContext getAccessibleContext()
Get the AccessibleContext associated with this JComponent.
Returns:
The AccessibleContext of this JComponent

getContentViewer

public JHelpContentViewer getContentViewer()
Retrieves what is the current content viewer Read-Only property?

getCurrentNavigator

public JHelpNavigator getCurrentNavigator()
Returns:
The current navigator in the HelpUI

getHelpNavigators

public Enumeration getHelpNavigators()
Returns:
An Enumeration of HelpNavigators in the HelpUI.

getHelpSetPresentation

public HelpSet.Presentation getHelpSetPresentation()
Returns:
The HelpSet.Presentation.

getHelpSetURL

public URL getHelpSetURL()
Returns:
The URL to the HelpSet.

getHistoryModel

public HelpHistoryModel getHistoryModel()
Returns The HelpHistoryModel
Returns:
The HelpHistoryModel which provides history data

getModel

public TextHelpModel getModel()
Returns:
The HelpModel that is providing the data.

getSelectedItems

public TreeItem[] getSelectedItems()
Returns a list of selected items from the current navigator

getUI

public HelpUI getUI()
Returns the HelpUI that is providing the current look and feel.

getUIClassID

public String getUIClassID()
Returns:
"HelpUI"

helpSetAdded

public void helpSetAdded(HelpSetEvent e)
Adds a new HelpSet to "our" HelpSet.
Specified by:
helpSetAdded in interface HelpSetListener
Parameters:
e - HelpSetEvent

helpSetRemoved

public void helpSetRemoved(HelpSetEvent e)
Removes a HelpSet from "our" HelpSet.
Specified by:
helpSetRemoved in interface HelpSetListener

isNavigatorDisplayed

public boolean isNavigatorDisplayed()
Determines if the Navigators are hidden/displayed in the HelpUI.
Returns:
Are the navigators displayed?
Since:
2.0

isToolbarDisplayed

public boolean isToolbarDisplayed()
Determines if the Navigators are hidden/displayed in the HelpUI.
Returns:
is the toolbar displayed?
Since:
2.0

removeHelpNavigator

public void removeHelpNavigator(JHelpNavigator navigator)
Removes a navigator.
Parameters:
navigator - The Navigator to explicitly add to the JHelp.

setCurrentID

public void setCurrentID(String id)
            throws BadIDException
Convenience version of the above. The implicit HelpSet is the current HelpSet.
Parameters:
id - The String to visit. Null id is valid for TextHelpModel.setCurrentID.
Throws:
BadIDException - if the string is not in the map for the HelpSet.

setCurrentID

public void setCurrentID(Map.ID id)
            throws InvalidHelpSetContextException
Visits a given ID. Propagates down into the model.
Parameters:
id - The ID to visit. Null id is valid for TextHelpModel.setCurrentID.
Throws:
InvalidHelpSetContextException - if id.hs is not contained in getHelpSet()

setCurrentID

public void setCurrentID(Map.ID id,
                         String historyName,
                         JHelpNavigator navigator)
            throws InvalidHelpSetContextException
Visits a given ID. Propagates down into the model.
Parameters:
id - The ID to visit. Null id is valid for TextHelpModel.setCurrentID.
historyName - The name for history entry
navigator - The JHelpNavigator
Throws:
InvalidHelpSetContextException - if id.hs is not contained in getHelpSet()

setCurrentNavigator

public void setCurrentNavigator(JHelpNavigator navigator)
Sets the current navigator in the HelpUI.
Parameters:
navigator - The navigator

setCurrentURL

public void setCurrentURL(URL url)
Visits a given URL. Propagates down into the model.
Parameters:
url - The URL to visit

setCurrentURL

public void setCurrentURL(URL url,
                          String historyName,
                          JHelpNavigator navigator)
Visits a given URL. Propagates down into the model.
Parameters:
url - The URL to visit

setHelpSetPresentation

public void setHelpSetPresentation(HelpSet.Presentation hsPres)
Set the HelpSet.Presentation.

setHelpSetSpec

public void setHelpSetSpec(String spec)
Set the URL to the HelpSet. This forces the HelpSet to be reloaded.
Parameters:
spec - Where to locate the HelpSet. A null spec is valid

setModel

public void setModel(TextHelpModel newModel)
Sets the HelpModel that provides the data.
Parameters:
newModel - The new Model. If newModel is null the internal model is set to null.

setNavigatorDisplayed

public void setNavigatorDisplayed(boolean displayed)
Hidess/Displays the Navigators in the HelpUI.

setToolbarDisplayed

public void setToolbarDisplayed(boolean displayed)
Hidess/Displays the Toolbar in the HelpUI.
Since:
2.0

setUI

public void setUI(HelpUI ui)
Sets the HelpUI that will provide the current look and feel.
Parameters:
ui - The HelpUI to set for this component. A null value for ui is valid.

setupNavigators

protected void setupNavigators()

updateUI

public void updateUI()
Replaces the UI with the latest version from the default UIFactory.