Saros
Distributed Collaborative Editing and Distributed Party Programming
|
Public Member Functions | |
void | addActivityListener (IActivityListener listener) |
void | removeActivityListener (IActivityListener listener) |
Protected Member Functions | |
final void | fireActivity (IActivity activity) |
Standard implementation of IActivityProducer, which, in addition to the interface methods, provides an easy way to notify all listeners through fireActivity().
You probably just want to inherit from this class without overriding anything. Before your fired activities can reach other Saros session participants, you need to register your producer to the Saros session -- which provides you with at least one quite attentive listener, i.e. the Saros session -- like this:
public class MyProducer extends AbstractActivityProducer { ... void start() { sarosSession.addActivityProducer(this); }
void stop() { sarosSession.removeActivityProducer(this); }
void something() { fireActivity(new MyActivity()); } }
However, since addActivityListener() is public, other interested listeners might also hook into the creation process of your activities -- just as you can hook into their's.
void de.fu_berlin.inf.dpp.session.AbstractActivityProducer.addActivityListener | ( | IActivityListener | listener | ) |
Registers the given listener, so it will be informed via IActivityListener#created(IActivity).
Implements de.fu_berlin.inf.dpp.session.IActivityProducer.
final void de.fu_berlin.inf.dpp.session.AbstractActivityProducer.fireActivity | ( | IActivity | activity | ) | [protected] |
2, Activity sending, The abstract class to extend:
But instead of implementing the IActivityProducer interface one should extend the AbstractActivityProducer class and call the fireActivity() method on newly created activities to inform all listeners.
void de.fu_berlin.inf.dpp.session.AbstractActivityProducer.removeActivityListener | ( | IActivityListener | listener | ) |
Removes a listener previously registered with addActivityListener(IActivityListener).
Implements de.fu_berlin.inf.dpp.session.IActivityProducer.