Package javax.help

Class HelpSet

  • All Implemented Interfaces:
    java.io.Serializable

    public class HelpSet
    extends java.lang.Object
    implements java.io.Serializable
    A HelpSet is a collection of help information consisting of a HelpSet file, table of contents (TOC), index, topic files, and Map file. The HelpSet file is the portal to the HelpSet.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      HelpSet()
      Creates an empty HelpSet.
      HelpSet​(java.lang.ClassLoader loader)
      Creates an empty HelpSet that one can parse into.
      HelpSet​(java.lang.ClassLoader loader, java.net.URL helpset)
      Creates a HelpSet.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(HelpSet hs)
      Adds a HelpSet, HelpSetEvents are generated.
      void addHelpSetListener​(HelpSetListener l)
      Adds a listener for the HelpSetEvent posted after the model has changed.
      protected void addPresentation​(HelpSet.Presentation presentation, boolean defaultPres)
      Adds a HelpSet.Presentation to the current list.
      protected void addSubHelpSet​(HelpSet hs)
      Adds a SubHelpSet to the current list.
      protected void addView​(NavigatorView view)
      Adds a NavigatorView to the current list.
      boolean contains​(HelpSet hs)
      Determines if a HelpSet is a sub-HelpSet of this object.
      HelpBroker createHelpBroker()
      Creates a presentation object for this HelpSet.
      HelpBroker createHelpBroker​(java.lang.String presentationName)
      Creates a presentation object for this HelpSet.
      static java.net.URL findHelpSet​(java.lang.ClassLoader cl, java.lang.String name)
      As above but default on locale to Locale.getDefault()
      static java.net.URL findHelpSet​(java.lang.ClassLoader cl, java.lang.String shortName, java.lang.String extension, java.util.Locale locale)
      Locates a HelpSet file and return its URL.
      static java.net.URL findHelpSet​(java.lang.ClassLoader cl, java.lang.String name, java.util.Locale locale)
      Locates a HelpSet file and return its URL.
      protected void fireHelpSetAdded​(java.lang.Object source, HelpSet helpset)
      Fires a helpSetAdded event.
      protected void fireHelpSetRemoved​(java.lang.Object source, HelpSet helpset)
      Fires a helpSetRemoved event.
      Map getCombinedMap()
      The map for this HelpSet.
      HelpSet.Presentation getDefaultPresentation()  
      java.util.Enumeration getHelpSets()
      Enumerates all the HelpSets that have been added to this one.
      java.net.URL getHelpSetURL()
      The URL that is the base for this HelpSet.
      Map.ID getHomeID()
      Returns the ID to visit when the user makes a "go home" gesture.
      java.lang.Object getKeyData​(java.lang.Object context, java.lang.String key)
      Gets some Data for a Key in a given context.
      java.lang.ClassLoader getLoader()
      A classloader to use when locating classes.
      java.util.Locale getLocale()
      Gets the locale for this HelpSet.
      Map getLocalMap()
      Get the local (i.e. non-recursive) Map for this HelpSet.
      NavigatorView getNavigatorView​(java.lang.String name)
      Gets the NavigatorView with a specific name.
      NavigatorView[] getNavigatorViews()
      NavigatorView describes the navigator views that are requested by this HelpSet.
      HelpSet.Presentation getPresentation​(java.lang.String name)
      Gets the HelpSet.Presentation with a specific name.
      HelpSet.Presentation[] getPresentations()
      HelpSet.Presentation describes the presentations that are defined by this HelpSet.
      java.lang.String getTitle()
      Gets the title of this HelpSet.
      static HelpSet parse​(java.net.URL url, java.lang.ClassLoader loader, javax.help.HelpSetFactory factory)
      Parsed a HelpSet file.
      void parseInto​(java.net.URL url, javax.help.HelpSetFactory factory)
      Parses into this HelpSet.
      boolean remove​(HelpSet hs)
      Removes a HelpSet from this HelpSet; HelpSetEvents are generated Return True if it is found, otherwise false.
      void removeHelpSetListener​(HelpSetListener l)
      Removes a listener previously added with addHelpSetListener
      void setHomeID​(java.lang.String homeID)
      Sets the Home ID for a HelpSet.
      void setKeyData​(java.lang.Object context, java.lang.String key, java.lang.Object data)
      Sets some local KeyData on a given context.
      void setLocalMap​(Map map)
      Set the Map for this HelpSet.
      void setTitle​(java.lang.String title)
      Sest the title for this HelpSet.
      java.lang.String toString()
      Prints Name for this HelpSet.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • publicIDString

        public static final java.lang.String publicIDString
        PublicID (known to this XML processor) to the DTD for version 1.0 of the HelpSet
        See Also:
        Constant Field Values
      • publicIDString_V2

        public static final java.lang.String publicIDString_V2
        PublicID (known to this XML processor) to the DTD for version 2.0 of the HelpSet
        See Also:
        Constant Field Values
      • implRegistry

        public static final java.lang.Object implRegistry
        Information for implementation customization. helpBroker/class is used to locate the class for a HelpBroker. helpBroker/loader is used to determine the ClassLoader to use.
      • helpBrokerLoader

        public static final java.lang.String helpBrokerLoader
        See Also:
        Constant Field Values
      • kitTypeRegistry

        public static final java.lang.Object kitTypeRegistry
        HelpSet context information. A HelpSet can map between keys (String) and values (Strings). There is a per-HelpSet value and a default value. The per-HelpSet value is specified in the appropriate section of the HelpSet file. The default value is global and only specified at class initialization time.
      • kitLoaderRegistry

        public static final java.lang.Object kitLoaderRegistry
    • Constructor Detail

      • HelpSet

        public HelpSet​(java.lang.ClassLoader loader)
        Creates an empty HelpSet that one can parse into.
        Parameters:
        loader - The ClassLoader to use. If loader is null, the default ClassLoader is used.
      • HelpSet

        public HelpSet()
        Creates an empty HelpSet. Uses the default ClassLoader
      • HelpSet

        public HelpSet​(java.lang.ClassLoader loader,
                       java.net.URL helpset)
                throws HelpSetException
        Creates a HelpSet. The locale for the data is either that indicated in the lang attribute of the helpset tag, or Locale.getDefault() if the lang attribute is not present.
        Parameters:
        loader - The class loader to use to locate any classes required by the navigators in the Helpset If loader is null, the default ClassLoader is used.
        helpset - The URL to the HelpSet "file"
        Throws:
        HelpSetException - if there are problems parsing the helpset
    • Method Detail

      • findHelpSet

        public static java.net.URL findHelpSet​(java.lang.ClassLoader cl,
                                               java.lang.String shortName,
                                               java.lang.String extension,
                                               java.util.Locale locale)
        Locates a HelpSet file and return its URL. Applies localization conventions.
        Parameters:
        cl - The classloader to use when searching for the resource with the appropriate name. If cl is null the default ClassLoader is used.
        shortName - The shortname of the resource.
        extension - The extension of the resource.
        locale - The desired Locale
        See Also:
        HelpUtilities
      • findHelpSet

        public static java.net.URL findHelpSet​(java.lang.ClassLoader cl,
                                               java.lang.String name,
                                               java.util.Locale locale)
        Locates a HelpSet file and return its URL. If the name does not end with the ".hs" extension, the ".hs" extension is appended and localization rules are applied to it.
        Parameters:
        cl - The classloader to use. If cl is null the default ClassLoader is used.
        name - The name of the resource.
        locale - The desired locale.
      • findHelpSet

        public static java.net.URL findHelpSet​(java.lang.ClassLoader cl,
                                               java.lang.String name)
        As above but default on locale to Locale.getDefault()
        Parameters:
        cl - The ClassLoader to use. If cl is null the default ClassLoader is used.
        name - The name of the resource.
        Returns:
        Null if not found.
      • createHelpBroker

        public HelpBroker createHelpBroker()
        Creates a presentation object for this HelpSet. Consults the implRegistry of KeyData for the class name (as helpBrokerClass) and for the ClassLoader instance (as helpBrokerLoader) and then tries to instantiate that class. It then invokes setHelpSet() with this instance of HelpSet as the argument. The resulting object is returned.
        See Also:
        createHelpBroker(java.lang.String)
      • createHelpBroker

        public HelpBroker createHelpBroker​(java.lang.String presentationName)
        Creates a presentation object for this HelpSet. Consults the implRegistry of KeyData for the class name (as helpBrokerClass) and for the ClassLoader instance (as helpBrokerLoader) and then tries to instantiate that class. It then invokes setHelpSet() with this instance of HelpSet as the argument. The resulting object is returned.
        Parameters:
        presenationName - A presentation name defined in the HelpSet that will dictate the presentation.
        Returns:
        HelpBroker The created HelpBroker
        Since:
        2.0
        See Also:
        createHelpBroker()
      • add

        public void add​(HelpSet hs)
        Adds a HelpSet, HelpSetEvents are generated. Adding a composed HelpSet to another is equivalent to adding all the HelpSets individually.
        Parameters:
        hs - The HelpSet to add.
      • remove

        public boolean remove​(HelpSet hs)
        Removes a HelpSet from this HelpSet; HelpSetEvents are generated Return True if it is found, otherwise false.
        Parameters:
        hs - The HelpSet to remove.
        Returns:
        False if the hs is null or was not in this HelpSet
      • getHelpSets

        public java.util.Enumeration getHelpSets()
        Enumerates all the HelpSets that have been added to this one.
        Returns:
        An enumeration of the HelpSets that have been added to this HelpSet.
      • contains

        public boolean contains​(HelpSet hs)
        Determines if a HelpSet is a sub-HelpSet of this object.
        Parameters:
        hs - The HelpSet to check
        Returns:
        true If hs is contained in this HelpSet or in one of its children.
      • addHelpSetListener

        public void addHelpSetListener​(HelpSetListener l)
        Adds a listener for the HelpSetEvent posted after the model has changed.
        Parameters:
        l - - The listener to add.
        Throws:
        java.lang.IllegalArgumentException - if l is null.
      • removeHelpSetListener

        public void removeHelpSetListener​(HelpSetListener l)
        Removes a listener previously added with addHelpSetListener
        Parameters:
        l - - The listener to remove.
        Throws:
        java.lang.IllegalArgumentException - if l is null.
      • fireHelpSetAdded

        protected void fireHelpSetAdded​(java.lang.Object source,
                                        HelpSet helpset)
        Fires a helpSetAdded event.
      • fireHelpSetRemoved

        protected void fireHelpSetRemoved​(java.lang.Object source,
                                          HelpSet helpset)
        Fires a helpSetRemoved event.
      • getTitle

        public java.lang.String getTitle()
        Gets the title of this HelpSet.
        Returns:
        the title
      • setTitle

        public void setTitle​(java.lang.String title)
        Sest the title for this HelpSet. This is a bound property.
        Parameters:
        title - The title to set.
      • getLocale

        public java.util.Locale getLocale()
        Gets the locale for this HelpSet.
        Returns:
        The locale.
      • getHomeID

        public Map.ID getHomeID()
        Returns the ID to visit when the user makes a "go home" gesture. This can be identified in the project file, but may also be changed programmatically or (possibly) via the UI.
        Returns:
        The ID of home. A null is returned if homeID is null or if an ID cannot be created for the homeID.
      • setHomeID

        public void setHomeID​(java.lang.String homeID)
        Sets the Home ID for a HelpSet. This is a bound property.
        Parameters:
        The - ID (in the Map) that identifies the default topic for this HelpSet. Null is valid homeID.
      • getCombinedMap

        public Map getCombinedMap()
        The map for this HelpSet. This map involves the closure of this HelpSet's children HelpSets.
        Returns:
        The map
      • getLocalMap

        public Map getLocalMap()
        Get the local (i.e. non-recursive) Map for this HelpSet. This Map does not include the Maps for its children.
        Returns:
        The Map object that associates ID->URL. A null map is valid.
      • setLocalMap

        public void setLocalMap​(Map map)
        Set the Map for this HelpSet. This Map object is not recursive; for example, it does not include the Maps for its children.
        Parameters:
        The - Map object that associates ID->URL. A null map is a valid.
      • getHelpSetURL

        public java.net.URL getHelpSetURL()
        The URL that is the base for this HelpSet.
        Returns:
        The URL that is base to this HelpSet.
      • getLoader

        public java.lang.ClassLoader getLoader()
        A classloader to use when locating classes.
        Returns:
        The ClassLoader to use when locating classes mentioned in this HelpSet.
      • getNavigatorViews

        public NavigatorView[] getNavigatorViews()
        NavigatorView describes the navigator views that are requested by this HelpSet.
        Returns:
        The array of NavigatorView.
      • getNavigatorView

        public NavigatorView getNavigatorView​(java.lang.String name)
        Gets the NavigatorView with a specific name.
        Parameters:
        The - name of the desired navigator view.
      • getPresentations

        public HelpSet.Presentation[] getPresentations()
        HelpSet.Presentation describes the presentations that are defined by this HelpSet.
        Returns:
        The array of HelpSet.Presentations.
      • getPresentation

        public HelpSet.Presentation getPresentation​(java.lang.String name)
        Gets the HelpSet.Presentation with a specific name.
        Parameters:
        The - name of the desired HelpSet.Presentation.
      • toString

        public java.lang.String toString()
        Prints Name for this HelpSet.
        Overrides:
        toString in class java.lang.Object
      • parse

        public static HelpSet parse​(java.net.URL url,
                                    java.lang.ClassLoader loader,
                                    javax.help.HelpSetFactory factory)
        Parsed a HelpSet file.
      • parseInto

        public void parseInto​(java.net.URL url,
                              javax.help.HelpSetFactory factory)
        Parses into this HelpSet.
      • addView

        protected void addView​(NavigatorView view)
        Adds a NavigatorView to the current list.
      • addSubHelpSet

        protected void addSubHelpSet​(HelpSet hs)
        Adds a SubHelpSet to the current list.
      • addPresentation

        protected void addPresentation​(HelpSet.Presentation presentation,
                                       boolean defaultPres)
        Adds a HelpSet.Presentation to the current list.
      • getKeyData

        public java.lang.Object getKeyData​(java.lang.Object context,
                                           java.lang.String key)
        Gets some Data for a Key in a given context. Local (per HelpSet instance) data is searched first, then defaults.
      • setKeyData

        public void setKeyData​(java.lang.Object context,
                               java.lang.String key,
                               java.lang.Object data)
        Sets some local KeyData on a given context. The information is set on a per-HelpSet basis.