Convert “new post reply found” into EventBus-based event.
[Sone.git] / src / main / java / net / pterodactylus / sone / core / CoreListenerManager.java
index 875a2b6..289be50 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - CoreListenerManager.java - Copyright © 2010 David Roden
+ * Sone - CoreListenerManager.java - Copyright © 2010–2012 David Roden
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -17,8 +17,9 @@
 
 package net.pterodactylus.sone.core;
 
+import net.pterodactylus.sone.data.Image;
 import net.pterodactylus.sone.data.Post;
-import net.pterodactylus.sone.data.Reply;
+import net.pterodactylus.sone.data.PostReply;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.util.event.AbstractListenerManager;
 import net.pterodactylus.util.version.Version;
@@ -45,45 +46,6 @@ public class CoreListenerManager extends AbstractListenerManager<Core, CoreListe
        //
 
        /**
-        * Notifies all listeners that a new Sone has been discovered.
-        *
-        * @see CoreListener#newSoneFound(Sone)
-        * @param sone
-        *            The discovered sone
-        */
-       void fireNewSoneFound(Sone sone) {
-               for (CoreListener coreListener : getListeners()) {
-                       coreListener.newSoneFound(sone);
-               }
-       }
-
-       /**
-        * Notifies all listeners that a new post has been found.
-        *
-        * @see CoreListener#newPostFound(Post)
-        * @param post
-        *            The new post
-        */
-       void fireNewPostFound(Post post) {
-               for (CoreListener coreListener : getListeners()) {
-                       coreListener.newPostFound(post);
-               }
-       }
-
-       /**
-        * Notifies all listeners that a new reply has been found.
-        *
-        * @see CoreListener#newReplyFound(Reply)
-        * @param reply
-        *            The new reply
-        */
-       void fireNewReplyFound(Reply reply) {
-               for (CoreListener coreListener : getListeners()) {
-                       coreListener.newReplyFound(reply);
-               }
-       }
-
-       /**
         * Notifies all listeners that the given Sone is now marked as known.
         *
         * @see CoreListener#markSoneKnown(Sone)
@@ -114,7 +76,7 @@ public class CoreListenerManager extends AbstractListenerManager<Core, CoreListe
         * @param reply
         *            The known reply
         */
-       void fireMarkReplyKnown(Reply reply) {
+       void fireMarkReplyKnown(PostReply reply) {
                for (CoreListener coreListener : getListeners()) {
                        coreListener.markReplyKnown(reply);
                }
@@ -149,11 +111,11 @@ public class CoreListenerManager extends AbstractListenerManager<Core, CoreListe
        /**
         * Notifies all listener that the given reply was removed.
         *
-        * @see CoreListener#replyRemoved(Reply)
+        * @see CoreListener#replyRemoved(PostReply)
         * @param reply
         *            The removed reply
         */
-       void fireReplyRemoved(Reply reply) {
+       void fireReplyRemoved(PostReply reply) {
                for (CoreListener coreListener : getListeners()) {
                        coreListener.replyRemoved(reply);
                }
@@ -246,4 +208,58 @@ public class CoreListenerManager extends AbstractListenerManager<Core, CoreListe
                }
        }
 
+       /**
+        * Notifies all listeners that an image has started being inserted.
+        *
+        * @see CoreListener#imageInsertStarted(Image)
+        * @param image
+        *            The image that is now inserted
+        */
+       void fireImageInsertStarted(Image image) {
+               for (CoreListener coreListener : getListeners()) {
+                       coreListener.imageInsertStarted(image);
+               }
+       }
+
+       /**
+        * Notifies all listeners that an image insert was aborted by the user.
+        *
+        * @see CoreListener#imageInsertAborted(Image)
+        * @param image
+        *            The image that is not inserted anymore
+        */
+       void fireImageInsertAborted(Image image) {
+               for (CoreListener coreListener : getListeners()) {
+                       coreListener.imageInsertAborted(image);
+               }
+       }
+
+       /**
+        * Notifies all listeners that an image was successfully inserted.
+        *
+        * @see CoreListener#imageInsertFinished(Image)
+        * @param image
+        *            The image that was inserted
+        */
+       void fireImageInsertFinished(Image image) {
+               for (CoreListener coreListener : getListeners()) {
+                       coreListener.imageInsertFinished(image);
+               }
+       }
+
+       /**
+        * Notifies all listeners that an image failed to be inserted.
+        *
+        * @see CoreListener#imageInsertFailed(Image, Throwable)
+        * @param image
+        *            The image that could not be inserted
+        * @param cause
+        *            The cause of the failure
+        */
+       void fireImageInsertFailed(Image image, Throwable cause) {
+               for (CoreListener coreListener : getListeners()) {
+                       coreListener.imageInsertFailed(image, cause);
+               }
+       }
+
 }