001
002 /*****************************************************************************
003
004 jBudget.
005 Copyright (C) 2006 Dmitri Petrov
006
007 This program is free software: you can redistribute it and/or modify
008 it under the terms of the GNU General Public License as published by
009 the Free Software Foundation, either version 3 of the License, or
010 (at your option) any later version.
011
012 This program is distributed in the hope that it will be useful,
013 but WITHOUT ANY WARRANTY; without even the implied warranty of
014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015 GNU General Public License for more details.
016
017 You should have received a copy of the GNU General Public License
018 along with this program. If not, see <http://www.gnu.org/licenses/>.
019
020 /*****************************************************************************
021
022 /*
023 * ActionSignaler.java
024 *
025 * Created on November 23, 2006, 9:33 PM
026 */
027
028 package org.jbudget.util;
029
030 import java.awt.event.ActionEvent;
031 import java.awt.event.ActionListener;
032 import java.util.LinkedList;
033 import java.util.List;
034
035 /**
036 *
037 * @author petrov
038 */
039 public class ActionSignaler
040 {
041
042 private List<ActionListener> listeners = new LinkedList<ActionListener>();
043
044 public void addActionListener(ActionListener l){
045 listeners.add(l);
046 }
047
048 public void removeActionListener(ActionListener l){
049 listeners.remove(l);
050 }
051
052 protected void signal()
053 {
054 ActionEvent ev = new ActionEvent(this, 0, "State Changed");
055 for (ActionListener l : listeners)
056 l.actionPerformed(ev);
057 }
058
059 }