org.crosswire.bibledesktop.display.basic

## Class URITipHelper

- java.lang.Object
- - org.crosswire.bibledesktop.display.basic.URITipHelper

- All Implemented Interfaces:
    EventListener, URIEventListener

      public class URITipHelper
      extends Object
      implements URIEventListener

  Implement URIEventListener to receive URIEvents whenever someone activates an URI.
  Author:
    Yingjie Lan
  See Also:
    `for license details.`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private URIEvent` | `event` The most recent interested event, which is used for content retrieving.
    `private int` | `formerDismissDelay`
    `private int` | `myDismissDelay`
    `private FullHTMLTip` | `tip` The tool tip to help with.
    `private String` | `txt`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `URITipHelper()` ctor: after creation, add this as a listener to a BookDataDisplay, for example: basic/TextPaneBookDataDisplay.java This class can also have a list of URIEvent content retrievers, who specialize in retrieving the content of a URI request and may also perform some kind of processing, such as converting to html (return a string if success, null o/w): Such specialized retrievers will have two methods: public boolean handles(String protocol); public String retrieve(URIEvent evt);

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `activateURI(URIEvent ev)` This method is called to indicate that an URI can be processed.
    `void` | `enterURI(URIEvent ev)` This method is called to indicate that the mouse has entered the URI.
    `JToolTip` | `fetchToolTip()`
    `String` | `getTipTitle()`
    `(package private) boolean` | `interested(URIEvent ev)`
    `void` | `leaveURI(URIEvent ev)` This method is called to indicate that the mouse has left the URI.
    `String` | `retrieve(org.crosswire.common.xml.Converter converter)` This is only called when the component needs to display the tip; note we delay this expensive operation until needed; a typical use is to have it in the getToolTipText() method of the managed component: public String getToolTipText(){ return uritip.retrieve(); }

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### formerDismissDelay

          private int formerDismissDelay

    - #### myDismissDelay

          private int myDismissDelay

    - #### tip

          private FullHTMLTip tip

      The tool tip to help with.

    - #### event

          private URIEvent event

      The most recent interested event, which is used for content retrieving.

    - #### txt

          private String txt

  - ### Constructor Detail

    - #### URITipHelper

          public URITipHelper()

      ctor: after creation, add this as a listener to a BookDataDisplay, for example: basic/TextPaneBookDataDisplay.java This class can also have a list of URIEvent content retrievers, who specialize in retrieving the content of a URI request and may also perform some kind of processing, such as converting to html (return a string if success, null o/w): Such specialized retrievers will have two methods: public boolean handles(String protocol); public String retrieve(URIEvent evt);

  - ### Method Detail

    - #### fetchToolTip

          public JToolTip fetchToolTip()

    - #### retrieve

          public String retrieve(org.crosswire.common.xml.Converter converter)

      This is only called when the component needs to display the tip; note we delay this expensive operation until needed; a typical use is to have it in the getToolTipText() method of the managed component: public String getToolTipText(){ return uritip.retrieve(); }

    - #### getTipTitle

          public String getTipTitle()

    - #### activateURI

          public void activateURI(URIEvent ev)

      This method is called to indicate that an URI can be processed.
      Specified by:
        `activateURI` in interface `URIEventListener`
      Parameters:
        `ev` - Describes the URI

    - #### enterURI

          public void enterURI(URIEvent ev)

      This method is called to indicate that the mouse has entered the URI.
      Specified by:
        `enterURI` in interface `URIEventListener`
      Parameters:
        `ev` - Describes the URI

    - #### leaveURI

          public void leaveURI(URIEvent ev)

      This method is called to indicate that the mouse has left the URI.
      Specified by:
        `leaveURI` in interface `URIEventListener`
      Parameters:
        `ev` - Describes the URI

    - #### interested

          boolean interested(URIEvent ev)

      Parameters:
        `ev` - if we are interested in this event