Class TLcyCompositeHyperlinkListener

java.lang.Object
com.luciad.lucy.util.TLcyGenericComposite<HyperlinkListener>
com.luciad.lucy.util.hyperlink.TLcyCompositeHyperlinkListener
All Implemented Interfaces:
Iterable<HyperlinkListener>, EventListener, HyperlinkListener

public class TLcyCompositeHyperlinkListener extends TLcyGenericComposite<HyperlinkListener> implements HyperlinkListener

Composite implementation (see composite design pattern) of HyperlinkListener. It keeps a list of associated HyperlinkListeners: one can add and remove other HyperlinkListeners to this HyperlinkListener. When a HyperlinkEvent is fired, it loops over its associated HyperlinkListeners and notifies all of them. It is up to the registered HyperlinkListeners to determine whether or not the fired HyperlinkEvent is relevant.

When creating a new TLcyCompositeHyperlinkListener using the default constructor (see TLcyCompositeHyperlinkListener()), the created instance will only work on/with the HyperlinkListeners registered on this composite instance (see addHyperlinkListener(HyperlinkListener) and removeHyperlinkListener(HyperlinkListener)).

When creating a new TLcyCompositeHyperlinkListener using the constructor specifying an ILcyLucyEnv instance (see TLcyCompositeHyperlinkListener(com.luciad.lucy.ILcyLucyEnv), the created instance will work on the Lucy back-end services. It will use all registered HyperlinkListener instances of the Lucy back-end, adding and/or removing an HyperlinkListener will add/remove the HyperlinkListener as service from Lucy, ... .

Since:
10.0
  • Constructor Details

  • Method Details

    • addHyperlinkListener

      public void addHyperlinkListener(HyperlinkListener aHyperlinkListener)

      Adds the given HyperlinkListener to this composite hyperlink listener. The registered HyperlinkListener will be notified of every HyperlinkEvent that is dispatched to the TLcyCompositeHyperlinkListener

      If the constructor specifying an ILcyLucyEnv is used, the HyperlinkListener will be registered as a service on the Lucy back-end (see ILcyLucyEnv.addService(Object, int)). When calling ILcyLucyEnv.getServices(Class) afterwards, aHyperlinkListener will only be included in the returned list when the requested class was HyperlinkListener.class.
      Note: if you want to remove the registered HyperlinkListener afterwards, use removeHyperlinkListener(javax.swing.event.HyperlinkListener) and not ILcyLucyEnv.removeService(Object).

      Parameters:
      aHyperlinkListener - A HyperlinkListener that should be registered.
      See Also:
    • removeHyperlinkListener

      public void removeHyperlinkListener(HyperlinkListener aHyperlinkListener)

      Removes the given HyperlinkListener from this composite hyperlink listener. If the given HyperlinkListener was never added before, nothing happens.

      If the constructor specifying an ILcyLucyEnv is used, the HyperlinkListener will be removed as service from the Lucy back-end (see ILcyLucyEnv.removeService(Object)).
      Note: it is only possible to remove HyperlinkListener instances which were registered using the addHyperlinkListener(javax.swing.event.HyperlinkListener) method.

      Parameters:
      aHyperlinkListener - A HyperlinkListener to remove.
      See Also:
    • getHyperlinkListenerCount

      public int getHyperlinkListenerCount()

      Returns the number of currently registered hyperlink listeners.

      Returns:
      The number of associated HyperlinkListeners.
    • getHyperlinkListener

      public HyperlinkListener getHyperlinkListener(int aIndex)

      Returns the HyperlinkListener at the given index.

      Parameters:
      aIndex - the index of the HyperlinkListener to return.
      Returns:
      The associated HyperlinkListener at the given index.
    • hyperlinkUpdate

      public void hyperlinkUpdate(HyperlinkEvent aHyperlinkEvent)
      Implementation of HyperlinkListener.hyperlinkUpdate. Loops over all associated HyperlinkListenerss and dispatches the event to each of them.
      Specified by:
      hyperlinkUpdate in interface HyperlinkListener
      Parameters:
      aHyperlinkEvent - A HyperlinkEvent.