Class javax.help.JHelp

java.lang.Object
    |
    +----java.awt.Component
            |
            +----java.awt.Container
                    |
                    +----javax.swing.JComponent
                            |
                            +----javax.help.JHelp

public class JHelp
extends javax.swing.JComponent
implements HelpSetListener, javax.accessibility.Accessible
Displays HelpSet data with navigators and a content viewer.


helpModel

protected TextHelpModel helpModel

historyModel

protected HelpHistoryModel historyModel

navigators

protected java.util.Vector navigators

navDisplayed

protected boolean navDisplayed

toolbarDisplayed

protected boolean toolbarDisplayed

hsPres

protected HelpSet.Presentation hsPres

contentViewer

protected JHelpContentViewer contentViewer

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()
Create a JHelp component without a TextHelpModel.

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 <history is null it is the same as creating without HelpHistoryModel

setupNavigators

protected void setupNavigators()

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.

getModel

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

getHistoryModel

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

setHelpSetPresentation

public void setHelpSetPresentation(HelpSet.Presentation hsPres)
Set the HelpSet.Presentation.
See Also:
HelpSet.Presentation

getHelpSetPresentation

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

setHelpSetSpec

public void setHelpSetSpec(java.lang.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

getHelpSetURL

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

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.

getUI

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

updateUI

public void updateUI()
Replaces the UI with the latest version from the default UIFactory.
Overrides:
updateUI in class javax.swing.JComponent

getUIClassID

public java.lang.String getUIClassID()
Returns:
"HelpUI"
Overrides:
getUIClassID in class javax.swing.JComponent

helpSetAdded

public void helpSetAdded(HelpSetEvent e)
Adds a new HelpSet to "our" HelpSet.
Implements:
helpSetAdded in interface HelpSetListener
Parameters:
e - HelpSetEvent
See Also:
HelpSetEvent, HelpSetListener

helpSetRemoved

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

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,
                         java.lang.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()

setCurrentID

public void setCurrentID(java.lang.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.

setCurrentURL

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

setCurrentURL

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

getSelectedItems

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

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.

removeHelpNavigator

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

getHelpNavigators

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

setCurrentNavigator

public void setCurrentNavigator(JHelpNavigator navigator)
Sets the current navigator in the HelpUI.
Parameters:
navigator - The navigator
Throws:
throws - InvalidNavigatorException if not a one of HELPUI navigators.

getCurrentNavigator

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

setNavigatorDisplayed

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

isNavigatorDisplayed

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

setToolbarDisplayed

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

isToolbarDisplayed

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

getContentViewer

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

getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Get the AccessibleContext associated with this JComponent.
Implements:
getAccessibleContext in interface javax.accessibility.Accessible
Returns:
The AccessibleContext of this JComponent
Overrides:
getAccessibleContext in class javax.swing.JComponent