wt.help
Class NFHelpSystem

java.lang.Object
  extended bywt.help.NFHelpSystem
All Implemented Interfaces:
HelpSystem

public class NFHelpSystem
extends Object
implements HelpSystem

NetFactor implementation of the HelpSystem interface.

Supported API: true
Extendable: false


Field Summary
private  AppletContext appletContext
           
(package private)  PropertyChangeSupport changes
           
private  String contentsURL
           
private  URL documentBase
           
private  String helpURL
           
private  String name
           
private  ResourceBundle resources
           
private  String whereToShowDocument
           
 
Fields inherited from interface wt.help.HelpSystem
APPLET_CONTEXT, CONTENTS_KEY, CONTENTS_URL, DESCRIPTION_KEY, DOCUMENT_BASE, HELP_KEY, HELP_URL, KEY_DELIMITER, MISSING_RESOURCE, NAME, RESOURCES, SHOW_IN_CURRENT_FRAME, SHOW_IN_PARENT_FRAME, SHOW_IN_SEPARATE_FRAME, SHOW_IN_TOP_FRAME, TIP_KEY, WHERE_TO_SHOW_DOCUMENT
 
Constructor Summary
NFHelpSystem()
          Default constructor.
NFHelpSystem(String name, AppletContext appletContext, URL documentBase, String whereToShowDocument, ResourceBundle resources)
          Complete constructor which initializes all necessary properties.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add property change listener.
protected  String formatResourceKeyAlg1(String type, String system, String context, String topic)
           
protected  String formatResourceKeyAlg2(String[] args, int count)
           
 AppletContext getAppletContext()
          Get the applet context for this HelpSystem.
 String getContentsURL()
          The current help contents help URL.
 URL getDocumentBase()
          Get the base url used to show help urls.
 String getHelpURL()
          The current help url.
 String getName()
          Get the HelpSystem name.
 ResourceBundle getResources()
          Get the resource bundle for help.
protected  String getResourceString(String type, String system, String context, String topic)
           
protected  String getResourceStringAlg1(String type, String system, String context, String topic)
           
protected  String getResourceStringAlg2(String[] args, int count)
          The second algorithm for finding a help resource entry.
 String getToolDescription(String contextId, String toolId)
          The tool description for the component over which the mouse is positioned.
 String getToolTipText(String contextId, String toolId)
          The tool tip for the component over which the mouse is positioned.
 String getWhereToShowDocument()
          Get property whereToShowDocument.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove property change listener.
 void setAppletContext(AppletContext newValue)
          Set the applet context for this HelpSystem.
protected  void setContentsURL(String newValue)
           
 void setDocumentBase(URL newValue)
          Set the base url used to show help urls.
protected  void setHelpURL(String newValue)
           
 void setName(String newValue)
          Set help system name.
 void setResources(ResourceBundle newValue)
          Set the resource bundle for help.
 void setWhereToShowDocument(String newValue)
          Set String used to indicate which frame help should be displayed in.
 void showContents(String contextId)
          Show help contents for the context id.
 void showFind(String contextId)
           
 void showFind(String contextId, String keyword)
           
 void showHelp(String contextId)
          Show help for the context id.
 void showHelp(String contextId, String topicId)
          Show help contents for the context id and topic id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private String name

appletContext

private AppletContext appletContext

documentBase

private URL documentBase

whereToShowDocument

private String whereToShowDocument

resources

private ResourceBundle resources

contentsURL

private String contentsURL

helpURL

private String helpURL

changes

PropertyChangeSupport changes
Constructor Detail

NFHelpSystem

public NFHelpSystem()
Default constructor. Note that the following properties must be set before the NFHelpSystem can be used: name, appletContext, documentBase, whereToShowDocument, resources.


NFHelpSystem

public NFHelpSystem(String name,
                    AppletContext appletContext,
                    URL documentBase,
                    String whereToShowDocument,
                    ResourceBundle resources)
             throws PropertyVetoException
Complete constructor which initializes all necessary properties.

Parameters:
name - the name of the help system, will be used to form help resource keys.
appletContext - the context in which this container is running, it's showDocumentOperation will be invoked.
documentBase - the base upon which relative URL's will be shown.
whereToShowDocument - indicates in which frame to showDocument.
Throws:
PropertyVetoException - if any of the arguments are invalid.
Method Detail

getName

public String getName()
Description copied from interface: HelpSystem
Get the HelpSystem name. This name is used to construct help keys.

Specified by:
getName in interface HelpSystem
Returns:
the help system name.

setName

public void setName(String newValue)
             throws PropertyVetoException
Set help system name.

Specified by:
setName in interface HelpSystem
Parameters:
newValue - the new value of the help system name.
Throws:
PropertyVetoException - if the new valid is invalid.

getAppletContext

public AppletContext getAppletContext()
Description copied from interface: HelpSystem
Get the applet context for this HelpSystem.

Specified by:
getAppletContext in interface HelpSystem
Returns:
the applet context, used to showDocument.

setAppletContext

public void setAppletContext(AppletContext newValue)
                      throws PropertyVetoException
Description copied from interface: HelpSystem
Set the applet context for this HelpSystem. The showDocument operation is called on this AppletContext to show help urls.

Specified by:
setAppletContext in interface HelpSystem
Parameters:
newValue - the new value of the appletContext.
Throws:
PropertyVetoException - if the new value is invalid.

getDocumentBase

public URL getDocumentBase()
Description copied from interface: HelpSystem
Get the base url used to show help urls.

Specified by:
getDocumentBase in interface HelpSystem
Returns:
the document base for relative URL's.

setDocumentBase

public void setDocumentBase(URL newValue)
                     throws PropertyVetoException
Description copied from interface: HelpSystem
Set the base url used to show help urls.

Specified by:
setDocumentBase in interface HelpSystem
Parameters:
newValue - the new value of the document base.
Throws:
PropertyVetoException - if the new value is invalid.

getWhereToShowDocument

public String getWhereToShowDocument()
Get property whereToShowDocument. Indicates the frame to show the document in.

Specified by:
getWhereToShowDocument in interface HelpSystem
Returns:
HelpSystem.SHOW_IN_CURRENT_FRAME, HelpSystem.SHOW_IN_PARENT_FRAME, HelpSystem.SHOW_IN_SEPARATE_FRAME, "your frame name".
See Also:
ApplextContext

setWhereToShowDocument

public void setWhereToShowDocument(String newValue)
                            throws PropertyVetoException
Description copied from interface: HelpSystem
Set String used to indicate which frame help should be displayed in.

Specified by:
setWhereToShowDocument in interface HelpSystem
Parameters:
newValue - the new value for where to show frame.
Throws:
PropertyVetoException - if the new value is invalid.
See Also:
AppletContext

getResources

public ResourceBundle getResources()
Description copied from interface: HelpSystem
Get the resource bundle for help. Resources include help text and urls.

Specified by:
getResources in interface HelpSystem
Returns:
the help system restouce bundle.

setResources

public void setResources(ResourceBundle newValue)
                  throws PropertyVetoException
Description copied from interface: HelpSystem
Set the resource bundle for help.

Specified by:
setResources in interface HelpSystem
Parameters:
newValue - the new value of the resources field.
Throws:
PropertyVetoException - if the new value is invalid.

getContentsURL

public String getContentsURL()
Description copied from interface: HelpSystem
The current help contents help URL. Listeners may subscribe to this property.

Specified by:
getContentsURL in interface HelpSystem
Returns:
the current URL for help contents.

setContentsURL

protected void setContentsURL(String newValue)
Parameters:
newValue - the new value of the help contents URL.

getHelpURL

public String getHelpURL()
Description copied from interface: HelpSystem
The current help url. Listeners may subcribe to this property.

Specified by:
getHelpURL in interface HelpSystem
Returns:
the new value of the help URL.

setHelpURL

protected void setHelpURL(String newValue)
Parameters:
newValue - the new value of the help URL.

getToolTipText

public String getToolTipText(String contextId,
                             String toolId)
Description copied from interface: HelpSystem
The tool tip for the component over which the mouse is positioned. Listeners may subscribe to this property.

Specified by:
getToolTipText in interface HelpSystem
Parameters:
contextId - the sub-key for the context.
toolId - the sub-key for the tool.
Returns:
the tool tip from the localized resource bundle.

getToolDescription

public String getToolDescription(String contextId,
                                 String toolId)
Description copied from interface: HelpSystem
The tool description for the component over which the mouse is positioned. Listeners may subscribe to this property.

Specified by:
getToolDescription in interface HelpSystem
Parameters:
contextId - the sub-key for the context.
toolId - the sub-key for the tool.
Returns:
the description from the localized resource bundle.

showContents

public void showContents(String contextId)
Description copied from interface: HelpSystem
Show help contents for the context id. The context id will be combined with the help system name to form a help resource url. The help resource url will be launched in the current applet context.

Specified by:
showContents in interface HelpSystem
Parameters:
contextId - the context help sub-key.

showHelp

public void showHelp(String contextId)
Description copied from interface: HelpSystem
Show help for the context id. The context id will be combined with the help system name to form a help resource url. The help resource url will be launched in the current applet context.

Specified by:
showHelp in interface HelpSystem
Parameters:
contextId - the context help sub-key.

showHelp

public void showHelp(String contextId,
                     String topicId)
Description copied from interface: HelpSystem
Show help contents for the context id and topic id. The context id and topic id will be combined with the help system name to form a help resource url. The help resource url will be launched in the current applet context.

Specified by:
showHelp in interface HelpSystem
Parameters:
contextId - the context help sub-key.
topicId - the topic help sub-key.

showFind

public void showFind(String contextId)
Specified by:
showFind in interface HelpSystem

showFind

public void showFind(String contextId,
                     String keyword)
Specified by:
showFind in interface HelpSystem

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: HelpSystem
Add property change listener.

Specified by:
addPropertyChangeListener in interface HelpSystem
Parameters:
listener - the new listener.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: HelpSystem
Remove property change listener.

Specified by:
removePropertyChangeListener in interface HelpSystem
Parameters:
listener - the listener to be removed.

getResourceString

protected String getResourceString(String type,
                                   String system,
                                   String context,
                                   String topic)

getResourceStringAlg1

protected String getResourceStringAlg1(String type,
                                       String system,
                                       String context,
                                       String topic)

formatResourceKeyAlg1

protected String formatResourceKeyAlg1(String type,
                                       String system,
                                       String context,
                                       String topic)

getResourceStringAlg2

protected String getResourceStringAlg2(String[] args,
                                       int count)
The second algorithm for finding a help resource entry. This algorithm first tries to find the passed key directly, if that fails it strips off the trailing part of the key and recursively calls itself.

Returns:
the help resource, may be null.

formatResourceKeyAlg2

protected String formatResourceKeyAlg2(String[] args,
                                       int count)