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 “new reply” notification. */
private final ListNotification<Reply> newReplyNotification;
+ /** The “rescuing Sone” notification. */
+ private final ListNotification<Sone> rescuingSonesNotification;
+
+ /** The “Sone rescued” notification. */
+ private final ListNotification<Sone> sonesRescuedNotification;
+
/**
* Creates a new web interface.
*
Template newReplyNotificationTemplate = templateFactory.createTemplate(createReader("/templates/notify/newReplyNotification.html"));
newReplyNotification = new ListNotification<Reply>("new-replies-notification", "replies", newReplyNotificationTemplate);
+
+ Template rescuingSonesTemplate = templateFactory.createTemplate(createReader("/templates/notify/rescuingSonesNotification.html"));
+ rescuingSonesNotification = new ListNotification<Sone>("sones-being-rescued-notification", "sones", rescuingSonesTemplate);
+
+ Template sonesRescuedTemplate = templateFactory.createTemplate(createReader("/templates/notify/sonesRescuedNotification.html"));
+ sonesRescuedNotification = new ListNotification<Sone>("sones-rescued-notification", "sones", sonesRescuedTemplate);
}
//
* {@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);
notificationManager.addNotification(newSoneNotification);
Notification.NewSone.Text=New Sones have been discovered:
Notification.NewPost.Text=New posts have been discovered by the following Sones:
Notification.NewReply.Text=New replies have been discovered by the following Sones:
+Notification.SoneIsBeingRescued.Text=The following Sones are currently being rescued:
+Notification.SoneRescued.Text=The following Sones have been rescued:
+Notification.SoneRescued.Text.RememberToUnlock=Please remember to control the posts and replies you have given and don’t forget to unlock your Sones!
+
--- /dev/null
+<div class="text">
+ <%= Notification.SoneIsBeingRescued.Text|l10n|html>
+ <%foreach sones sone>
+ <a href="viewSone.html?sone=<% sone.id|html>" title="<% sone.requestUri|html>"><% sone.niceName|html></a><%notlast>,<%/notlast><%last>.<%/last>
+ <%/foreach>
+</div>
--- /dev/null
+<div class="text">
+ <%= Notification.SoneRescued.Text|l10n|html>
+ <%foreach sones sone>
+ <a href="viewSone.html?sone=<% sone.id|html>" title="<% sone.requestUri|html>"><% sone.niceName|html></a><%notlast>,<%/notlast><%last>.<%/last>
+ <%/foreach>
+ <%= Notification.SoneRescued.Text.RememberToUnlock|l10n|html>
+</div>