/*
- * 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
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;
//
/**
- * Notifies all listeners that the given Sone is now being rescued.
+ * Notifies all listener that the given Sone was removed.
*
- * @see CoreListener#rescuingSone(Sone)
+ * @see CoreListener#soneRemoved(Sone)
* @param sone
- * The Sone that is being rescued
+ * The removed Sone
*/
- void fireRescuingSone(Sone sone) {
+ void fireSoneRemoved(Sone sone) {
for (CoreListener coreListener : getListeners()) {
- coreListener.rescuingSone(sone);
+ coreListener.soneRemoved(sone);
}
}
/**
- * Notifies all listeners that the given Sone was rescued.
+ * Notifies all listener that the given post was removed.
*
- * @see CoreListener#rescuedSone(Sone)
- * @param sone
- * The Sone that was rescued
+ * @see CoreListener#postRemoved(Post)
+ * @param post
+ * The removed post
*/
- void fireRescuedSone(Sone sone) {
+ void firePostRemoved(Post post) {
for (CoreListener coreListener : getListeners()) {
- coreListener.rescuedSone(sone);
+ coreListener.postRemoved(post);
}
}
/**
- * Notifies all listeners that a new Sone has been discovered.
+ * Notifies all listener that the given reply was removed.
*
- * @see CoreListener#newSoneFound(Sone)
- * @param sone
- * The discovered sone
+ * @see CoreListener#replyRemoved(PostReply)
+ * @param reply
+ * The removed reply
*/
- void fireNewSoneFound(Sone sone) {
+ void fireReplyRemoved(PostReply reply) {
for (CoreListener coreListener : getListeners()) {
- coreListener.newSoneFound(sone);
+ coreListener.replyRemoved(reply);
}
}
/**
- * Notifies all listeners that a new post has been found.
+ * Notifies all listeners that the given Sone was locked.
*
- * @see CoreListener#newPostFound(Post)
- * @param post
- * The new post
+ * @see CoreListener#soneLocked(Sone)
+ * @param sone
+ * The Sone that was locked
*/
- void fireNewPostFound(Post post) {
+ void fireSoneLocked(Sone sone) {
for (CoreListener coreListener : getListeners()) {
- coreListener.newPostFound(post);
+ coreListener.soneLocked(sone);
}
}
/**
- * Notifies all listeners that a new reply has been found.
+ * Notifies all listeners that the given Sone was unlocked.
*
- * @see CoreListener#newReplyFound(Reply)
- * @param reply
- * The new reply
+ * @see CoreListener#soneUnlocked(Sone)
+ * @param sone
+ * The Sone that was unlocked
*/
- void fireNewReplyFound(Reply reply) {
+ void fireSoneUnlocked(Sone sone) {
for (CoreListener coreListener : getListeners()) {
- coreListener.newReplyFound(reply);
+ coreListener.soneUnlocked(sone);
}
}
/**
- * Notifies all listeners that the given Sone is now marked as known.
+ * Notifies all listeners that the insert of the given Sone has started.
*
- * @see CoreListener#markSoneKnown(Sone)
+ * @see SoneInsertListener#insertStarted(Sone)
* @param sone
- * The known Sone
+ * The Sone being inserted
*/
- void fireMarkSoneKnown(Sone sone) {
+ void fireSoneInserting(Sone sone) {
for (CoreListener coreListener : getListeners()) {
- coreListener.markSoneKnown(sone);
+ coreListener.soneInserting(sone);
}
}
/**
- * Notifies all listeners that the given post is now marked as known.
+ * Notifies all listeners that the insert of the given Sone has finished
+ * successfully.
*
- * @param post
- * The known post
+ * @see SoneInsertListener#insertFinished(Sone, long)
+ * @param sone
+ * The Sone that was inserted
+ * @param insertDuration
+ * The insert duration (in milliseconds)
*/
- void fireMarkPostKnown(Post post) {
+ void fireSoneInserted(Sone sone, long insertDuration) {
for (CoreListener coreListener : getListeners()) {
- coreListener.markPostKnown(post);
+ coreListener.soneInserted(sone, insertDuration);
}
}
/**
- * Notifies all listeners that the given reply is now marked as known.
+ * Notifies all listeners that the insert of the given Sone was aborted.
*
- * @param reply
- * The known reply
+ * @see SoneInsertListener#insertStarted(Sone)
+ * @param sone
+ * The Sone being inserted
+ * @param cause
+ * The cause for the abortion (may be {@code null}
*/
- void fireMarkReplyKnown(Reply reply) {
+ void fireSoneInsertAborted(Sone sone, Throwable cause) {
for (CoreListener coreListener : getListeners()) {
- coreListener.markReplyKnown(reply);
+ coreListener.soneInsertAborted(sone, cause);
}
}
/**
- * Notifies all listener that the given post was removed.
+ * Notifies all listeners that a new version was found.
*
- * @see CoreListener#postRemoved(Post)
- * @param post
- * The removed post
+ * @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 firePostRemoved(Post post) {
+ void fireUpdateFound(Version version, long releaseTime, long latestEdition) {
for (CoreListener coreListener : getListeners()) {
- coreListener.postRemoved(post);
+ coreListener.updateFound(version, releaseTime, latestEdition);
}
}
/**
- * Notifies all listener that the given reply was removed.
+ * Notifies all listeners that an image has started being inserted.
*
- * @see CoreListener#replyRemoved(Reply)
- * @param reply
- * The removed reply
+ * @see CoreListener#imageInsertStarted(Image)
+ * @param image
+ * The image that is now inserted
*/
- void fireReplyRemoved(Reply reply) {
+ void fireImageInsertStarted(Image image) {
for (CoreListener coreListener : getListeners()) {
- coreListener.replyRemoved(reply);
+ coreListener.imageInsertStarted(image);
}
}
/**
- * Notifies all listeners that the given Sone was locked.
+ * Notifies all listeners that an image insert was aborted by the user.
*
- * @see CoreListener#soneLocked(Sone)
- * @param sone
- * The Sone that was locked
+ * @see CoreListener#imageInsertAborted(Image)
+ * @param image
+ * The image that is not inserted anymore
*/
- void fireSoneLocked(Sone sone) {
+ void fireImageInsertAborted(Image image) {
for (CoreListener coreListener : getListeners()) {
- coreListener.soneLocked(sone);
+ coreListener.imageInsertAborted(image);
}
}
/**
- * Notifies all listeners that the given Sone was unlocked.
+ * Notifies all listeners that an image was successfully inserted.
*
- * @see CoreListener#soneUnlocked(Sone)
- * @param sone
- * The Sone that was unlocked
+ * @see CoreListener#imageInsertFinished(Image)
+ * @param image
+ * The image that was inserted
*/
- void fireSoneUnlocked(Sone sone) {
+ void fireImageInsertFinished(Image image) {
for (CoreListener coreListener : getListeners()) {
- coreListener.soneUnlocked(sone);
+ coreListener.imageInsertFinished(image);
}
}
/**
- * Notifies all listeners that a new version was found.
+ * Notifies all listeners that an image failed to be inserted.
*
- * @see CoreListener#updateFound(Version, long)
- * @param version
- * The new version
- * @param releaseTime
- * The release time of the new version
+ * @see CoreListener#imageInsertFailed(Image, Throwable)
+ * @param image
+ * The image that could not be inserted
+ * @param cause
+ * The cause of the failure
*/
- void fireUpdateFound(Version version, long releaseTime) {
+ void fireImageInsertFailed(Image image, Throwable cause) {
for (CoreListener coreListener : getListeners()) {
- coreListener.updateFound(version, releaseTime);
+ coreListener.imageInsertFailed(image, cause);
}
}