2 * Sone - IdentityListenerManager.java - Copyright © 2010 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.sone.freenet.wot;
20 import net.pterodactylus.util.event.AbstractListenerManager;
23 * Manager for {@link IdentityListener}s.
25 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
27 public class IdentityListenerManager extends AbstractListenerManager<IdentityManager, IdentityListener> {
30 * Creates a new identity listener manager.
32 public IdentityListenerManager() {
41 * Notifies all listeners that an {@link OwnIdentity} that was not known on
42 * the previous check is available.
44 * @see IdentityListener#ownIdentityAdded(OwnIdentity)
46 * The new own identity
48 public void fireOwnIdentityAdded(OwnIdentity ownIdentity) {
49 for (IdentityListener identityListener : getListeners()) {
50 identityListener.ownIdentityAdded(ownIdentity);
55 * Notifies all listeners that an {@link OwnIdentity} that was available
56 * during the last check has gone away.
58 * @see IdentityListener#ownIdentityRemoved(OwnIdentity)
60 * The disappeared own identity
62 public void fireOwnIdentityRemoved(OwnIdentity ownIdentity) {
63 for (IdentityListener identityListener : getListeners()) {
64 identityListener.ownIdentityRemoved(ownIdentity);
69 * Notifies all listeners that a new identity was discovered.
71 * @see IdentityListener#identityAdded(Identity)
75 public void fireIdentityAdded(Identity identity) {
76 for (IdentityListener identityListener : getListeners()) {
77 identityListener.identityAdded(identity);
82 * Notifies all listeners that some properties of the identity have changed.
84 * @see IdentityListener#identityUpdated(Identity)
86 * The updated identity
88 public void fireIdentityUpdated(Identity identity) {
89 for (IdentityListener identityListener : getListeners()) {
90 identityListener.identityUpdated(identity);
95 * Notifies all listeners that an identity has gone away.
97 * @see IdentityListener#identityRemoved(Identity)
99 * The disappeared identity
101 public void fireIdentityRemoved(Identity identity) {
102 for (IdentityListener identityListener : getListeners()) {
103 identityListener.identityRemoved(identity);