org.exoplatform.social.client.core.util
Class LifecycleSupport<M,L>

java.lang.Object
  extended by org.exoplatform.social.client.core.util.LifecycleSupport<M,L>

public final class LifecycleSupport<M,L>
extends Object

This is a utility class that can be used by models that assist in firing LifecycleEvent notifications to registered LifecycleListeners and delegate various work to it

Author:
thanh_vucong

Constructor Summary
LifecycleSupport(Lifecycle<M,L> lifecycle)
          Constructs a new LifecycleHelper object associated with the specified Lifecycle component.
 
Method Summary
 void addLifecycleListener(LifecycleListener<M,L> listener)
          Adds a Lifecycle event listener to this component.
 void broadcastEvent(String type, L data)
          Notifies all Lifecycle event listeners that a particular event has occurred for this Container.
 LifecycleListener<M,L>[] findLifecycleListeners()
          Gets the lifecycle listeners associated with this lifecycle.
 void removeLifecycleListener(LifecycleListener<M,L> listener)
          Removes a lifecycle event listener which was registered to component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LifecycleSupport

public LifecycleSupport(Lifecycle<M,L> lifecycle)
Constructs a new LifecycleHelper object associated with the specified Lifecycle component.

Parameters:
lifecycle -
Method Detail

addLifecycleListener

public void addLifecycleListener(LifecycleListener<M,L> listener)
Adds a Lifecycle event listener to this component.

Parameters:
listener - The listener is added.

broadcastEvent

public void broadcastEvent(String type,
                           L data)
Notifies all Lifecycle event listeners that a particular event has occurred for this Container. The default implementation performs this notification synchronously using the calling thread.

Parameters:
type - Event type
data - Event data

removeLifecycleListener

public void removeLifecycleListener(LifecycleListener<M,L> listener)
Removes a lifecycle event listener which was registered to component.

Parameters:
listener - The listener will be removed.

findLifecycleListeners

public LifecycleListener<M,L>[] findLifecycleListeners()
Gets the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.



Copyright © 2011 eXo Platform. All Rights Reserved.