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;
/**
* 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 listeners that a new reply has been found.
*
- * @see CoreListener#newReplyFound(Reply)
+ * @see CoreListener#newReplyFound(PostReply)
* @param reply
* The new reply
*/
- void fireNewReplyFound(Reply reply) {
+ void fireNewReplyFound(PostReply reply) {
for (CoreListener coreListener : getListeners()) {
coreListener.newReplyFound(reply);
}
* @param reply
* The known reply
*/
- void fireMarkReplyKnown(Reply reply) {
+ void fireMarkReplyKnown(PostReply reply) {
for (CoreListener coreListener : getListeners()) {
coreListener.markReplyKnown(reply);
}
}
/**
+ * Notifies all listener that the given Sone was removed.
+ *
+ * @see CoreListener#soneRemoved(Sone)
+ * @param sone
+ * The removed Sone
+ */
+ void fireSoneRemoved(Sone sone) {
+ for (CoreListener coreListener : getListeners()) {
+ coreListener.soneRemoved(sone);
+ }
+ }
+
+ /**
* Notifies all listener that the given post was removed.
*
* @see CoreListener#postRemoved(Post)
/**
* 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);
}
}
}
+ /**
+ * Notifies all listeners that the insert of the given Sone has started.
+ *
+ * @see SoneInsertListener#insertStarted(Sone)
+ * @param sone
+ * The Sone being inserted
+ */
+ void fireSoneInserting(Sone sone) {
+ for (CoreListener coreListener : getListeners()) {
+ coreListener.soneInserting(sone);
+ }
+ }
+
+ /**
+ * Notifies all listeners that the insert of the given Sone has finished
+ * successfully.
+ *
+ * @see SoneInsertListener#insertFinished(Sone, long)
+ * @param sone
+ * The Sone that was inserted
+ * @param insertDuration
+ * The insert duration (in milliseconds)
+ */
+ void fireSoneInserted(Sone sone, long insertDuration) {
+ for (CoreListener coreListener : getListeners()) {
+ coreListener.soneInserted(sone, insertDuration);
+ }
+ }
+
+ /**
+ * Notifies all listeners that the insert of the given Sone was aborted.
+ *
+ * @see SoneInsertListener#insertStarted(Sone)
+ * @param sone
+ * The Sone being inserted
+ * @param cause
+ * The cause for the abortion (may be {@code null}
+ */
+ void fireSoneInsertAborted(Sone sone, Throwable cause) {
+ for (CoreListener coreListener : getListeners()) {
+ coreListener.soneInsertAborted(sone, cause);
+ }
+ }
+
+ /**
+ * 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);
+ }
+ }
+
}