Class JHelpAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- com.jstatcom.component.JHelpAction
-
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
public class JHelpAction extends javax.swing.AbstractActionThis class provides anAbstractActionthat is geared towards supporting the creation and display ofJavaHelpsets. It should be constructed via theget*Instancestatic factory methods that create instances of this class with slightly different behaviour.Usage note:
Because usually there is only one helpset loaded in an application, theHelpBrokerisstaticand needs to be constructed first. Therefore thestartHelpWorkermethod must be invoked before any help action can be carried out. It takes the name of the helpset as an argument and constructs theHelpBrokerin a worker thread. This should be done at program start.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidactionPerformed(java.awt.event.ActionEvent evt)Action method that is invoked, when an action event is catched.static JHelpActiongetFocusInstance(java.lang.String name)Gets an instance of this class that invokesshowHelpFromFocusin itsactionPerformedmethod.static JHelpActiongetFocusInstance(java.lang.String name, javax.swing.Icon icon)Same usage asgetFocusInstance(String name)but with an icon.static JHelpActiongetShowHelpInstance(java.lang.String name)Gets an instance of this class that invokesshowHelpin itsactionPerformedmethod.static JHelpActiongetShowHelpInstance(java.lang.String name, javax.swing.Icon icon)Same usage asgetShowHelpInstance(String name)but with an icon.static JHelpActiongetShowIDInstance(java.lang.String name, javax.swing.Icon icon, java.lang.String helpID)Same usage asgetShowIDInstance(String name, String helpID)but with an icon.static JHelpActiongetShowIDInstance(java.lang.String name, java.lang.String helpID)Gets an instance of this class that invokesshowHelp(helpID)in itsactionPerformedmethod.static JHelpActiongetTrackInstance(java.lang.String name)Gets an instance of this class that invokestrackFieldHelpin itsactionPerformedmethod.static JHelpActiongetTrackInstance(java.lang.String name, javax.swing.Icon icon)Same usage asgetTrackInstance(String name)but with an icon.static voidshowHelp()Shows the helpset that has been initialized viastartHelpWorker.static voidshowHelp(java.lang.String target)Shows the topic associated withtargetin the helpset that has been initialized viastartHelpWorker.static voidshowHelpFromFocus()Shows the topic associated with the component that currently has focus in the helpset that has been initialized viastartHelpWorker.static voidstartHelpWorker(java.util.List helpSetList)Creates a worker thread to initialize aHelpBrokerobject for a helpsets contained inhelpSetList.static voidstartHelpWorker(java.lang.String hSetName)Creates a worker thread to initialize aHelpBrokerobject for a helpset specified byhSetName.static voidtrackFieldHelp()Shows the topic associated with the component that is clicked on with the mouse in the helpset that has been initialized viastartHelpWorker.
-
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent evt)
Action method that is invoked, when an action event is catched.- Parameters:
evt- the action event- Throws:
java.lang.IllegalStateException- ifHelpBrokerwas not initialized viastartHelpWorkerbefore
-
getFocusInstance
public static JHelpAction getFocusInstance(java.lang.String name)
Gets an instance of this class that invokesshowHelpFromFocusin itsactionPerformedmethod. When this action is invoked, the helptopic for the component that currently has focus is displayed, given that it has a validhelpID.- Parameters:
name- the name of the action, usually displayed as text in components acceptingAbstractActionobjects- Returns:
- initialized action object that displays the helpset set by
startHelpWorker
-
getFocusInstance
public static JHelpAction getFocusInstance(java.lang.String name, javax.swing.Icon icon)
Same usage asgetFocusInstance(String name)but with an icon.- Parameters:
name- the name of the action, usually displayed as text in components acceptingAbstractActionobjectsicon- the icon to be displayed by components accepting this action- Returns:
- initialized action object that displays the helpset set by
startHelpWorker
-
getShowHelpInstance
public static JHelpAction getShowHelpInstance(java.lang.String name)
Gets an instance of this class that invokesshowHelpin itsactionPerformedmethod.- Parameters:
name- the name of the action, usually displayed as text in components acceptingAbstractActionobjects- Returns:
- initialized action object that displays the helpset set by
startHelpWorker
-
getShowHelpInstance
public static JHelpAction getShowHelpInstance(java.lang.String name, javax.swing.Icon icon)
Same usage asgetShowHelpInstance(String name)but with an icon.- Parameters:
name- the name of the action, usually displayed as text in components acceptingAbstractActionobjectsicon- the icon to be displayed by components accepting this action- Returns:
- initialized action object that displays the helpset set by
startHelpWorker
-
getShowIDInstance
public static JHelpAction getShowIDInstance(java.lang.String name, java.lang.String helpID)
Gets an instance of this class that invokesshowHelp(helpID)in itsactionPerformedmethod. When this action is invoked, the helptopic associated withhelpIDis displayed.- Parameters:
name- the name of the action, usually displayed as text in components acceptingAbstractActionobjectshelpID- the identifier for the helptopic to display, must be a valid target, for examplehtml.var_modeling- Returns:
- initialized action object that displays the helpset set by
startHelpWorker
-
getShowIDInstance
public static JHelpAction getShowIDInstance(java.lang.String name, javax.swing.Icon icon, java.lang.String helpID)
Same usage asgetShowIDInstance(String name, String helpID)but with an icon.- Parameters:
name- the name of the action, usually displayed as text in components acceptingAbstractActionobjectsicon- the icon to be displayed by components accepting this actionhelpID- the identifier for the helptopic to display, must be a valid target, for examplehtml.var_modeling- Returns:
- initialized action object that displays the helpset set by
startHelpWorker
-
getTrackInstance
public static JHelpAction getTrackInstance(java.lang.String name)
Gets an instance of this class that invokestrackFieldHelpin itsactionPerformedmethod. When this action is invoked, the helptopic for the component that is clicked on next is displayed, given that it has a validhelpID. The mouse pointer changes during that operation. This is useful for displaying context sensitive help.- Parameters:
name- the name of the action, usually displayed as text in components acceptingAbstractActionobjects- Returns:
- initialized action object that displays the helpset set by
startHelpWorker
-
getTrackInstance
public static JHelpAction getTrackInstance(java.lang.String name, javax.swing.Icon icon)
Same usage asgetTrackInstance(String name)but with an icon.- Parameters:
name- the name of the action, usually displayed as text in components acceptingAbstractActionobjectsicon- the icon to be displayed by components accepting this action- Returns:
- initialized action object that displays the helpset set by
startHelpWorker
-
showHelp
public static void showHelp()
Shows the helpset that has been initialized viastartHelpWorker.- Throws:
java.lang.IllegalStateException- ifHelpBrokerwas not initialized viastartHelpWorkerbefore
-
showHelp
public static void showHelp(java.lang.String target)
Shows the topic associated withtargetin the helpset that has been initialized viastartHelpWorker.- Parameters:
target- the help ID to display- Throws:
java.lang.IllegalStateException- ifHelpBrokerwas not initialized viastartHelpWorkerbefore
-
showHelpFromFocus
public static void showHelpFromFocus()
Shows the topic associated with the component that currently has focus in the helpset that has been initialized viastartHelpWorker. If the component does not have a valid help ID, the default topic is displayed.- Throws:
java.lang.IllegalStateException- ifHelpBrokerwas not initialized viastartHelpWorkerbefore
-
startHelpWorker
public static void startHelpWorker(java.lang.String hSetName)
Creates a worker thread to initialize aHelpBrokerobject for a helpset specified byhSetName.This method should be called at program start to prepare the helpset for display. Usually it should only be called once. All other methods rely on the availability of the
HelpBrokerobject created by this method. this method.- Parameters:
hSetName- the name of the helpset to statically initializeJHelpActionwith, must be a valid filename that can be transformed to aURL, usually stated relative to the resource directory of this class- Throws:
java.lang.IllegalArgumentException-if (hSetName == null)
-
startHelpWorker
public static void startHelpWorker(java.util.List helpSetList)
Creates a worker thread to initialize aHelpBrokerobject for a helpsets contained inhelpSetList. All helpsets are merged dynamically.This method should be called at program start to prepare the helpset for display. Usually it should only be called once. All other methods rely on the availability of the
HelpBrokerobject created by this method.- Parameters:
helpSetList- the list containing all helpsets to merge and load- Throws:
java.lang.IllegalArgumentException-if (helpSetList == null)
-
trackFieldHelp
public static void trackFieldHelp()
Shows the topic associated with the component that is clicked on with the mouse in the helpset that has been initialized viastartHelpWorker. If the component does not have a valid help ID, the default topic is displayed. This operation is useful for implementing context sensitive help.- Throws:
java.lang.IllegalStateException- ifHelpBrokerwas not initialized viastartHelpWorkerbefore
-
-
DMelt 3.0 © DataMelt by jWork.ORG