Merge branch 'subtree'
authorNiki Roo <niki@nikiroo.be>
Sat, 25 Apr 2020 15:52:19 +0000 (17:52 +0200)
committerNiki Roo <niki@nikiroo.be>
Sat, 25 Apr 2020 15:52:19 +0000 (17:52 +0200)
1  2 
src/be/nikiroo/utils/ui/BreadCrumbsBar.java
src/be/nikiroo/utils/ui/ListenerItem.java
src/be/nikiroo/utils/ui/ListenerPanel.java

index 8b993e64b58706c4bf1b567d482ff1618deae43d,a0e205c9d2152c6c8d0404a42217bdb42e420748..a0e205c9d2152c6c8d0404a42217bdb42e420748
@@@ -3,7 -3,6 +3,6 @@@ package be.nikiroo.utils.ui
  
  import java.awt.BorderLayout;
  import java.awt.Dimension;
- import java.awt.FlowLayout;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import java.awt.event.ComponentAdapter;
index 0000000000000000000000000000000000000000,3fa41c83cb51e3c5e7ef9ecad6f7e07204e2b203..3fa41c83cb51e3c5e7ef9ecad6f7e07204e2b203
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,53 +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);
+ }
index 144cdd249a81be951a082618f2a9f4371adaf0a9,ada07960dbe5806f3750b54f83c3f4d413aeb423..ada07960dbe5806f3750b54f83c3f4d413aeb423
@@@ -17,7 -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. */
                waitingQueue = new LinkedList<ActionEvent>();
        }
  
-       /**
-        * 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()) {
                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);