public interface CoreListener extends EventListener {
/**
- * Notifies a listener that a Sone is now being rescued.
- *
- * @param sone
- * The Sone that is rescued
- */
- public void rescuingSone(Sone sone);
-
- /**
- * Notifies a listener that the Sone was rescued and can now be unlocked.
- *
- * @param sone
- * The Sone that was rescued
- */
- public void rescuedSone(Sone sone);
-
- /**
* Notifies a listener that a new Sone has been discovered.
*
* @param sone
//
/**
- * Notifies all listeners that the given Sone is now being rescued.
- *
- * @see CoreListener#rescuingSone(Sone)
- * @param sone
- * The Sone that is being rescued
- */
- void fireRescuingSone(Sone sone) {
- for (CoreListener coreListener : getListeners()) {
- coreListener.rescuingSone(sone);
- }
- }
-
- /**
- * Notifies all listeners that the given Sone was rescued.
- *
- * @see CoreListener#rescuedSone(Sone)
- * @param sone
- * The Sone that was rescued
- */
- void fireRescuedSone(Sone sone) {
- for (CoreListener coreListener : getListeners()) {
- coreListener.rescuedSone(sone);
- }
- }
-
- /**
* Notifies all listeners that a new Sone has been discovered.
*
* @see CoreListener#newSoneFound(Sone)
/** The “you have been mentioned” notification. */
private final ListNotification<Post> mentionNotification;
- /** The “rescuing Sone” notification. */
- private final ListNotification<Sone> rescuingSonesNotification;
-
- /** The “Sone rescued” notification. */
- private final ListNotification<Sone> sonesRescuedNotification;
-
/** Notifications for sone inserts. */
private final Map<Sone, TemplateNotification> soneInsertNotifications = new HashMap<Sone, TemplateNotification>();
Template mentionNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/mentionNotification.html"));
mentionNotification = new ListNotification<Post>("mention-notification", "posts", mentionNotificationTemplate, false);
- Template rescuingSonesTemplate = TemplateParser.parse(createReader("/templates/notify/rescuingSonesNotification.html"));
- rescuingSonesNotification = new ListNotification<Sone>("sones-being-rescued-notification", "sones", rescuingSonesTemplate);
-
- Template sonesRescuedTemplate = TemplateParser.parse(createReader("/templates/notify/sonesRescuedNotification.html"));
- sonesRescuedNotification = new ListNotification<Sone>("sones-rescued-notification", "sones", sonesRescuedTemplate);
-
Template lockedSonesTemplate = TemplateParser.parse(createReader("/templates/notify/lockedSonesNotification.html"));
lockedSonesNotification = new ListNotification<Sone>("sones-locked-notification", "sones", lockedSonesTemplate);
* {@inheritDoc}
*/
@Override
- public void rescuingSone(Sone sone) {
- rescuingSonesNotification.add(sone);
- notificationManager.addNotification(rescuingSonesNotification);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void rescuedSone(Sone sone) {
- rescuingSonesNotification.remove(sone);
- sonesRescuedNotification.add(sone);
- notificationManager.addNotification(sonesRescuedNotification);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public void newSoneFound(Sone sone) {
newSoneNotification.add(sone);
if (!hasFirstStartNotification()) {