Package se.datadosen.util
Class ContextHelp
java.lang.Object
se.datadosen.util.ContextHelp
Context sensitive help system Enables windows (JFrame and Dialog instances) to have a help button that opens context
sensitive help based on what component / panel is currently being viewed. Also ties F1 presses to the help button.
To add context sensitive help for a panel (a skin user interface for instance), call
ContextHelp.getInstance().add(myPanel, "http://www.mysite.com/help/doc.html");You can alternatively mark your user interface panels with calls like this:
myPanel.putClientProperty("helpPage", "http://www.mysite.com/help/doc.html");This approach has the advantage of not breaking compatibility with earlier versions of jAlbum (those "helpPage" client properties are simply ignored). When panels marked like this are added to jAlbum, jAlbum picks up these "helpPage" client properties and installs help support.
Adding help support to custom windows
If you have your own window or dialog that isn't managed by jAlbum, you can add a help button to it with a call like this:ContextHelp.getInstance().installHelpButton(myWindow, Corner.TOP_RIGHT);The add method of the ContextHelp can now be used to register user interface panels with the help system. If you prefer to use the client property approach above, then you also need to tell the context help system to discover these client properties. This is done with a call like this:
ContextHelp.getInstance().addTree(myWindow.getRootPane());
- Since:
- 12.3
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
class
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(JComponent comp, String helpPage) Add help support for given component (usually a JPanel)void
addTree
(JComponent container) Add help support to component tree containing "helpPage" client properties on JPanelsgetContext
(Window window) static ContextHelp
void
installHelpButton
(JDialog dialog, ContextHelp.Corner corner) Install help button in the desired corner, 5 pixels from the edgevoid
installHelpButton
(JDialog dialog, ContextHelp.Corner corner, int margin) Install help button in the desired corner, margin pixels from the edgevoid
installHelpButton
(JFrame frame, ContextHelp.Corner corner) Install help button in the desired corner, 5 pixels from the edgevoid
installHelpButton
(JFrame frame, ContextHelp.Corner corner, int margin) Install help button in the desired corner, margin pixels from the edgeprotected void
Open helpPath in browservoid
remove
(JComponent comp) Remove help support for given component (usually a JPanel)static void
setInstance
(ContextHelp instance) This method is intended to be called by server-side loaded code that provides a subclass of ContextHelp that provides an adjusted implementation of open()
-
Field Details
-
HELP_PAGE
- See Also:
-
-
Constructor Details
-
ContextHelp
protected ContextHelp()
-
-
Method Details
-
getInstance
-
setInstance
This method is intended to be called by server-side loaded code that provides a subclass of ContextHelp that provides an adjusted implementation of open()- Parameters:
instance
-
-
open
Open helpPath in browser- Parameters:
helpPage
- path relative to https://jalbum.net/help or absolute URL
-
add
Add help support for given component (usually a JPanel)- Parameters:
comp
-helpPage
-
-
addTree
Add help support to component tree containing "helpPage" client properties on JPanels- Parameters:
container
- root of component tree to add
-
remove
Remove help support for given component (usually a JPanel)- Parameters:
comp
-
-
installHelpButton
Install help button in the desired corner, 5 pixels from the edge- Parameters:
frame
-corner
-
-
installHelpButton
Install help button in the desired corner, margin pixels from the edge- Parameters:
frame
-corner
-margin
-
-
installHelpButton
Install help button in the desired corner, 5 pixels from the edge- Parameters:
dialog
-corner
-
-
installHelpButton
Install help button in the desired corner, margin pixels from the edge- Parameters:
dialog
-corner
-margin
-
-
getContext
- Returns:
- WindowHelpContext for the passed window
-