wt.help
Class NFHelpContext

java.lang.Object
  extended bywt.help.NFHelpContext
All Implemented Interfaces:
HelpContext

public class NFHelpContext
extends Object
implements HelpContext

Class NFHelpContext provides an implementation of the HelpContext interface. Instances of NFHelpContext subscribes to its target contextContainer and its components for focus events and f1 key strokes.

Supported API: true
Extendable: false


Nested Class Summary
private  class NFHelpContext.HelpComponentListener
           
private  class NFHelpContext.HelpContainerListener
          Inner class used to monitor the context container for help events.
 
Field Summary
private  PropertyChangeSupport changes
           
private  com.objectspace.jgl.HashMap componentListeners
           
private  Container container
          The container to which this help context applies.
private static boolean containerFocusOnMousePressed
           
protected  boolean containerGetsFocusOnMousePressed
          Implementation fields.
private  String contextId
          The id for the target context.
private  NFHelpContext.HelpContainerListener helpContainerListener
           
private  HelpSystem helpSystem
          The help system.
private  String toolDescription
          The tool description for the component under the mouse.
private  TextComponent toolDescriptionTextComponent
           
private  ToolTips toolTips
          Delegate to manage tool tips.
private  String toolTipText
          The tool tip for the component under the mouse.
 
Fields inherited from interface wt.help.HelpContext
CONTAINER, CONTEXT_ID, HELP_SYSTEM, TOOL_DESCRIPTION, TOOL_TIP_TEXT
 
Constructor Summary
NFHelpContext(Container container, HelpSystem helpSystem, String contextId)
          Construct a NFHelpContext which will monitor the contextContainer and its components for focus events, and f1 key.
 
Method Summary
 void addComponentHelp(Component component)
          Add a container component to the help context and use its name as the help context id.
 void addComponentHelp(Component component, String topicId)
          Add a container component to the help context and use the passed topicid as its help key.
protected  void addContainerComponents(Container container)
           
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a property change listener which may listen for changes to properties and attributes specified above.
 Container getContainer()
          Getter for the context container.
 String getContextId()
          Return the help sub-key for this context.
 HelpSystem getHelpSystem()
          Getter for the helpSystem property.
 String getToolDescription()
          Getter for the toolDescription attribute.
 String getToolTipText()
          Getter for the toolTipText attribute.
 void initialize()
          Initialize the help context.
 void removeComponentHelp(Component component)
          Remove the component from the list of context help entries.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove the listener from the list of property change listeners.
 void setContainer(Container newValue)
          Setter for the context container.
 void setContextId(String newValue)
          Setter for the contextId.
 void setHelpSystem(HelpSystem newValue)
          Setter for the help desk property.
protected  void setToolDescription(String newValue)
           
 void setToolDescriptionDisplay(TextComponent textComponent)
          Operation settoolDescriptionDisplay is a convensiance operation which allows the client to specify a TextComponent which is used to display the tool description for the component which is under the mouse.
protected  void setToolTipText(String newValue)
           
 void showContents()
          Show help contents based on this context id.
 void stopIt()
          Stop context help and release resources.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

containerFocusOnMousePressed

private static boolean containerFocusOnMousePressed

helpSystem

private HelpSystem helpSystem
The help system.


contextId

private String contextId
The id for the target context. Used to form a URL which is used to launch help.


container

private Container container
The container to which this help context applies.


toolDescription

private String toolDescription
The tool description for the component under the mouse. May be null.


toolTipText

private String toolTipText
The tool tip for the component under the mouse.


containerGetsFocusOnMousePressed

protected boolean containerGetsFocusOnMousePressed
Implementation fields.


toolDescriptionTextComponent

private TextComponent toolDescriptionTextComponent

helpContainerListener

private NFHelpContext.HelpContainerListener helpContainerListener

componentListeners

private com.objectspace.jgl.HashMap componentListeners

changes

private PropertyChangeSupport changes

toolTips

private ToolTips toolTips
Delegate to manage tool tips.

Constructor Detail

NFHelpContext

public NFHelpContext(Container container,
                     HelpSystem helpSystem,
                     String contextId)
              throws PropertyVetoException
Construct a NFHelpContext which will monitor the contextContainer and its components for focus events, and f1 key. The initialize operation is automatically called.

Parameters:
container - the container for this help context.
helpSystem - the help system for this context.
contextId - the help sub-key for this context.
Throws:
PropertyVetoException - if any of the parameters is invalid.
Method Detail

initialize

public void initialize()
                throws PropertyVetoException
Description copied from interface: HelpContext
Initialize the help context. This operation requires that the helpSystem, contextId, and the container have been set.

Operation initialize causes this HelpContext to start listening to the container and its components. The topic id for each component defaults to the components name. This means that the components name should match the topic id. To override a component topic id use operation addComponentHelp.

Specified by:
initialize in interface HelpContext
Throws:
PropertyVetoException - if any of the fields has been improperly set.

addContainerComponents

protected void addContainerComponents(Container container)

getHelpSystem

public HelpSystem getHelpSystem()
Description copied from interface: HelpContext
Getter for the helpSystem property.

Specified by:
getHelpSystem in interface HelpContext
Returns:
the help system for this context.

setHelpSystem

public void setHelpSystem(HelpSystem newValue)
                   throws PropertyVetoException
Setter for the help desk property.

Specified by:
setHelpSystem in interface HelpContext
Parameters:
newValue - the new help desk.
Throws:
PropertyVetoException - if the new value is inavlid.

getContextId

public String getContextId()
Return the help sub-key for this context.

Specified by:
getContextId in interface HelpContext
Returns:
the help sub-key for this context.

setContextId

public void setContextId(String newValue)
                  throws PropertyVetoException
Setter for the contextId.

Specified by:
setContextId in interface HelpContext
Parameters:
newValue - the new value fof the context id.
Throws:
PropertyVetoException - if the new value is invalid.

getContainer

public Container getContainer()
Getter for the context container.

Specified by:
getContainer in interface HelpContext
Returns:
the container instance, may be null.

setContainer

public void setContainer(Container newValue)
                  throws PropertyVetoException
Setter for the context container.

Specified by:
setContainer in interface HelpContext
Parameters:
newValue - the new context container.
Throws:
PropertyVetoException - if the new property is invalid.

getToolDescription

public String getToolDescription()
Description copied from interface: HelpContext
Getter for the toolDescription attribute. This returns the tool description for the component over which the mouse resides.

Specified by:
getToolDescription in interface HelpContext
Returns:
the tool description.

setToolDescription

protected void setToolDescription(String newValue)
                           throws PropertyVetoException
Parameters:
newValue - the new value of the tool description.
Throws:
PropertyVetoException - if the new value is invalid.

getToolTipText

public String getToolTipText()
Description copied from interface: HelpContext
Getter for the toolTipText attribute. This returns the current tool tip text.

Specified by:
getToolTipText in interface HelpContext
Returns:
the tool tip text.

setToolTipText

protected void setToolTipText(String newValue)
                       throws PropertyVetoException
Parameters:
newValue - the new value of the tool tip text.
Throws:
PropertyVetoException - if the new value is invalid.

setToolDescriptionDisplay

public void setToolDescriptionDisplay(TextComponent textComponent)
Description copied from interface: HelpContext
Operation settoolDescriptionDisplay is a convensiance operation which allows the client to specify a TextComponent which is used to display the tool description for the component which is under the mouse. This is a conveniance because this function could be achieved using the addPropertyChangeListener and listening for PropertyChangeEvents which have property name TOOL_DESCRIPTION.

Specified by:
setToolDescriptionDisplay in interface HelpContext
Parameters:
textComponent - an instance of TextComponent.

showContents

public void showContents()
Show help contents based on this context id.

Specified by:
showContents in interface HelpContext

addComponentHelp

public void addComponentHelp(Component component,
                             String topicId)
Add a container component to the help context and use the passed topicid as its help key.

Specified by:
addComponentHelp in interface HelpContext
Parameters:
component - component to monitor for help events.
topicId - the help system topic id.

addComponentHelp

public void addComponentHelp(Component component)
Add a container component to the help context and use its name as the help context id.

Parameters:
component - component to monitor for help events.

removeComponentHelp

public void removeComponentHelp(Component component)
Remove the component from the list of context help entries.

Specified by:
removeComponentHelp in interface HelpContext
Parameters:
component - the component to remove from the list.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: HelpContext
Add a property change listener which may listen for changes to properties and attributes specified above.

Specified by:
addPropertyChangeListener in interface HelpContext
Parameters:
listener - the listener.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: HelpContext
Remove the listener from the list of property change listeners.

Specified by:
removePropertyChangeListener in interface HelpContext
Parameters:
listener - the listener to remove.

stopIt

public void stopIt()
Stop context help and release resources.

Specified by:
stopIt in interface HelpContext