Package javax.help
Class DefaultHelpModel
java.lang.Object
javax.help.DefaultHelpModel
- All Implemented Interfaces:
Serializable,HelpModel,TextHelpModel
This class implements the javax.help.HelpModel API and
notifies the JHelpModel listeners when changes occur.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA default implementation of TextHelpModel.HighlightNested classes/interfaces inherited from interface javax.help.TextHelpModel
TextHelpModel.Highlight -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PropertyChangeSupportprotected EventListenerListprotected EventListenerList -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a listener for the HelpModelEvent posted after the model has changed.voidaddHighlight(int pos0, int pos1) Highlights a range of positions in a document.voidAdds a listener to changes to the properties in this model.voidAdds a listener for the TextHelpModelEvent posted after the model has changed.protected voidfireHighlightsChanged(Object source) protected voidfireIDChanged(Object source, Map.ID id, URL url) protected voidfireIDChanged(Object source, Map.ID id, URL url, String historyName, JHelpNavigator navigator) Gets the current ID.Returns the current URLGets the document title.Gets the backing HelpSet.Geta all the highlights currently active.voidRemoves highlights.voidRemoves a listener previously added with addHelpListenervoidRemoves a listener to changes to the properties in this model.voidRemoves a listener previously added with addHelpListenervoidsetCurrentID(Map.ID ident) Sets the current ID.voidsetCurrentID(Map.ID ident, String historyName, JHelpNavigator navigator) Sets the current ID relative to some HelpSet HelpModelListeners and HelpVisitListeners are notifiedvoidsetCurrentURL(URL url) Sets the current URL.voidsetCurrentURL(URL url, String historyName, JHelpNavigator navigator) Sets the current URL and the name wich will appear in history list.voidsetDocumentTitle(String title) Assigns the document title.voidsetHelpSet(HelpSet hs) Sets the HelpSet for this HelpModel.voidSet highlights.
-
Field Details
-
listenerList
-
textListenerList
-
changes
-
-
Constructor Details
-
DefaultHelpModel
Constructs a HelpModel from a HelpSet- Parameters:
hs- The HelpSet from which to build this model. A null hs is valid creating a DefaultHelpModel without a HelpSet.- See Also:
-
-
Method Details
-
setHelpSet
Sets the HelpSet for this HelpModel. A null hs is valid.- Specified by:
setHelpSetin interfaceHelpModel
-
getHelpSet
Gets the backing HelpSet.- Specified by:
getHelpSetin interfaceHelpModel- Returns:
- the helpset. A null hs is valid.
-
setCurrentID
Sets the current ID. HelpModelListeners and HelpVisitListeners are notified. If the parameter ident is null, the homeID of the current HelpSet is used unless it is also null in which case the method returns without setting the currentID.- Specified by:
setCurrentIDin interfaceHelpModel- Parameters:
ident- The ID to set. If ident is null set the currentID to the HelpSet's HomeID. If the HomeID doesn't exist the currentID is set to null.- Throws:
InvalidHelpSetContextException- The ID is not valid for the HelpSet
-
getCurrentID
Gets the current ID.- Specified by:
getCurrentIDin interfaceHelpModel- Returns:
- the current ID. A null ID is a valid id. If no ID has been set a null ID is returned.
-
setCurrentURL
Sets the current URL. The current ID changes if there is a matching ID for this URL and HelpModelListners are notified.- Specified by:
setCurrentURLin interfaceHelpModel- Parameters:
url- The url to set the model to. A null URL is a valid url.
-
getCurrentURL
Returns the current URL- Specified by:
getCurrentURLin interfaceHelpModel- Returns:
- The current URL. A null URL is a valid URL. If no URL has been previously set a null URL will be returned.
-
addHighlight
public void addHighlight(int pos0, int pos1) Highlights a range of positions in a document.- Specified by:
addHighlightin interfaceTextHelpModel- Parameters:
pos0- start positionpos1- end position
-
removeAllHighlights
public void removeAllHighlights()Removes highlights.- Specified by:
removeAllHighlightsin interfaceTextHelpModel
-
setHighlights
Set highlights. Clear the current Hightlights and set new Highlights- Specified by:
setHighlightsin interfaceTextHelpModel- Parameters:
h- An array of Hightlights. If h is null it is the same as setting no highlights
-
getHighlights
Geta all the highlights currently active.- Specified by:
getHighlightsin interfaceTextHelpModel- Returns:
- An array of highlights
-
addHelpModelListener
Adds a listener for the HelpModelEvent posted after the model has changed.- Specified by:
addHelpModelListenerin interfaceHelpModel- Parameters:
l- - The listener to add.- Throws:
IllegalArgumentException- if l is null.- See Also:
-
removeHelpModelListener
Removes a listener previously added with addHelpListener- Specified by:
removeHelpModelListenerin interfaceHelpModel- Parameters:
l- - The listener to remove. If l is not in the list of listeners it is ignored.- Throws:
IllegalArgumentException- if l is null.- See Also:
-
addTextHelpModelListener
Adds a listener for the TextHelpModelEvent posted after the model has changed.- Specified by:
addTextHelpModelListenerin interfaceTextHelpModel- Parameters:
l- - The listener to add.- Throws:
IllegalArgumentException- if l is null.- See Also:
-
removeTextHelpModelListener
Removes a listener previously added with addHelpListener- Specified by:
removeTextHelpModelListenerin interfaceTextHelpModel- Parameters:
l- - The listener to remove. If l is not on the list of listeners it is ignored.- Throws:
IllegalArgumentException- if l is null.- See Also:
-
addPropertyChangeListener
Adds a listener to changes to the properties in this model.- Specified by:
addPropertyChangeListenerin interfaceHelpModel- Parameters:
l- the listener to add
-
removePropertyChangeListener
Removes a listener to changes to the properties in this model.- Specified by:
removePropertyChangeListenerin interfaceHelpModel- Parameters:
l- the listener to remove. If l is not on the list of listeners it is ignored.
-
setDocumentTitle
Assigns the document title.- Specified by:
setDocumentTitlein interfaceTextHelpModel- Parameters:
title- the Title for the document currently being shown. A null title is valid.
-
getDocumentTitle
Gets the document title.- Specified by:
getDocumentTitlein interfaceTextHelpModel- Returns:
- The title for the current document. A null title is valid. If the title has not be previously set it will be null.
-
fireIDChanged
-
fireHighlightsChanged
-