projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Convert “Sone removed” into EventBus-based event.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
core
/
CoreListenerManager.java
diff --git
a/src/main/java/net/pterodactylus/sone/core/CoreListenerManager.java
b/src/main/java/net/pterodactylus/sone/core/CoreListenerManager.java
index
464342c
..
25f24c3
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/core/CoreListenerManager.java
+++ b/
src/main/java/net/pterodactylus/sone/core/CoreListenerManager.java
@@
-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
*
* 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,10
+17,12
@@
package net.pterodactylus.sone.core;
package net.pterodactylus.sone.core;
+import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Post;
-import net.pterodactylus.sone.data.Reply;
+import net.pterodactylus.sone.data.
Post
Reply;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.util.event.AbstractListenerManager;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.util.event.AbstractListenerManager;
+import net.pterodactylus.util.version.Version;
/**
* Manager for {@link CoreListener}s.
/**
* Manager for {@link CoreListener}s.
@@
-44,156
+46,169
@@
public class CoreListenerManager extends AbstractListenerManager<Core, CoreListe
//
/**
//
/**
- * Notifies all listener
s that the given Sone is now being rescu
ed.
+ * Notifies all listener
that the given post was remov
ed.
*
*
- * @see CoreListener#
rescuingSone(Sone
)
- * @param
sone
- * The
Sone that is being rescued
+ * @see CoreListener#
postRemoved(Post
)
+ * @param
post
+ * The
removed post
*/
*/
- void fire
RescuingSone(Sone sone
) {
+ void fire
PostRemoved(Post post
) {
for (CoreListener coreListener : getListeners()) {
for (CoreListener coreListener : getListeners()) {
- coreListener.
rescuingSone(sone
);
+ coreListener.
postRemoved(post
);
}
}
/**
}
}
/**
- * Notifies all listener
s that the given Sone was rescu
ed.
+ * Notifies all listener
that the given reply was remov
ed.
*
*
- * @see CoreListener#re
scuedSone(Sone
)
- * @param
sone
- * The
Sone that was rescued
+ * @see CoreListener#re
plyRemoved(PostReply
)
+ * @param
reply
+ * The
removed reply
*/
*/
- void fireRe
scuedSone(Sone sone
) {
+ void fireRe
plyRemoved(PostReply reply
) {
for (CoreListener coreListener : getListeners()) {
for (CoreListener coreListener : getListeners()) {
- coreListener.re
scuedSone(sone
);
+ coreListener.re
plyRemoved(reply
);
}
}
/**
}
}
/**
- * Notifies all listeners that
a new Sone has been discover
ed.
+ * Notifies all listeners that
the given Sone was lock
ed.
*
*
- * @see CoreListener#
newSoneFoun
d(Sone)
+ * @see CoreListener#
soneLocke
d(Sone)
* @param sone
* @param sone
- * The
discovered sone
+ * The
Sone that was locked
*/
*/
- void fire
NewSoneFoun
d(Sone sone) {
+ void fire
SoneLocke
d(Sone sone) {
for (CoreListener coreListener : getListeners()) {
for (CoreListener coreListener : getListeners()) {
- coreListener.
newSoneFoun
d(sone);
+ coreListener.
soneLocke
d(sone);
}
}
/**
}
}
/**
- * Notifies all listeners that
a new post has been foun
d.
+ * Notifies all listeners that
the given Sone was unlocke
d.
*
*
- * @see CoreListener#
newPostFound(Post
)
- * @param
post
- * The
new post
+ * @see CoreListener#
soneUnlocked(Sone
)
+ * @param
sone
+ * The
Sone that was unlocked
*/
*/
- void fire
NewPostFound(Post post
) {
+ void fire
SoneUnlocked(Sone sone
) {
for (CoreListener coreListener : getListeners()) {
for (CoreListener coreListener : getListeners()) {
- coreListener.
newPostFound(post
);
+ coreListener.
soneUnlocked(sone
);
}
}
/**
}
}
/**
- * Notifies all listeners that
a new reply has been foun
d.
+ * Notifies all listeners that
the insert of the given Sone has starte
d.
*
*
- * @see
CoreListener#newReplyFound(Reply
)
- * @param
reply
- * The
new reply
+ * @see
SoneInsertListener#insertStarted(Sone
)
+ * @param
sone
+ * The
Sone being inserted
*/
*/
- void fire
NewReplyFound(Reply reply
) {
+ void fire
SoneInserting(Sone sone
) {
for (CoreListener coreListener : getListeners()) {
for (CoreListener coreListener : getListeners()) {
- coreListener.
newReplyFound(reply
);
+ coreListener.
soneInserting(sone
);
}
}
/**
}
}
/**
- * Notifies all listeners that the given Sone is now marked as known.
+ * Notifies all listeners that the insert of the given Sone has finished
+ * successfully.
*
*
- * @see
CoreListener#markSoneKnown(Sone
)
+ * @see
SoneInsertListener#insertFinished(Sone, long
)
* @param sone
* @param sone
- * The known Sone
+ * The Sone that was inserted
+ * @param insertDuration
+ * The insert duration (in milliseconds)
*/
*/
- void fire
MarkSoneKnown(Sone sone
) {
+ void fire
SoneInserted(Sone sone, long insertDuration
) {
for (CoreListener coreListener : getListeners()) {
for (CoreListener coreListener : getListeners()) {
- coreListener.
markSoneKnown(sone
);
+ coreListener.
soneInserted(sone, insertDuration
);
}
}
/**
}
}
/**
- * Notifies all listeners that the
given post is now marked as known
.
+ * Notifies all listeners that the
insert of the given Sone was aborted
.
*
*
- * @param post
- * The known post
+ * @see SoneInsertListener#insertStarted(Sone)
+ * @param sone
+ * The Sone being inserted
+ * @param cause
+ * The cause for the abortion (may be {@code null}
*/
*/
- void fire
MarkPostKnown(Post post
) {
+ void fire
SoneInsertAborted(Sone sone, Throwable cause
) {
for (CoreListener coreListener : getListeners()) {
for (CoreListener coreListener : getListeners()) {
- coreListener.
markPostKnown(post
);
+ coreListener.
soneInsertAborted(sone, cause
);
}
}
/**
}
}
/**
- * Notifies all listeners that
the given reply is now marked as known
.
+ * Notifies all listeners that
a new version was found
.
*
*
- * @param reply
- * The known reply
+ * @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 fire
MarkReplyKnown(Reply reply
) {
+ void fire
UpdateFound(Version version, long releaseTime, long latestEdition
) {
for (CoreListener coreListener : getListeners()) {
for (CoreListener coreListener : getListeners()) {
- coreListener.
markReplyKnown(reply
);
+ coreListener.
updateFound(version, releaseTime, latestEdition
);
}
}
/**
}
}
/**
- * Notifies all listener
that the given post was remov
ed.
+ * Notifies all listener
s that an image has started being insert
ed.
*
*
- * @see CoreListener#
postRemoved(Post
)
- * @param
post
- * The
removed post
+ * @see CoreListener#
imageInsertStarted(Image
)
+ * @param
image
+ * The
image that is now inserted
*/
*/
- void fire
PostRemoved(Post post
) {
+ void fire
ImageInsertStarted(Image image
) {
for (CoreListener coreListener : getListeners()) {
for (CoreListener coreListener : getListeners()) {
- coreListener.
postRemoved(post
);
+ coreListener.
imageInsertStarted(image
);
}
}
/**
}
}
/**
- * Notifies all listener
that the given reply was removed
.
+ * Notifies all listener
s that an image insert was aborted by the user
.
*
*
- * @see CoreListener#
replyRemoved(Reply
)
- * @param
reply
- * The
removed reply
+ * @see CoreListener#
imageInsertAborted(Image
)
+ * @param
image
+ * The
image that is not inserted anymore
*/
*/
- void fire
ReplyRemoved(Reply reply
) {
+ void fire
ImageInsertAborted(Image image
) {
for (CoreListener coreListener : getListeners()) {
for (CoreListener coreListener : getListeners()) {
- coreListener.
replyRemoved(reply
);
+ coreListener.
imageInsertAborted(image
);
}
}
/**
}
}
/**
- * Notifies all listeners that
the given Sone was lock
ed.
+ * Notifies all listeners that
an image was successfully insert
ed.
*
*
- * @see CoreListener#
soneLocked(Son
e)
- * @param
son
e
- * The
Sone that was lock
ed
+ * @see CoreListener#
imageInsertFinished(Imag
e)
+ * @param
imag
e
+ * The
image that was insert
ed
*/
*/
- void fire
SoneLocked(Sone son
e) {
+ void fire
ImageInsertFinished(Image imag
e) {
for (CoreListener coreListener : getListeners()) {
for (CoreListener coreListener : getListeners()) {
- coreListener.
soneLocked(son
e);
+ coreListener.
imageInsertFinished(imag
e);
}
}
/**
}
}
/**
- * Notifies all listeners that
the given Sone was unlock
ed.
+ * Notifies all listeners that
an image failed to be insert
ed.
*
*
- * @see CoreListener#soneUnlocked(Sone)
- * @param sone
- * The Sone that was unlocked
+ * @see CoreListener#imageInsertFailed(Image, Throwable)
+ * @param image
+ * The image that could not be inserted
+ * @param cause
+ * The cause of the failure
*/
*/
- void fire
SoneUnlocked(Sone son
e) {
+ void fire
ImageInsertFailed(Image image, Throwable caus
e) {
for (CoreListener coreListener : getListeners()) {
for (CoreListener coreListener : getListeners()) {
- coreListener.
soneUnlocked(son
e);
+ coreListener.
imageInsertFailed(image, caus
e);
}
}
}
}