Class ContextHelp

java.lang.Object
se.datadosen.util.ContextHelp

public class ContextHelp
extends java.lang.Object
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

    Nested Classes 
    Modifier and Type Class Description
    static class  ContextHelp.Corner  
    class  ContextHelp.WindowHelpContext  
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String HELP_PAGE  
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected ContextHelp()  
  • Method Summary

    Modifier and Type Method Description
    void add​(javax.swing.JComponent comp, java.lang.String helpPage)
    Add help support for given component (usually a JPanel)
    void addTree​(javax.swing.JComponent container)
    Add help support to component tree containing "helpPage" client properties on JPanels
    ContextHelp.WindowHelpContext getContext​(java.awt.Window window)  
    static ContextHelp getInstance()  
    void installHelpButton​(javax.swing.JDialog dialog, ContextHelp.Corner corner)
    Install help button in the desired corner, 5 pixels from the edge
    void installHelpButton​(javax.swing.JDialog dialog, ContextHelp.Corner corner, int margin)
    Install help button in the desired corner, margin pixels from the edge
    void installHelpButton​(javax.swing.JFrame frame, ContextHelp.Corner corner)
    Install help button in the desired corner, 5 pixels from the edge
    void installHelpButton​(javax.swing.JFrame frame, ContextHelp.Corner corner, int margin)
    Install help button in the desired corner, margin pixels from the edge
    protected void open​(java.lang.String helpPage)
    Open helpPath in browser
    void remove​(javax.swing.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()

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • getInstance

      public static ContextHelp getInstance()
    • setInstance

      public 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()
      Parameters:
      instance -
    • open

      protected void open​(java.lang.String helpPage)
      Open helpPath in browser
      Parameters:
      helpPage - path relative to https://jalbum.net/help or absolute URL
    • add

      public void add​(javax.swing.JComponent comp, java.lang.String helpPage)
      Add help support for given component (usually a JPanel)
      Parameters:
      comp -
      helpPage -
    • addTree

      public void addTree​(javax.swing.JComponent container)
      Add help support to component tree containing "helpPage" client properties on JPanels
      Parameters:
      container - root of component tree to add
    • remove

      public void remove​(javax.swing.JComponent comp)
      Remove help support for given component (usually a JPanel)
      Parameters:
      comp -
    • installHelpButton

      public void installHelpButton​(javax.swing.JFrame frame, ContextHelp.Corner corner)
      Install help button in the desired corner, 5 pixels from the edge
      Parameters:
      frame -
      corner -
    • installHelpButton

      public void installHelpButton​(javax.swing.JFrame frame, ContextHelp.Corner corner, int margin)
      Install help button in the desired corner, margin pixels from the edge
      Parameters:
      frame -
      corner -
      margin -
    • installHelpButton

      public void installHelpButton​(javax.swing.JDialog dialog, ContextHelp.Corner corner)
      Install help button in the desired corner, 5 pixels from the edge
      Parameters:
      dialog -
      corner -
    • installHelpButton

      public void installHelpButton​(javax.swing.JDialog dialog, ContextHelp.Corner corner, int margin)
      Install help button in the desired corner, margin pixels from the edge
      Parameters:
      dialog -
      corner -
      margin -
    • getContext

      public ContextHelp.WindowHelpContext getContext​(java.awt.Window window)
      Returns:
      WindowHelpContext for the passed window