Bundle: fix memory leak at init/reset
[fanfix.git] / ui / ListenerItem.java
1 package be.nikiroo.utils.ui;
2
3 import java.awt.event.ActionListener;
4
5 /**
6 * The default {@link ActionListener} add/remove/fire methods.
7 *
8 * @author niki
9 */
10 public interface ListenerItem {
11 /**
12 * Check that this {@link ListenerItem} currently has
13 * {@link ActionListener}s that listen on it.
14 *
15 * @return TRUE if it has
16 */
17 public boolean hasListeners();
18
19 /**
20 * Check how many events are currently waiting for an
21 * {@link ActionListener}.
22 *
23 * @return the number of waiting events (can be 0)
24 */
25 public int getWaitingEventCount();
26
27 /**
28 * Adds the specified action listener to receive action events from this
29 * {@link ListenerItem}.
30 *
31 * @param listener
32 * the action listener to be added
33 */
34 public void addActionListener(ActionListener listener);
35
36 /**
37 * Removes the specified action listener so that it no longer receives
38 * action events from this {@link ListenerItem}.
39 *
40 * @param listener
41 * the action listener to be removed
42 */
43 public void removeActionListener(ActionListener listener);
44
45 /**
46 * Notify the listeners of an action.
47 *
48 * @param listenerCommand
49 * A string that may specify a command (possibly one of several)
50 * associated with the event
51 */
52 public void fireActionPerformed(String listenerCommand);
53 }