X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fui%2FListenerPanel.java;h=ada07960dbe5806f3750b54f83c3f4d413aeb423;hp=144cdd249a81be951a082618f2a9f4371adaf0a9;hb=fa9ed2183664589496a443157f195a03862f0c66;hpb=bc4db23ff5c21d7d4716f9b7f97de73b15a6fc21 diff --git a/src/be/nikiroo/utils/ui/ListenerPanel.java b/src/be/nikiroo/utils/ui/ListenerPanel.java index 144cdd2..ada0796 100644 --- a/src/be/nikiroo/utils/ui/ListenerPanel.java +++ b/src/be/nikiroo/utils/ui/ListenerPanel.java @@ -17,7 +17,7 @@ import javax.swing.JPanel; * * @author niki */ -public class ListenerPanel extends JPanel { +public class ListenerPanel extends JPanel implements ListenerItem { private static final long serialVersionUID = 1L; /** Waiting queue until at least one listener is here to get the events. */ @@ -30,33 +30,17 @@ public class ListenerPanel extends JPanel { waitingQueue = new LinkedList(); } - /** - * Check that this {@link ListenerPanel} currently has - * {@link ActionListener}s that listen on it. - * - * @return TRUE if it has - */ + @Override public synchronized boolean hasListeners() { return listenerList.getListenerList().length > 1; } - /** - * Check how many events are currently waiting for an - * {@link ActionListener}. - * - * @return the number of waiting events (can be 0) - */ + @Override public synchronized int getWaitingEventCount() { return waitingQueue.size(); } - /** - * Adds the specified action listener to receive action events from this - * {@link ListenerPanel}. - * - * @param listener - * the action listener to be added - */ + @Override public synchronized void addActionListener(ActionListener listener) { if (!hasListeners()) { while (!waitingQueue.isEmpty()) { @@ -67,25 +51,13 @@ public class ListenerPanel extends JPanel { listenerList.add(ActionListener.class, listener); } - /** - * Removes the specified action listener so that it no longer receives - * action events from this {@link ListenerPanel}. - * - * @param listener - * the action listener to be removed - */ + @Override public synchronized void removeActionListener(ActionListener listener) { listenerList.remove(ActionListener.class, listener); } - /** - * Notify the listeners of an action. - * - * @param listenerCommand - * A string that may specify a command (possibly one of several) - * associated with the event - */ - protected synchronized void fireActionPerformed(String listenerCommand) { + @Override + public synchronized void fireActionPerformed(String listenerCommand) { ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, listenerCommand);