Package javax.help

Class CSH


  • public class CSH
    extends java.lang.Object
    A convenience class that provides simple access to context-senstive help functionality. It creates a default JavaHelp viewer as well as ActionListeners for "Help" keys, on-item help, and help buttons.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  CSH.DisplayHelpAfterTracking
      An ActionListener that displays help on a selected object after tracking context-sensitive events.
      static class  CSH.DisplayHelpFromFocus
      An ActionListener that displays the help of the object that currently has focus.
      static class  CSH.DisplayHelpFromSource
      An ActionListener that gets the helpID for the action source and displays the helpID in the help viewer.
      static interface  CSH.Manager
      CSH Manager Interface to support dynamic HelpSet and ID for object.
    • Constructor Summary

      Constructors 
      Constructor Description
      CSH()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addManager​(int i, CSH.Manager m)
      Registers the specified manager to maintain dynamic CSH at the specified position in list of managers.
      static void addManager​(CSH.Manager m)
      Registers the specified manager to maintain dynamic CSH.
      static java.lang.String getHelpIDString​(java.awt.Component comp)
      Returns the static helpID for a component.
      static java.lang.String getHelpIDString​(java.awt.MenuItem comp)
      Returns the static helpID for a MenuItem.
      static java.lang.String getHelpIDString​(java.lang.Object comp, java.awt.AWTEvent evt)
      Returns the dynamic HelpID for a object.
      static HelpSet getHelpSet​(java.awt.Component comp)
      Returns the static HelpSet for a Component.
      static HelpSet getHelpSet​(java.awt.MenuItem comp)
      Returns the static HelpSet for a MenuItem.
      static HelpSet getHelpSet​(java.lang.Object comp, java.awt.AWTEvent evt)
      Returns the dynamic HelpSet for an object.
      static CSH.Manager getManager​(int i)
      Returns the manager at the specified position in manager list.
      static int getManagerCount()
      Returns the number of managers registered to maintain dynamic CSH.
      static CSH.Manager[] getManagers()
      Returns array of managers registered to maintain dynamic CSH.
      static void removeAllManagers()
      Removes all managers from manager list.
      static void removeManager​(int i)
      Removes the manager at the specified position in manager list.
      static boolean removeManager​(CSH.Manager m)
      Removes the first occurrence of the specified manager in manager list.
      static void setHelpIDString​(java.awt.Component comp, java.lang.String helpID)
      Sets the helpID for a Component.
      static void setHelpIDString​(java.awt.MenuItem comp, java.lang.String helpID)
      Sets the helpID for a MenuItem.
      static void setHelpSet​(java.awt.Component comp, HelpSet hs)
      Sets the static HelpSet for a Component.
      static void setHelpSet​(java.awt.MenuItem comp, HelpSet hs)
      Sets the static HelpSet for a MenuItem.
      static java.lang.Object trackCSEvents()
      Context Sensitive Event Tracking Creates a new EventDispatchThread from which to dispatch events.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CSH

        public CSH()
    • Method Detail

      • addManager

        public static void addManager​(CSH.Manager m)
        Registers the specified manager to maintain dynamic CSH.
        Parameters:
        m - the CSH manager
        Since:
        2.0
      • addManager

        public static void addManager​(int i,
                                      CSH.Manager m)
        Registers the specified manager to maintain dynamic CSH at the specified position in list of managers.
        Parameters:
        i - index at which specified manager is to be inserted.
        m - the CSH manager
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - index out of range (i < 0 || i >= CSH.getManagerCount()).
        Since:
        2.0
      • removeManager

        public static boolean removeManager​(CSH.Manager m)
        Removes the first occurrence of the specified manager in manager list.
        Parameters:
        m - manager to be removed from the list, if present.
        Returns:
        true if the list contained the specified manager.
        Since:
        2.0
      • removeManager

        public static void removeManager​(int i)
        Removes the manager at the specified position in manager list.
        Parameters:
        i - the index of the manager to removed.
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - index out of range (i < 0 || i >= CHS.getManagerCount()).
        Since:
        2.0
      • removeAllManagers

        public static void removeAllManagers()
        Removes all managers from manager list.
        Since:
        2.0
      • getManager

        public static CSH.Manager getManager​(int i)
        Returns the manager at the specified position in manager list.
        Parameters:
        i - index of manager to return.
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - index is out of range (i < 0 || i >= CSH.getManagerCount()).
        Since:
        2.0
      • getManagers

        public static CSH.Manager[] getManagers()
        Returns array of managers registered to maintain dynamic CSH.
        Returns:
        an array containing the managers.
        Throws:
        java.lang.ArrayStoreException - the runtime type of a manager is not a CSH.Manager
        Since:
        2.0
      • getManagerCount

        public static int getManagerCount()
        Returns the number of managers registered to maintain dynamic CSH.
        Returns:
        the number of managers.
        Since:
        2.0
      • setHelpIDString

        public static void setHelpIDString​(java.awt.Component comp,
                                           java.lang.String helpID)
        Sets the helpID for a Component. If helpID is null this method removes the helpID from the component.
        Throws:
        java.lang.IllegalArgumentException - comp is neither Component nor
      • setHelpIDString

        public static void setHelpIDString​(java.awt.MenuItem comp,
                                           java.lang.String helpID)
        Sets the helpID for a MenuItem. If helpID is null, this method removes the helpID from the component.
        Throws:
        java.lang.IllegalArgumentException - comp is neither Component nor
      • getHelpIDString

        public static java.lang.String getHelpIDString​(java.lang.Object comp,
                                                       java.awt.AWTEvent evt)
        Returns the dynamic HelpID for a object. The method passes the arguments into all registered CSH manageres to obtain dynamic HelpID. If no manager provides HelpID for the object, the static HelpID is returned or traverse to the component's ancestors for help.
        Throws:
        java.lang.IllegalArgumentException - comp is neither Component nor MenuItem.
        Since:
        2.0
      • getHelpIDString

        public static java.lang.String getHelpIDString​(java.awt.Component comp)
        Returns the static helpID for a component. If the component doesn't have associated help, traverse the component's ancestors for help.

        This method calls CSH.getHelpIDString(comp, null).

        See Also:
        setHelpIDString(Component, String)
      • getHelpIDString

        public static java.lang.String getHelpIDString​(java.awt.MenuItem comp)
        Returns the static helpID for a MenuItem. If the component doesn't have associated help, traverse the component's ancestors for help.

        This method calls CSH.getHelpIDString(comp, null).

        See Also:
        setHelpIDString(MenuItem, String)
      • setHelpSet

        public static void setHelpSet​(java.awt.Component comp,
                                      HelpSet hs)
        Sets the static HelpSet for a Component. If HelpSet is null, this method removes the HelpSet from the component.
      • setHelpSet

        public static void setHelpSet​(java.awt.MenuItem comp,
                                      HelpSet hs)
        Sets the static HelpSet for a MenuItem. If HelpSet is null, this method removes the HelpSet from the component.
      • getHelpSet

        public static HelpSet getHelpSet​(java.lang.Object comp,
                                         java.awt.AWTEvent evt)
        Returns the dynamic HelpSet for an object. HelpSets are stored in conjunction with helpIDs. It is possible for a object to have a helpID without a HelpSet, but a object cannot have a HelpSet without a helpID. If the component doesn't have an associated helpID, traverse the component's ancestors for a helpID. If the componet has a helpID but doesn't have a HelpSet, return null.
        Throws:
        java.lang.IllegalArgumentException - comp is neither Component nor MenuItem.
        See Also:
        getHelpID
      • getHelpSet

        public static HelpSet getHelpSet​(java.awt.Component comp)
        Returns the static HelpSet for a Component. HelpSets are stored in conjunction with helpIDs. It is possible for a Component to have a helpID without a HelpSet, but a Component cannot have a HelpSet without a helpID. If the component doesn't have an associated helpID, traverse the component's ancestors for a helpID. If the componet has a helpID but doesn't have a HelpSet, return null.

        This method calls CSH.getHelpSet(comp, null).

        Throws:
        java.lang.IllegalArgumentException - comp is not Component
        See Also:
        getHelpID
      • getHelpSet

        public static HelpSet getHelpSet​(java.awt.MenuItem comp)
        Returns the static HelpSet for a MenuItem. HelpSets are stored in conjunction with helpIDs. It is possible for a MenuItem to have a helpID without a HelpSet, but a MenuItem cannot have a HelpSet without a helpID. If the component doesn't have an associated helpID, traverse the component's ancestors for a helpID. If the componet has a helpID, but doesn't have a HelpSet return null. This method calls CSH.getHelpIDString(comp, null).
        Throws:
        java.lang.IllegalArgumentException - comp is not MenuItem
        See Also:
        getHelpID
      • trackCSEvents

        public static java.lang.Object trackCSEvents()
        Context Sensitive Event Tracking Creates a new EventDispatchThread from which to dispatch events. This method returns when stopModal is invoked.
        Returns:
        Object The object on which the event occurred. Null if cancelled on an undetermined object.