X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fui%2FListenerItem.java;fp=src%2Fbe%2Fnikiroo%2Futils%2Fui%2FListenerItem.java;h=3fa41c83cb51e3c5e7ef9ecad6f7e07204e2b203;hb=fa9ed2183664589496a443157f195a03862f0c66;hp=0000000000000000000000000000000000000000;hpb=bc4db23ff5c21d7d4716f9b7f97de73b15a6fc21;p=nikiroo-utils.git diff --git a/src/be/nikiroo/utils/ui/ListenerItem.java b/src/be/nikiroo/utils/ui/ListenerItem.java new file mode 100644 index 0000000..3fa41c8 --- /dev/null +++ b/src/be/nikiroo/utils/ui/ListenerItem.java @@ -0,0 +1,53 @@ +package be.nikiroo.utils.ui; + +import java.awt.event.ActionListener; + +/** + * The default {@link ActionListener} add/remove/fire methods. + * + * @author niki + */ +public interface ListenerItem { + /** + * Check that this {@link ListenerItem} currently has + * {@link ActionListener}s that listen on it. + * + * @return TRUE if it has + */ + public boolean hasListeners(); + + /** + * Check how many events are currently waiting for an + * {@link ActionListener}. + * + * @return the number of waiting events (can be 0) + */ + public int getWaitingEventCount(); + + /** + * Adds the specified action listener to receive action events from this + * {@link ListenerItem}. + * + * @param listener + * the action listener to be added + */ + public void addActionListener(ActionListener listener); + + /** + * Removes the specified action listener so that it no longer receives + * action events from this {@link ListenerItem}. + * + * @param listener + * the action listener to be removed + */ + public void removeActionListener(ActionListener listener); + + /** + * Notify the listeners of an action. + * + * @param listenerCommand + * A string that may specify a command (possibly one of several) + * associated with the event + */ + public void fireActionPerformed(String listenerCommand); +}