Class HelpTexts
java.lang.Object
|
+----HelpTexts
- class HelpTexts
- extends Object
A store for keeping the help texts. The help texts are referenced
using a String called the `subject'. With a subject, you can retrieve
the corresponding help text. This class contains the mapping from
subjects to help text files. This class also buffers the help texts
in a Hashtable.
- Version:
- $Revision: 1.2 $
-
helpDirectory
- The name of the directory where the help text files are sought.
-
loadedString
- A String containing the result of the last call to loadFile().
-
texts
- The Hashtable containing the texts that have been retrieved using
getHelpText().
-
HelpTexts()
-
-
getFilename(String)
- Maps a subject string to the name of a help text file.
-
getHelpText(String)
- Returns the help text corresponding to a specified subject.
-
loadFile(String)
- Loads a file with a specified name.
loadedString
private String loadedString
- A String containing the result of the last call to loadFile().
- See Also:
- loadFile
texts
private Hashtable texts
- The Hashtable containing the texts that have been retrieved using
getHelpText().
- See Also:
- getHelpText
helpDirectory
private String helpDirectory
- The name of the directory where the help text files are sought.
Before any help text file is sought, this variable is set with a value
from the Framework property "HelpDirectory". If this Framework
property does not exist, the value set here is used.
HelpTexts
HelpTexts()
getHelpText
String getHelpText(String subject)
- Returns the help text corresponding to a specified subject. In case
of an error (subject unknown, help text file not found or error while
reading help text file), it returns an appropriate message.
- Parameters:
- subject - the subject for which the help text is needed.
- Returns:
- the help text or an error message in case of an error.
loadFile
private boolean loadFile(String name)
- Loads a file with a specified name. The contents of the file are put
in a string which is then put in the instance variable loadedString.
In case of an error (help text file not found or error while reading
help text file) an appropriate message is put in loadedString.
- Parameters:
- name - the name of the file to load.
- Returns:
- a boolean indicating wether an error occurred or not. If no
error occurred, instance variable loadedString contains the contents
of the file, otherwise it contains an appropriate message.
- See Also:
- loadedString
getFilename
private String getFilename(String subject)
- Maps a subject string to the name of a help text file. Currently, the
name of the file is the same as the name of the subject. The name of
the directory is taken from the instance variable helpDirectory.
- Parameters:
- subject - the subject to find the help text filename for.
- Returns:
- the filename or
null
if no name could be found.
- See Also:
- getProperties, helpDirectory