Class ContextHelp

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

public class ContextHelp extends 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
  • Field Details

  • Constructor Details

    • ContextHelp

      protected ContextHelp()
  • 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(String helpPage)
      Open helpPath in browser
      Parameters:
      helpPage - path relative to https://jalbum.net/help or absolute URL
    • add

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

      public void addTree(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(JComponent comp)
      Remove help support for given component (usually a JPanel)
      Parameters:
      comp -
    • installHelpButton

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

      public void installHelpButton(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(JDialog dialog, ContextHelp.Corner corner)
      Install help button in the desired corner, 5 pixels from the edge
      Parameters:
      dialog -
      corner -
    • installHelpButton

      public void installHelpButton(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(Window window)
      Returns:
      WindowHelpContext for the passed window