com.sun.rave.web.ui.util
Class HelpUtils

java.lang.Object
  extended by com.sun.rave.web.ui.util.HelpUtils
All Implemented Interfaces:
java.util.EventListener, javax.help.search.SearchListener

public class HelpUtils
extends java.lang.Object
implements javax.help.search.SearchListener

This is a set of utilities used for accessing JavaHelp content.


Field Summary
static java.lang.String BASE_ID
          Node ID of the root treenode.
protected static java.lang.String DEFAULT_HELPSET_NAME
           
protected static java.lang.String HELP_DIR
           
protected static java.lang.String HTML_DIR
           
static java.lang.String INDEX_VIEW_NAME
           
protected static java.lang.String REQUEST_SCHEME
          Tips on searching path.
static java.lang.String SEARCH_VIEW_NAME
           
protected static java.lang.String TIPS_ON_SEARCHING_FILE
           
static java.lang.String TOC_VIEW_NAME
           
static java.lang.String URL_SEPARATOR
           
 
Constructor Summary
HelpUtils(javax.servlet.http.HttpServletRequest request, java.lang.String appName, int httpPort)
          Constructor.
HelpUtils(javax.servlet.http.HttpServletRequest request, java.lang.String appName, java.lang.String pathPrefix)
          Constructor.
 
Method Summary
 java.util.Enumeration doSearch(java.lang.String query)
          Do a search on the query passed in.
 java.lang.String getContentURL(javax.help.TreeItem item)
          Return the content URL in String form for a given TreeItem, or an empty String if no content exists.
 java.lang.String getDefaultHelpSetPath()
          Return the path to the default helpset file.
 javax.help.ServletHelpBroker getHelpBroker()
          Return a handle to the ServletHelpBroker.
 java.lang.String getID(javax.swing.tree.TreeNode node)
          Return the ID of the given node.
 java.util.ArrayList getIndexTreeList()
          Return the Index tree enumeration as an ArrayList object.
 java.lang.String getLocalizedHelpPath()
           
 java.lang.String getTipsOnSearchingPath(javax.servlet.ServletContext context)
          Get the path to the localized tips_on_searching help file.
 java.util.ArrayList getTOCTreeList()
          Return the TOC tree enumeration as an ArrayList object.
 java.lang.String indexTreeToString(javax.swing.tree.DefaultMutableTreeNode node)
          Return a string containing the contents of the given Index tree node.
 void itemsFound(javax.help.search.SearchEvent e)
          Tells the listener that matching SearchItems have been found.
 void printDebug()
          For debug - print the attributes of each node in the toc and index trees.
 void searchFinished(javax.help.search.SearchEvent e)
          Tells the listener that the search has finished.
 void searchStarted(javax.help.search.SearchEvent e)
          Tells the listener that the search has started.
 void setCurrentHelpPage(java.net.URL url)
          Set the path to the "current" page.
 java.lang.String tocTreeToString(javax.swing.tree.DefaultMutableTreeNode node)
          Return a string containing the contents of the given TOC tree node.
 void validateHelpSet(javax.servlet.http.HttpServletRequest request, java.lang.String hsName, boolean merge)
          This method validates the helpset.
 void validateID(java.lang.String helpID)
          Validate the given help id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_SEPARATOR

public static final java.lang.String URL_SEPARATOR
See Also:
Constant Field Values

TOC_VIEW_NAME

public static final java.lang.String TOC_VIEW_NAME
See Also:
Constant Field Values

INDEX_VIEW_NAME

public static final java.lang.String INDEX_VIEW_NAME
See Also:
Constant Field Values

SEARCH_VIEW_NAME

public static final java.lang.String SEARCH_VIEW_NAME
See Also:
Constant Field Values

BASE_ID

public static final java.lang.String BASE_ID
Node ID of the root treenode.

See Also:
Constant Field Values

REQUEST_SCHEME

protected static final java.lang.String REQUEST_SCHEME
Tips on searching path.

See Also:
Constant Field Values

HTML_DIR

protected static final java.lang.String HTML_DIR
See Also:
Constant Field Values

HELP_DIR

protected static final java.lang.String HELP_DIR
See Also:
Constant Field Values

DEFAULT_HELPSET_NAME

protected static final java.lang.String DEFAULT_HELPSET_NAME
See Also:
Constant Field Values

TIPS_ON_SEARCHING_FILE

protected static final java.lang.String TIPS_ON_SEARCHING_FILE
See Also:
Constant Field Values
Constructor Detail

HelpUtils

public HelpUtils(javax.servlet.http.HttpServletRequest request,
                 java.lang.String appName,
                 int httpPort)
Constructor.


HelpUtils

public HelpUtils(javax.servlet.http.HttpServletRequest request,
                 java.lang.String appName,
                 java.lang.String pathPrefix)
Constructor.

Method Detail

getTipsOnSearchingPath

public java.lang.String getTipsOnSearchingPath(javax.servlet.ServletContext context)
Get the path to the localized tips_on_searching help file.


getHelpBroker

public javax.help.ServletHelpBroker getHelpBroker()
Return a handle to the ServletHelpBroker.


getLocalizedHelpPath

public java.lang.String getLocalizedHelpPath()

getDefaultHelpSetPath

public java.lang.String getDefaultHelpSetPath()
Return the path to the default helpset file. The path will be formatted as follows:

//html//help/app.hs


validateHelpSet

public void validateHelpSet(javax.servlet.http.HttpServletRequest request,
                            java.lang.String hsName,
                            boolean merge)
This method validates the helpset.

Parameters:
request - The request for this page.
hsName - The helpset name.
merge - Indicates whether the helpset hsName should be merged.

validateID

public void validateID(java.lang.String helpID)
Validate the given help id. If none is specified, set the current id to the home id.

Parameters:
helpID - the current ID.

setCurrentHelpPage

public void setCurrentHelpPage(java.net.URL url)
Set the path to the "current" page.


getID

public java.lang.String getID(javax.swing.tree.TreeNode node)
Return the ID of the given node.


getContentURL

public java.lang.String getContentURL(javax.help.TreeItem item)
Return the content URL in String form for a given TreeItem, or an empty String if no content exists.


getTOCTreeList

public java.util.ArrayList getTOCTreeList()
Return the TOC tree enumeration as an ArrayList object.


getIndexTreeList

public java.util.ArrayList getIndexTreeList()
Return the Index tree enumeration as an ArrayList object.


doSearch

public java.util.Enumeration doSearch(java.lang.String query)
Do a search on the query passed in.


searchStarted

public void searchStarted(javax.help.search.SearchEvent e)
Tells the listener that the search has started.

Specified by:
searchStarted in interface javax.help.search.SearchListener

searchFinished

public void searchFinished(javax.help.search.SearchEvent e)
Tells the listener that the search has finished.

Specified by:
searchFinished in interface javax.help.search.SearchListener

itemsFound

public void itemsFound(javax.help.search.SearchEvent e)
Tells the listener that matching SearchItems have been found.

Specified by:
itemsFound in interface javax.help.search.SearchListener

printDebug

public void printDebug()
For debug - print the attributes of each node in the toc and index trees.


tocTreeToString

public java.lang.String tocTreeToString(javax.swing.tree.DefaultMutableTreeNode node)
Return a string containing the contents of the given TOC tree node.


indexTreeToString

public java.lang.String indexTreeToString(javax.swing.tree.DefaultMutableTreeNode node)
Return a string containing the contents of the given Index tree node.