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.Sone;
import net.pterodactylus.util.event.AbstractListenerManager;
+import net.pterodactylus.util.version.Version;
/**
* Manager for {@link CoreListener}s.
//
/**
+ * 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)
}
}
+ /**
+ * Notifies all listener that the given post was removed.
+ *
+ * @see CoreListener#postRemoved(Post)
+ * @param post
+ * The removed post
+ */
+ void firePostRemoved(Post post) {
+ for (CoreListener coreListener : getListeners()) {
+ coreListener.postRemoved(post);
+ }
+ }
+
+ /**
+ * Notifies all listener that the given reply was removed.
+ *
+ * @see CoreListener#replyRemoved(Reply)
+ * @param reply
+ * The removed reply
+ */
+ void fireReplyRemoved(Reply reply) {
+ for (CoreListener coreListener : getListeners()) {
+ coreListener.replyRemoved(reply);
+ }
+ }
+
+ /**
+ * Notifies all listeners that the given Sone was locked.
+ *
+ * @see CoreListener#soneLocked(Sone)
+ * @param sone
+ * The Sone that was locked
+ */
+ void fireSoneLocked(Sone sone) {
+ for (CoreListener coreListener : getListeners()) {
+ coreListener.soneLocked(sone);
+ }
+ }
+
+ /**
+ * Notifies all listeners that the given Sone was unlocked.
+ *
+ * @see CoreListener#soneUnlocked(Sone)
+ * @param sone
+ * The Sone that was unlocked
+ */
+ void fireSoneUnlocked(Sone sone) {
+ for (CoreListener coreListener : getListeners()) {
+ coreListener.soneUnlocked(sone);
+ }
+ }
+
+ /**
+ * Notifies all listeners that a new version was found.
+ *
+ * @see CoreListener#updateFound(Version, long, long)
+ * @param version
+ * The new version
+ * @param releaseTime
+ * The release time of the new version
+ * @param latestEdition
+ * The latest edition of the Sone homepage
+ */
+ void fireUpdateFound(Version version, long releaseTime, long latestEdition) {
+ for (CoreListener coreListener : getListeners()) {
+ coreListener.updateFound(version, releaseTime, latestEdition);
+ }
+ }
+
+ /**
+ * 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);
+ }
+ }
+
}