Package javax.help

# Class JHelp

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

All Implemented Interfaces:
  `ImageObserver`, `MenuContainer`, `Serializable`, `EventListener`, `Accessible`, `HelpSetListener`

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

See Also:
  - Serialized Form

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected class`
`JHelp.AccessibleJHelp`
The class used to obtain the accessible role for this object.

## Nested classes/interfaces inherited from class javax.swing.JComponent

`JComponent.AccessibleJComponent`

## Nested classes/interfaces inherited from class java.awt.Container

`Container.AccessibleAWTContainer`

## Nested classes/interfaces inherited from class java.awt.Component

`Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected JHelpContentViewer`
`contentViewer`
`protected TextHelpModel`
`helpModel`
`protected HelpHistoryModel`
`historyModel`
`protected HelpSet.Presentation`
`hsPres`
`protected boolean`
`navDisplayed`
`protected Vector`
`navigators`
`protected boolean`
`toolbarDisplayed`

### Fields inherited from class javax.swing.JComponent

`listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

### Fields inherited from class java.awt.Component

`accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

### Fields inherited from interface java.awt.image.ImageObserver

`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

## Constructor Summary

Constructors
Constructor
Description
`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

Modifier and Type
Method
Description
`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.

### Methods inherited from class javax.swing.JComponent

`addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

### Methods inherited from class java.awt.Container

`add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree`

### Methods inherited from class java.awt.Component

`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### helpModel

protected TextHelpModel helpModel

### historyModel

protected HelpHistoryModel historyModel

### navigators

protected Vector navigators

### navDisplayed

protected boolean navDisplayed

### toolbarDisplayed

protected boolean toolbarDisplayed

### hsPres

protected HelpSet.Presentation hsPres

### contentViewer

protected JHelpContentViewer contentViewer

## Constructor Details

### 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 invalid input: '<'`history` is null it is the same as creating without HelpHistoryModel

## Method Details

### 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(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 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.

Overrides:
  `getUI` in class `JComponent`

### updateUI

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

Overrides:
  `updateUI` in class `JComponent`

### getUIClassID

public String getUIClassID()

Overrides:
  `getUIClassID` in class `JComponent`
Returns:
  "HelpUI"

### helpSetAdded

public void helpSetAdded(HelpSetEvent e)
Adds a new HelpSet to "our" HelpSet.

Specified by:
  `helpSetAdded` in interface `HelpSetListener`
Parameters:
  `e` - HelpSetEvent
See Also:
  - `HelpSetEvent`
  - `HelpSetListener`

### helpSetRemoved

public void helpSetRemoved(HelpSetEvent e)
Removes a HelpSet from "our" HelpSet.

Specified by:
  `helpSetRemoved` in interface `HelpSetListener`
Parameters:
  `e` - The event

### 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()

### 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.

### 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

### 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 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

### 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?
Since:
  2.0

### setToolbarDisplayed

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

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

### getContentViewer

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

### getAccessibleContext

public AccessibleContext getAccessibleContext()
Get the AccessibleContext associated with this JComponent.

Specified by:
  `getAccessibleContext` in interface `Accessible`
Overrides:
  `getAccessibleContext` in class `Component`
Returns:
  The AccessibleContext of this JComponent