Package javax.help
Class ServletHelpBroker
- java.lang.Object
-
- javax.help.ServletHelpBroker
-
- All Implemented Interfaces:
HelpBroker
public class ServletHelpBroker extends java.lang.Object implements HelpBroker
An implmentation of the HelpBroker interface for Servlets
-
-
Field Summary
Fields Modifier and Type Field Description protected NavigatorView
curNav
protected java.awt.Font
font
protected HelpSet
helpset
protected java.util.Locale
locale
protected DefaultHelpModel
model
protected boolean
viewDisplayed
-
Constructor Summary
Constructors Constructor Description ServletHelpBroker()
Zero-argument constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 which ID is displayed (if any).NavigatorView
getCurrentNavigatorView()
Returns the current navigator as a NavigatorView.java.net.URL
getCurrentURL()
Determines which URL is displayed.java.lang.String
getCurrentView()
Determines the current navigator.java.awt.Font
getFont()
Gets the font for this HelpBroker.HelpSet
getHelpSet()
Returns the default HelpSetjava.util.Locale
getLocale()
Gets the locale of this component.java.awt.Point
getLocation()
Requests the location of the presentation.int
getScreen()
Requests the screen of the presentation.java.awt.Dimension
getSize()
Requests the size of the presentation.void
initPresentation()
Initializes the presentation.boolean
isDisplayed()
Determines if the presentation is displayed.boolean
isViewDisplayed()
Determines if the current view is visible.void
setCurrentID(java.lang.String id)
Shows this ID as content relative to the (top) HelpSet for the HelpBroker instance--HelpVisitListeners are notified.void
setCurrentID(Map.ID id)
Displays this ID--HelpVisitListeners are notified.void
setCurrentURL(java.net.URL url)
Displays this URL.void
setCurrentView(java.lang.String name)
Set the currentView to the navigator with the same name as the name parameter.void
setDisplayed(boolean b)
Displays the presentation to the user.void
setFont(java.awt.Font f)
Sets the font for this this HelpBroker.void
setHelpSet(HelpSet hs)
Changes the HelpSet for this broker.void
setHelpSetPresentation(HelpSet.Presentation pres)
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)
Requests the presentation be located at a given position.void
setScreen(int screen)
Requests the presentation be set to a given screen.void
setSize(java.awt.Dimension d)
Requests the presentation be set to a given size.void
setViewDisplayed(boolean displayed)
Hides/Shows view.void
showID(java.lang.String id, java.lang.String presentation, java.lang.String presentationName)
Displays this ID in a particular presentationvoid
showID(Map.ID id, java.lang.String presentation, java.lang.String presentationName)
Displays this ID in a given presentation
-
-
-
Field Detail
-
helpset
protected HelpSet helpset
-
model
protected DefaultHelpModel model
-
curNav
protected NavigatorView curNav
-
viewDisplayed
protected boolean viewDisplayed
-
locale
protected java.util.Locale locale
-
font
protected java.awt.Font font
-
-
Method Detail
-
getHelpSet
public HelpSet getHelpSet()
Returns the default HelpSet- Specified by:
getHelpSet
in interfaceHelpBroker
- Returns:
- The HelpSet this JavaHelp is presenting.
-
setHelpSet
public void setHelpSet(HelpSet hs)
Changes the HelpSet for this broker.- Specified by:
setHelpSet
in interfaceHelpBroker
- Parameters:
hs
- The HelpSet to set for this broker. A null hs is valid parameter.
-
getLocale
public java.util.Locale getLocale()
Gets the locale of this component.- Specified by:
getLocale
in interfaceHelpBroker
- Returns:
- This component's locale. If this component does not have a locale, the defaultLocale is returned.
- See Also:
setLocale(java.util.Locale)
-
setLocale
public void setLocale(java.util.Locale l)
Sets the locale of this HelpBroker. The locale is propagated to the presentation.- Specified by:
setLocale
in interfaceHelpBroker
- Parameters:
l
- The locale to become this component's locale. A null locale is the same as the defaultLocale.- See Also:
getLocale()
-
getFont
public java.awt.Font getFont()
Gets the font for this HelpBroker.- Specified by:
getFont
in interfaceHelpBroker
-
setFont
public void setFont(java.awt.Font f)
Sets the font for this this HelpBroker.- Specified by:
setFont
in interfaceHelpBroker
- Parameters:
f
- The font.
-
setCurrentView
public void setCurrentView(java.lang.String name)
Set the currentView to the navigator with the same name as the name parameter.- Specified by:
setCurrentView
in interfaceHelpBroker
- Parameters:
name
- The name of the navigator to set as the current view. If nav is null or not a valid Navigator in this HelpBroker then an IllegalArgumentException is thrown.- Throws:
java.lang.IllegalArgumentException
- if nav is null or not a valid Navigator.
-
getCurrentView
public java.lang.String getCurrentView()
Determines the current navigator.- Specified by:
getCurrentView
in interfaceHelpBroker
- Returns:
- The name of the current navigational view.
-
getCurrentNavigatorView
public NavigatorView getCurrentNavigatorView()
Returns the current navigator as a NavigatorView.
-
initPresentation
public void initPresentation()
Initializes the presentation. Not implemented in ServletHelpBroker.- Specified by:
initPresentation
in interfaceHelpBroker
-
setDisplayed
public void setDisplayed(boolean b)
Displays the presentation to the user.- Specified by:
setDisplayed
in interfaceHelpBroker
- Parameters:
b
- Makes the presentation visible or not.
-
isDisplayed
public boolean isDisplayed()
Determines if the presentation is displayed.- Specified by:
isDisplayed
in interfaceHelpBroker
- Returns:
- Whether the presentation is currently visible.
-
setLocation
public void setLocation(java.awt.Point p) throws UnsupportedOperationException
Requests the presentation be located at a given position. This operation throws an UnsupportedOperationException in ServletHelpBroker- Specified by:
setLocation
in interfaceHelpBroker
- Throws:
UnsupportedOperationException
-
getLocation
public java.awt.Point getLocation() throws UnsupportedOperationException
Requests the location of the presentation. This operation throws an UnsupportedOperationException in ServletHelpBroker- Specified by:
getLocation
in interfaceHelpBroker
- Throws:
UnsupportedOperationException
-
setSize
public void setSize(java.awt.Dimension d) throws UnsupportedOperationException
Requests the presentation be set to a given size. This operation throws an UnsupportedOperationException in ServletHelpBroker- Specified by:
setSize
in interfaceHelpBroker
- Throws:
UnsupportedOperationException
-
getSize
public java.awt.Dimension getSize() throws UnsupportedOperationException
Requests the size of the presentation. throws UnsupportedOperationException in ServletHelpBroker.- Specified by:
getSize
in interfaceHelpBroker
- Throws:
UnsupportedOperationException
-
setScreen
public void setScreen(int screen) throws UnsupportedOperationException
Requests the presentation be set to a given screen. This operation throws an UnsupportedOperationException in ServletHelpBroker- Specified by:
setScreen
in interfaceHelpBroker
- Throws:
UnsupportedOperationException
-
getScreen
public int getScreen() throws UnsupportedOperationException
Requests the screen of the presentation. throws UnsupportedOperationException in ServletHelpBroker.- Specified by:
getScreen
in interfaceHelpBroker
- Throws:
UnsupportedOperationException
-
setViewDisplayed
public void setViewDisplayed(boolean displayed)
Hides/Shows view.- Specified by:
setViewDisplayed
in interfaceHelpBroker
- Parameters:
displayed
- Make the navigational views visible or not.
-
isViewDisplayed
public boolean isViewDisplayed()
Determines if the current view is visible.- Specified by:
isViewDisplayed
in interfaceHelpBroker
- Returns:
- Whether the navigational views are visible.
-
setCurrentID
public void setCurrentID(java.lang.String id) throws BadIDException
Shows this ID as content relative to the (top) HelpSet for the HelpBroker instance--HelpVisitListeners are notified.- Specified by:
setCurrentID
in interfaceHelpBroker
- Parameters:
id
- A string that identifies the topic to show for the loaded (top) HelpSet- Throws:
BadIDException
- The ID is not valid for the HelpSet
-
setCurrentID
public void setCurrentID(Map.ID id) throws InvalidHelpSetContextException
Displays this ID--HelpVisitListeners are notified.- Specified by:
setCurrentID
in interfaceHelpBroker
- Parameters:
id
- a Map.ID indicating the URL to display- Throws:
InvalidHelpSetContextException
- if the current helpset does not contain id.helpset- See Also:
HelpModel.setCurrentID(javax.help.Map.ID)
-
getCurrentID
public Map.ID getCurrentID()
Determines which ID is displayed (if any).- Specified by:
getCurrentID
in interfaceHelpBroker
- Returns:
- The ID being shown.
-
setCurrentURL
public void setCurrentURL(java.net.URL url)
Displays this URL. HelpVisitListeners are notified. The currentID changes if there is a mathing ID for this URL- Specified by:
setCurrentURL
in interfaceHelpBroker
- Parameters:
url
- The url to display. A null URL is a valid url.
-
getCurrentURL
public java.net.URL getCurrentURL()
Determines which URL is displayed.- Specified by:
getCurrentURL
in interfaceHelpBroker
- 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. Not implemented in ServletHelpBroker- Specified by:
enableHelpKey
in interfaceHelpBroker
- Parameters:
comp
- The component to enable the keyboard actions on.id
- The default HelpID to be displayed.hs
- The default HelpSet to be displayed.
-
enableHelp
public void enableHelp(java.awt.Component comp, java.lang.String id, HelpSet hs)
Enables help for a Component. Not implemented in ServletHelpBroker- Specified by:
enableHelp
in interfaceHelpBroker
- 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. Not implemented in ServletHelpBroker- Specified by:
enableHelp
in interfaceHelpBroker
- See Also:
CSH.setHelpID
,CSH.setHelpSet
-
enableHelpOnButton
public void enableHelpOnButton(java.awt.Component comp, java.lang.String id, HelpSet hs)
Enables help for a Component. Not implemented in ServletHelpBroker- Specified by:
enableHelpOnButton
in interfaceHelpBroker
- 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. Not implemented in ServletHelpBroker.- Specified by:
enableHelpOnButton
in interfaceHelpBroker
- See Also:
CSH.setHelpID
,CSH.setHelpSet
,MenuItem
-
setHelpSetPresentation
public void setHelpSetPresentation(HelpSet.Presentation pres)
Description copied from interface:HelpBroker
Sets the presentation attributes from a HelpSet.Presentation. The HelpSet.Presentation must be in the current HelpSet.- Specified by:
setHelpSetPresentation
in interfaceHelpBroker
- Parameters:
pres
- The HelpSet.Presentation
-
showID
public void showID(java.lang.String id, java.lang.String presentation, java.lang.String presentationName) throws BadIDException
Description copied from interface:HelpBroker
Displays this ID in a particular presentation- Specified by:
showID
in interfaceHelpBroker
- 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
-
showID
public void showID(Map.ID id, java.lang.String presentation, java.lang.String presentationName) throws InvalidHelpSetContextException
Description copied from interface:HelpBroker
Displays this ID in a given presentation- Specified by:
showID
in interfaceHelpBroker
- 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
-
enableHelpKey
public void enableHelpKey(java.awt.Component comp, java.lang.String id, HelpSet hs, java.lang.String presentation, java.lang.String presentationName)
Description copied from interface:HelpBroker
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.- Specified by:
enableHelpKey
in interfaceHelpBroker
- 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
-
enableHelpOnButton
public void enableHelpOnButton(java.lang.Object obj, java.lang.String id, HelpSet hs, java.lang.String presentation, java.lang.String presentationName)
Description copied from interface:HelpBroker
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.- Specified by:
enableHelpOnButton
in interfaceHelpBroker
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
,CSH.setHelpID
,CSH.setHelpSet
,AbstractButton
,Button
-
-