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(OwnIdentity, Identity)
73 * The own identity at the root of the trust tree
77 public void fireIdentityAdded(OwnIdentity ownIdentity, Identity identity) {
78 for (IdentityListener identityListener : getListeners()) {
79 identityListener.identityAdded(ownIdentity, identity);
84 * Notifies all listeners that some properties of the identity have changed.
86 * @see IdentityListener#identityUpdated(OwnIdentity, Identity)
88 * The own identity at the root of the trust tree
90 * The updated identity
92 public void fireIdentityUpdated(OwnIdentity ownIdentity, Identity identity) {
93 for (IdentityListener identityListener : getListeners()) {
94 identityListener.identityUpdated(ownIdentity, identity);
99 * Notifies all listeners that an identity has gone away.
101 * @see IdentityListener#identityRemoved(OwnIdentity, Identity)
103 * The own identity at the root of the trust tree
105 * The disappeared identity
107 public void fireIdentityRemoved(OwnIdentity ownIdentity, Identity identity) {
108 for (IdentityListener identityListener : getListeners()) {
109 identityListener.identityRemoved(ownIdentity, identity);