All Packages Class Hierarchy This Package Previous Next Index
Class jHelp.htmlHelpPanel
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----jHelp.htmlHelpPanel
- public class htmlHelpPanel
- extends Panel
- implements ActionListener, AdjustmentListener, htmlLinkListener
A class to provide a help browser component, consisting of a scrolling
text canvas, and a vertical scrollbar. The scrollbar may optionally be
removed.
The htmlHelpPanel constructors require the instance of the parent container
as the first argument. This is used by jHelp to determine if the class is
being invoked by an applet or application. Standalone applications
invoking applet classes that deploy jHelp must supply the application Frame
to jHelp's constructor, and not the applet instance.
All constructors take a fileName argument, a String comprised of one or more
help source file names. Where more than one help file is being loaded in the
constructor, the names should be entered as a single string, with the file
names delimited by a '|' character.
For example
new htmlHelpPanel(this,"help1.html|help2.html|help3.html")
Help files need not be loaded during construction, and can be added using the
addFile method. However, this is not necessary, as new
files will be loaded automatically on demand if not already loaded.
The first file named in the fileNames argument will be the default file displayed
in the browser panel.
You can instantiate an htmlHelpPanel with null as the fileNames argument, which
creates a blank display.
You can also instantiate an htmlHelpPanel with a zip or jar file, which should
contain the help documents that will be used.
-
actionListener
-
-
DYN_NAME
-
-
DYN_PREFIX
-
-
DYNAMIC
-
-
htmlHelpPanel(Object, String)
- The basic htmlHelpPanel constructor is provided for use as a browser widget.
-
htmlHelpPanel(Object, String, int)
- This constructor permits specifying the width of the scrollbar without passing
navigation buttons.
-
htmlHelpPanel(Object, String, int, Locale)
- This constructor permits specifying the width of the scrollbar without passing
navigation buttons.
-
htmlHelpPanel(Object, String, Locale)
- The basic htmlHelpPanel constructor is provided for use as a browser widget.
-
htmlHelpPanel(Object, String, Object, Object)
- This htmlHelpPanel constructor is provided for developers to produce
customized framed help browsers, basing their code on the htmlHelpFrame
source code, if available.
-
htmlHelpPanel(Object, String, Object, Object, int)
- This htmlHelpPanel constructor permits specifying the width
of the vertical scrollbar along with back and forward buttons.
-
htmlHelpPanel(Object, String, Object, Object, int, Locale)
- This htmlHelpPanel constructor permits specifying the width
of the vertical scrollbar along with back and forward buttons.
-
htmlHelpPanel(Object, String, Object, Object, Locale)
- This htmlHelpPanel constructor is provided for developers to produce
customized framed help browsers, basing their code on the htmlHelpFrame
source code, if available.
-
actionPerformed(ActionEvent)
-
-
addActionListener(ActionListener)
-
-
addFile(Object, String)
- The addFile method permits loading additional help source files subsequent
to construction.
-
addHTMLString(Object, String, String)
- The addHTMLString method permits loading dynamically generated HTML content.
-
adjustmentValueChanged(AdjustmentEvent)
-
-
enableStacks(Object, Object)
- Normally, if forward/back navigation buttons are provided, they are
specified in the constructor.
-
getCurrentFileName()
- Returns the name of the current document.
-
getInsets()
-
-
getMaxCache()
- This method returns the current number of documents that will be retained in
memory.
-
goBack()
- This method causes the help panel to retrieve the previous document or
location (after a hypertext jump) if any.
-
goForward()
- This method causes the help panel to retrieve the next document or
location (after a hypertext jump) if any.
-
goTo(String)
- This method permits setting the panel explicitly to a helpfile and optionally,
a location within the help file.
-
goTo(String, int)
- This method permits setting the panel explicitly to a helpfile and optionally,
a location within the help file with an element index.
-
handleDefaultLink(htmlLinkEvent)
- The default internal link handler
-
handleLink(htmlLinkEvent)
- The internal link handler that may be overridden to
provide customized link handling.
-
moreDown()
- This method returns true if the current document may still be scrolled up.
-
moreUp()
- This method returns true if the current document may still be scrolled down.
-
noScrollbar()
- This method is used to remove the scrollbar.
-
pageDown()
- This method is used to scroll down one page increment.
-
pageUp()
- This method is used to scroll up one page increment.
-
paint(Graphics)
-
-
printHelpFile(Frame)
- Invokes printing the current document.
-
removeActionListener(ActionListener)
-
-
resetStacks()
- This method can be called to force clearing/resetting the back/forward
navigation stacks.
-
setGoToBase(String)
- This method permits setting a help document path at runtime, so that the
goTo method can be used with a filename, rather than an explicit path when
it needs to be invoked.
-
setJhelpListener(htmlJhelpListener)
- Sets an external listener, implementing htmlJhelpListener, that may
respond to the user hiding the htmlHelpFrame, or a low memory or other
exception, thrown when jHelp attempts to create the text image.
-
setMaxCache(int)
- This method permits setting a maximum number of help documents that are
retained in memory by jHelp.
-
setText(String)
- A convenience method to display a String of text.
-
update(Graphics)
-
DYN_PREFIX
public static final String DYN_PREFIX
DYN_NAME
public static final String DYN_NAME
DYNAMIC
public static final String DYNAMIC
actionListener
protected ActionListener actionListener
htmlHelpPanel
public htmlHelpPanel(Object instance,
String fileNames)
- The basic htmlHelpPanel constructor is provided for use as a browser widget. It
creates a scrolling canvas to display text, and a scrollbar.
It need not be explicitly instantiated when the htmlHelpFrame
is used.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- See Also:
- addFile
htmlHelpPanel
public htmlHelpPanel(Object instance,
String fileNames,
Object backButton,
Object forwardButton)
- This htmlHelpPanel constructor is provided for developers to produce
customized framed help browsers, basing their code on the htmlHelpFrame
source code, if available.
The backButton and forwardButton arguments are declared as Components to provide
for flexibility in passing custom widgets, such as image buttons.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- backButton - the component or widget to act as a 'back button'
- forwardButton - the component or widget to act as a 'forward button'
- See Also:
- addFile
htmlHelpPanel
public htmlHelpPanel(Object instance,
String fileNames,
Object backButton,
Object forwardButton,
int scrollwidth)
- This htmlHelpPanel constructor permits specifying the width
of the vertical scrollbar along with back and forward buttons.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- backButton - the component or widget to act as a 'back button'
- forwardButton - the component or widget to act as a 'forward button'
- scrollwidth - the width of the scrollbar
- See Also:
- addFile
htmlHelpPanel
public htmlHelpPanel(Object instance,
String fileNames,
int scrollwidth)
- This constructor permits specifying the width of the scrollbar without passing
navigation buttons.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- scrollwidth - the width of the scrollbar
- See Also:
- addFile
htmlHelpPanel
public htmlHelpPanel(Object instance,
String fileNames,
Locale locale)
- The basic htmlHelpPanel constructor is provided for use as a browser widget. It
creates a scrolling canvas to display text, and a scrollbar. Normally, jHelp uses
the users default locale when obtaining jHelp's resources. This constructor lets
you specify a specific Locale object.
It need not be explicitly instantiated when the htmlHelpFrame
is used.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- locale - a Locale object that jHelp will attempt to use in ResourceBundle.getBundle
- See Also:
- addFile
htmlHelpPanel
public htmlHelpPanel(Object instance,
String fileNames,
Object backButton,
Object forwardButton,
Locale locale)
- This htmlHelpPanel constructor is provided for developers to produce
customized framed help browsers, basing their code on the htmlHelpFrame
source code, if available.
The backButton and forwardButton arguments are declared as Components to provide
for flexibility in passing custom widgets, such as image buttons.
This constructor also permits passing a Locale object, to override jHelp's default
behavior of getting the default Locale on the users machine.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- backButton - the component or widget to act as a 'back button'
- forwardButton - the component or widget to act as a 'forward button'
- locale - a Locale object that jHelp will attempt to use in ResourceBundle.getBundle
- See Also:
- addFile
htmlHelpPanel
public htmlHelpPanel(Object instance,
String fileNames,
Object backButton,
Object forwardButton,
int scrollwidth,
Locale locale)
- This htmlHelpPanel constructor permits specifying the width
of the vertical scrollbar along with back and forward buttons.
This constructor also permits passing a Locale object, to override jHelp's default
behavior of getting the default Locale on the users machine.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- backButton - the component or widget to act as a 'back button'
- forwardButton - the component or widget to act as a 'forward button'
- scrollwidth - the width of the scrollbar
- locale - a Locale object that jHelp will attempt to use in ResourceBundle.getBundle
- See Also:
- addFile
htmlHelpPanel
public htmlHelpPanel(Object instance,
String fileNames,
int scrollwidth,
Locale locale)
- This constructor permits specifying the width of the scrollbar without passing
navigation buttons.
This constructor also permits passing a Locale object, to override jHelp's default
behavior of getting the default Locale on the users machine.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- scrollwidth - the width of the scrollbar
- locale - a Locale object that jHelp will attempt to use in ResourceBundle.getBundle
- See Also:
- addFile
noScrollbar
public void noScrollbar()
- This method is used to remove the scrollbar. It should be called prior to placing
the htmlHelpPanel component in your Container's layout.
pageUp
public void pageUp()
- This method is used to scroll up one page increment. It is equivalent to the same
action generated by clicking on the scrollbar, and is provided for htmlHelpPanels
that remove the scrollbar.
moreUp
public boolean moreUp()
- This method returns true if the current document may still be scrolled down.
pageDown
public void pageDown()
- This method is used to scroll down one page increment. It is equivalent to the same
action generated by clicking on the scrollbar, and is provided for htmlHelpPanels
that remove the scrollbar.
moreDown
public boolean moreDown()
- This method returns true if the current document may still be scrolled up.
getCurrentFileName
public String getCurrentFileName()
- Returns the name of the current document.
getInsets
public final Insets getInsets()
- Overrides:
- getInsets in class Container
paint
public final void paint(Graphics g)
- Overrides:
- paint in class Container
update
public final void update(Graphics g)
- Overrides:
- update in class Component
addFile
public void addFile(Object instance,
String fileName)
- The addFile method permits loading additional help source files subsequent
to construction. However, unlike the constructor, only a single file can be
specified.This method need not be used in practice, although it continues
to be supported. Calling htmlHelpPanel.goTo(filename) will automatically
load the requested file if it is not in the document cache.
Note that adding a file does not place its contents in the display. It simply
loads the document into jHelp's document cache. You must still use
htmlHelpPanel.goTo(filename) to display the file.
Similar to this class's constructors, addFile requires the instance of the
parent container as the first argument. This is used by jHelp to determine
if the class is being invoked by an applet or application. Standalone applications
invoking applet classes that deploy jHelp must supply the application Frame
to this constructor, and not the applet instance.
The fileName argument is a String comprised of a single help source file.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileName - a String consisting of the name of one help source file.
addHTMLString
public void addHTMLString(Object instance,
String content,
String name)
- The addHTMLString method permits loading dynamically generated HTML content.
This method requires the String object containing the HTML to be displayed
and a name to be given to the object for referencing with the show() method.
If a name is not required (i.e. no external reference to this content will be
made) pass null as the name. In this case, future content can be added which
will replace the current content for dynamic HTML.
Note well that if you reference any external objects, such as images or links
to actual help files, you must define a <BASE HREF=...> if the referenced
objects are not within the current working directory of your application.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- content - a String consisting of the HTML code to be displayed
- name - a String consisting of the name to be assigned the dynamic HTML object
with null passed as a name for disposable content.
addActionListener
public void addActionListener(ActionListener l)
removeActionListener
public void removeActionListener(ActionListener l)
actionPerformed
public void actionPerformed(ActionEvent e)
adjustmentValueChanged
public void adjustmentValueChanged(AdjustmentEvent e)
goBack
public void goBack()
- This method causes the help panel to retrieve the previous document or
location (after a hypertext jump) if any.
goForward
public void goForward()
- This method causes the help panel to retrieve the next document or
location (after a hypertext jump) if any.
goTo
public void goTo(String context)
- This method permits setting the panel explicitly to a helpfile and optionally,
a location within the help file. The context argument takes the same form as
an HREF, such as help1.html#Usage, or simply #Usage. The latter form will attempt
to find the bookmark in the currently active help file.
If a context requests a file that has not been loaded, either in the constructor,
or with the addFile method, then jHelp will attempt to load the requested help
file.
- Parameters:
- context - the hyperlink to a file and/or bookmark
goTo
public void goTo(String filename,
int index)
- This method permits setting the panel explicitly to a helpfile and optionally,
a location within the help file with an element index. It is primarily intended
to be used by htmlHelpIndexFrame. The filename is assumed to be relative to the
current "goToBase" path setting.
- Parameters:
- filename - the name of the requested file
- index - the index number of the element to seek for the top of the display
setGoToBase
public void setGoToBase(String path)
- This method permits setting a help document path at runtime, so that the
goTo method can be used with a filename, rather than an explicit path when
it needs to be invoked. Note, that if this is used, then all subsequent
goTo(filenames) will prepend the specified base path to the named file. To
clear this base, call this method with null as the path argument.
If you have specified a zip or jar as the source of help files in the constructor
then this method is used to specify the path of help files within the zip.
This base can also be overridden by specifying a help document as an absolute
URL, prefixed with either file:// or http://
- Parameters:
- path - the directory (local or URL) where referenced help documents
are located
printHelpFile
public void printHelpFile(Frame frame)
- Invokes printing the current document.
- Parameters:
- frame - the Frame object that is passed to java.awt.Toolkit.getPrintJob
setMaxCache
public void setMaxCache(int value)
- This method permits setting a maximum number of help documents that are
retained in memory by jHelp. Useful for programs that deploy large sets of
help documents to prevent jHelp from exhausting resources if many documents
are browsed. A value of zero will cause jHelp to retain all documents in its
memory cache (the default.)
- Parameters:
- value - a positive integer representing the number of documents that
may be retained.
getMaxCache
public int getMaxCache()
- This method returns the current number of documents that will be retained in
memory. A value of zero indicates that all documents will be retained in the
memory cache.
setText
public void setText(String text)
- A convenience method to display a String of text. Equivalent
to
addHTMLString(instance, text, null);
- Parameters:
- text - the text to display
handleDefaultLink
public final void handleDefaultLink(htmlLinkEvent e)
- The default internal link handler
- Parameters:
- e - the htmlLinkEvent passed to this handler
handleLink
public void handleLink(htmlLinkEvent e)
- The internal link handler that may be overridden to
provide customized link handling. This method simply
calls and passes the event to the default link handler.
- Parameters:
- e - the htmlLinkEvent passed to this handler
resetStacks
public void resetStacks()
- This method can be called to force clearing/resetting the back/forward
navigation stacks. This will automatically disable the back/forward
button components as the stacks are emptied.
enableStacks
public void enableStacks(Object backButton,
Object forwardButton)
- Normally, if forward/back navigation buttons are provided, they are
specified in the constructor. This method permits setting navigation
controls after construction to enable the navigation stacks.
The arguments may be standard AWT components, or custom components. They
may also be null objects. However, in order to function automatically,
non-component objects should implement htmlNavControl so that jHelp's
navigational stack manager can enable/disable as appropriate.
- Parameters:
- backButton - the object that will serve as a "back" control
- forwardButton - the object that will serve as a "forward" control
setJhelpListener
public void setJhelpListener(htmlJhelpListener l)
- Sets an external listener, implementing htmlJhelpListener, that may
respond to the user hiding the htmlHelpFrame, or a low memory or other
exception, thrown when jHelp attempts to create the text image.
- Parameters:
- l - an object implementing htmlJhelpListener
All Packages Class Hierarchy This Package Previous Next Index