import java.util.EventListener;
+import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.sone.data.Sone;
*/
public void updateFound(Version version, long releaseTime, long latestEdition);
+ /**
+ * Notifies a listener that an image has started being inserted.
+ *
+ * @param image
+ * The image that is now inserted
+ */
+ public void imageInsertStarted(Image image);
+
+ /**
+ * Notifies a listener that an image insert was aborted by the user.
+ *
+ * @param image
+ * The image that is not inserted anymore
+ */
+ public void imageInsertAborted(Image image);
+
+ /**
+ * Notifies a listener that an image was successfully inserted.
+ *
+ * @param image
+ * The image that was inserted
+ */
+ public void imageInsertFinished(Image image);
+
+ /**
+ * Notifies a listener that an image failed to be inserted.
+ *
+ * @param image
+ * The image that could not be inserted
+ * @param cause
+ * The reason for the failed insert
+ */
+ public void imageInsertFailed(Image image, Throwable cause);
+
}
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;
}
}
+ /**
+ * 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);
+ }
+ }
+
}
}
/**
+ * {@inheritDoc}
+ */
+ @Override
+ public void imageInsertStarted(Image image) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void imageInsertAborted(Image image) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void imageInsertFinished(Image image) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void imageInsertFailed(Image image, Throwable cause) {
+ }
+
+ /**
* Template provider implementation that uses
* {@link WebInterface#createReader(String)} to load templates for
* inclusion.