2 * jSite-next - NodeListenerSupport.java -
3 * Copyright © 2008 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package net.pterodactylus.jsite.core;
22 import net.pterodactylus.util.event.ListenerSupport;
25 * Listener support for {@link NodeListener} events.
27 * @author David Roden <droden@gmail.com>
29 public class NodeListenerSupport extends ListenerSupport<NodeListener> {
32 * Notifies all listeners that a node was added.
34 * @see NodeListener#nodeAdded(Node)
36 * The node that was added
38 public void fireNodeAdded(Node node) {
39 for (NodeListener nodeListener : getListeners()) {
40 nodeListener.nodeAdded(node);
45 * Notifies all listeners that a node was removed.
47 * @see NodeListener#nodeRemoved(Node)
49 * The node that was removed
51 public void fireNodeRemoved(Node node) {
52 for (NodeListener nodeListener : getListeners()) {
53 nodeListener.nodeRemoved(node);
58 * Notifies all listeners that a node was connected.
60 * @see NodeListener#nodeConnected(Node)
62 * The node that was connected
64 public void fireNodeConnected(Node node) {
65 for (NodeListener nodeListener : getListeners()) {
66 nodeListener.nodeConnected(node);
71 * Notifies all listeners that the connection to a node failed.
73 * @see NodeListener#nodeConnectionFailed(Node, Throwable)
75 * The node that could not be connected
77 * The cause of the connection failure
79 public void fireNodeConnectionFailed(Node node, Throwable cause) {
80 for (NodeListener nodeListener : getListeners()) {
81 nodeListener.nodeConnectionFailed(node, cause);
86 * Notifies all listeners that a node was disconnected.
88 * @see NodeListener#nodeDisconnected(Node, Throwable)
90 * The node that was disconnected
92 * The cause of the disconnect, or <code>null</code> if there was
95 public void fireNodeDisconnected(Node node, Throwable cause) {
96 for (NodeListener nodeListener : getListeners()) {
97 nodeListener.nodeDisconnected(node, cause);