2 * jSite-next - InsertListenerSupport.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 * Helper class that fires {@link InsertListener} events.
27 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
29 public class InsertListenerSupport extends ListenerSupport<Insert, InsertListener> {
32 * Creates a new insert listener support.
37 public InsertListenerSupport(Insert insert) {
42 * Notifies all listeners that the insert was added.
44 * @see InsertListener#insertAdded(Insert)
46 public void fireInsertAdded() {
47 for (InsertListener insertListener : getListeners()) {
48 insertListener.insertAdded(getSource());
53 * Notifies all listeners that the insert was removed.
55 * @see InsertListener#insertRemoved(Insert)
57 public void fireInsertRemoved() {
58 for (InsertListener insertListener : getListeners()) {
59 insertListener.insertRemoved(getSource());
64 * Notifies all listeners that the insert was started.
66 * @see InsertListener#insertStarted(Insert)
68 public void fireInsertStarted() {
69 for (InsertListener insertListener : getListeners()) {
70 insertListener.insertStarted(getSource());
75 * Notifies all listeners that the insert made progress.
77 * @see InsertListener#insertProgressed(Insert)
79 public void fireInsertProgressed() {
80 for (InsertListener insertListener : getListeners()) {
81 insertListener.insertProgressed(getSource());
86 * Notifies all listeners that the insert generated a URI.
88 * @see InsertListener#insertGeneratedURI(Insert, String)
90 * The URI that was generated
92 public void fireInsertGeneratedURI(String generatedUri) {
93 for (InsertListener insertListener : getListeners()) {
94 insertListener.insertGeneratedURI(getSource(), generatedUri);
99 * Notifies all listeners that the insert has finished.
101 * @see InsertListener#insertFinished(Insert)
103 public void fireInsertFinished() {
104 for (InsertListener insertListener : getListeners()) {
105 insertListener.insertFinished(getSource());