/[classpath]/classpath/java/awt/AWTEventMulticaster.java
ViewVC logotype

Diff of /classpath/java/awt/AWTEventMulticaster.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by mark, Sun Jan 13 15:45:15 2002 UTC revision 1.5 by tromey, Wed Jan 16 04:20:14 2002 UTC
# Line 1  Line 1 
1  /* AWTEventMulticaster.java -- Event handler chaining class  /* Copyright (C) 1999, 2000, 2002  Free Software Foundation
    Copyright (C) 1999 Free Software Foundation, Inc.  
2    
3  This file is part of GNU Classpath.  This file is part of GNU Classpath.
4    
# Line 28  executable file might be covered by the Line 27  executable file might be covered by the
27  package java.awt;  package java.awt;
28    
29  import java.awt.event.*;  import java.awt.event.*;
 import java.io.ObjectOutputStream;  
 import java.io.IOException;  
 import java.util.EventObject;  
30  import java.util.EventListener;  import java.util.EventListener;
31    import java.io.ObjectOutputStream;
32    
33    /* Written using on-line Java 2 Platform Standard Edition v1.3 API
34     * Specification, as well as "The Java Class Libraries", 2nd edition
35     * (Addison-Wesley, 1998).
36     * Status:  Believed complete and correct to J2SE 1.3, except for
37     * serialization support methods, save() and saveInternal(), which are
38     * stubbed.
39     */
40    
41  /**  /**
42    * This class is used to implement a chain of event handlers.  Dispatching    * This class is used to implement a chain of event handlers.  Dispatching
# Line 67  import java.util.EventListener; Line 72  import java.util.EventListener;
72    * is called with <code>al</code> and <code>listener</code> and the    * is called with <code>al</code> and <code>listener</code> and the
73    * new listener is then chained to the old.    * new listener is then chained to the old.
74    *    *
75      * @author Bryce McKinlay
76    * @author Aaron M. Renn (arenn@urbanophile.com)    * @author Aaron M. Renn (arenn@urbanophile.com)
77    */    */
78  public class AWTEventMulticaster implements ComponentListener,  public class AWTEventMulticaster implements ComponentListener,
79         ContainerListener, FocusListener, KeyListener, MouseListener,    ContainerListener, FocusListener, KeyListener, MouseListener,
80         MouseMotionListener, WindowListener, ActionListener, ItemListener,    MouseMotionListener, WindowListener, ActionListener, ItemListener,
81         AdjustmentListener, TextListener //, InputMethodListener    AdjustmentListener, TextListener, InputMethodListener, HierarchyListener,
82  {    HierarchyBoundsListener
83    {
84  /*    /**
85   * Instance Variables     * A variable in the event chain.
86   */     */
87      protected final EventListener a;
88  /**  
89    * A variable in the event chain.    /**
90    */     * A variable in the event chain
91  protected final EventListener a;     */
92      protected final EventListener b;
93  /**  
94    * A variable in the event chain    /**
95    */     * Initializes a new instance of <code>AWTEventMulticaster</code> with
96  protected final EventListener b;     * the specified event listener parameters.
97       *
98  /*************************************************************************/     * @param a The "a" listener object.
99       * @param b The "b" listener object.
100  /*     */
101   * Static Methods    protected AWTEventMulticaster(EventListener a,
102   */                                  EventListener b)
103      {
104  /**      this.a = a;
105    * Chain <code>ComponentListener</code> b to a.      this.b = b;
106    *    }
107    * @param a - Listener to chain to.  
108    * @param b - Listener to chain.    /**
109    *     * Chain <code>EventListener</code> b to a.
110    * @return Latest entry in the chain.     *
111    */     * @param a - Listener to chain to.
112  public static ComponentListener     * @param b - Listener to chain.
113  add(ComponentListener a, ComponentListener b)     *
114  {     * @return Latest entry in the chain.
115    return((ComponentListener)addInternal(a, b));     */
116  }    protected static EventListener addInternal(EventListener a, EventListener b)
117      {
118  /*************************************************************************/      if (a == null)
119          return b;
120  /**      else if (b == null)
121    * Chain <code>ContainerListener</code> b to a.        return a;
122    *      else return new AWTEventMulticaster(a, b);
123    * @param a - Listener to chain to.    }
124    * @param b - Listener to chain.  
125    *    /**
126    * @return Latest entry in the chain.     * Removes the listener <code>old</code> from the listener <code>lis</code>.
127    */     *
128  public static ContainerListener     * @param lis The listener to remove <code>old</code> from.
129  add(ContainerListener a, ContainerListener b)     * @param old The listener to remove.
130  {     *
131    return((ContainerListener)addInternal(a, b));     * @return The resulting listener after the remove operation.
132  }     */
133      protected static EventListener removeInternal(EventListener l,
134  /*************************************************************************/                                                  EventListener oldl)
135      {
136  /**      if (l == oldl)
137    * Chain <code>FocusListener</code> b to a.        return null;
138    *      else if (l instanceof AWTEventMulticaster)
139    * @param a - Listener to chain to.        {
140    * @param b - Listener to chain.          AWTEventMulticaster mc = (AWTEventMulticaster) l;
141    *          return mc.remove(oldl);
142    * @return Latest entry in the chain.        }
143    */      return l;
144  public static FocusListener    }
145  add(FocusListener a, FocusListener b)  
146  {    /**
147    return((FocusListener)addInternal(a, b));     * Removes the specified object from this multicaster object.  If the
148  }     * object to remove is not part of this multicaster, then the remove
149       * method on the parent multicaster (if it exists) is called and a
150  /*************************************************************************/     * new multicaster object is returned based on that object and this
151       * multicaster's non-parent object.
152  /**     *
153    * Chain <code>KeyListener</code> b to a.     * @param old The object to remove from this multicaster.
154    *     *
155    * @param a - Listener to chain to.     * @return The resulting multicaster with the specified listener removed.
156    * @param b - Listener to chain.     */
157    *    protected EventListener remove(EventListener oldl)
158    * @return Latest entry in the chain.    {
159    */      // If oldl is an immediate child, return the other child.
160  public static KeyListener      if (a == oldl)
161  add(KeyListener a, KeyListener b)        return b;
162  {      if (b == oldl)
163    return((KeyListener)addInternal(a, b));        return a;
164  }  
165        // If a and/or b are Multicaster's, search them recursively.
166  /*************************************************************************/      if (a instanceof AWTEventMulticaster)
167          {
168  /**          AWTEventMulticaster mc = (AWTEventMulticaster) a;
169    * Chain <code>MouseListener</code> b to a.          EventListener newa = mc.remove(oldl);
170    *          if (newa != a)
171    * @param a - Listener to chain to.            return new AWTEventMulticaster (newa, b);
172    * @param b - Listener to chain.        }    
173    *      if (b instanceof AWTEventMulticaster)
174    * @return Latest entry in the chain.        {
175    */          AWTEventMulticaster mc = (AWTEventMulticaster) a;
176  public static MouseListener          EventListener newb = mc.remove(oldl);
177  add(MouseListener a, MouseListener b)          if (newb != b)
178  {            return new AWTEventMulticaster (a, newb);
179    return((MouseListener)addInternal(a, b));        }
180  }  
181        // oldl was not found.
182  /*************************************************************************/      return this;
183      }
184  /**  
185    * Chain <code>MouseMotionListener</code> b to a.    /**
186    *     * Chain <code>ActionListener</code> b to a.
187    * @param a - Listener to chain to.     *
188    * @param b - Listener to chain.     * @param a - Listener to chain to.
189    *     * @param b - Listener to chain.
190    * @return Latest entry in the chain.     *
191    */     * @return Latest entry in the chain.
192  public static MouseMotionListener     */
193  add(MouseMotionListener a, MouseMotionListener b)    public static ActionListener add(ActionListener a, ActionListener b)
194  {    {
195    return((MouseMotionListener)addInternal(a, b));      return (ActionListener) addInternal(a, b);
196  }    }
197    
198  /*************************************************************************/    /**
199       * Chain <code>AdjustmentListener</code> b to a.
200  /**     *
201    * Chain <code>WindowListener</code> b to a.     * @param a - Listener to chain to.
202    *     * @param b - Listener to chain.
203    * @param a - Listener to chain to.     *
204    * @param b - Listener to chain.     * @return Latest entry in the chain.
205    *     */
206    * @return Latest entry in the chain.    public static AdjustmentListener add(AdjustmentListener a,
207    */                                         AdjustmentListener b)
208  public static WindowListener    {
209  add(WindowListener a, WindowListener b)      return (AdjustmentListener) addInternal(a, b);
210  {    }                                    
211    return((WindowListener)addInternal(a, b));  
212  }    /**
213       * Chain <code>ComponentListener</code> b to a.
214  /*************************************************************************/     *
215       * @param a - Listener to chain to.
216  /**     * @param b - Listener to chain.
217    * Chain <code>ActionListener</code> b to a.     *
218    *     * @return Latest entry in the chain.
219    * @param a - Listener to chain to.     */
220    * @param b - Listener to chain.    public static ComponentListener add(ComponentListener a, ComponentListener b)
221    *    {
222    * @return Latest entry in the chain.      return (ComponentListener) addInternal(a, b);
223    */    }
224  public static ActionListener  
225  add(ActionListener a, ActionListener b)    /**
226  {     * Chain <code>ContainerListener</code> b to a.
227    return((ActionListener)addInternal(a, b));     *
228  }     * @param a - Listener to chain to.
229       * @param b - Listener to chain.
230  /*************************************************************************/     *
231       * @return Latest entry in the chain.
232  /**     */
233    * Chain <code>ItemListener</code> b to a.    public static ContainerListener add(ContainerListener a, ContainerListener b)
234    *    {
235    * @param a - Listener to chain to.      return (ContainerListener) addInternal(a, b);
236    * @param b - Listener to chain.    }
237    *  
238    * @return Latest entry in the chain.    /**
239    */     * Chain <code>FocusListener</code> b to a.
240  public static ItemListener     *
241  add(ItemListener a, ItemListener b)     * @param a - Listener to chain to.
242  {     * @param b - Listener to chain.
243    return((ItemListener)addInternal(a, b));     *
244  }     * @return Latest entry in the chain.
245       */
246  /*************************************************************************/    public static FocusListener add(FocusListener a, FocusListener b)
247      {
248  /**      return (FocusListener) addInternal(a, b);
249    * Chain <code>AdjustmentListener</code> b to a.    }
250    *  
251    * @param a - Listener to chain to.    public static HierarchyBoundsListener add(HierarchyBoundsListener a,
252    * @param b - Listener to chain.                                              HierarchyBoundsListener b)
253    *    {
254    * @return Latest entry in the chain.      return (HierarchyBoundsListener) addInternal(a, b);
255    */    }
256  public static AdjustmentListener  
257  add(AdjustmentListener a, AdjustmentListener b)    public static HierarchyListener add(HierarchyListener a, HierarchyListener b)
258  {    {
259    return((AdjustmentListener)addInternal(a, b));      return (HierarchyListener) addInternal(a, b);
260  }    }
261    
262  /*************************************************************************/    public static InputMethodListener add(InputMethodListener a,
263                                            InputMethodListener b)
264  /**    {
265    * Chain <code>AdjustmentListener</code> b to a.      return (InputMethodListener) addInternal(a, b);
266    *    }
267    * @param a - Listener to chain to.  
268    * @param b - Listener to chain.    /**
269    *     * Chain <code>ItemListener</code> b to a.
270    * @return Latest entry in the chain.     *
271    */     * @param a - Listener to chain to.
272  public static TextListener     * @param b - Listener to chain.
273  add(TextListener a, TextListener b)     *
274  {     * @return Latest entry in the chain.
275    return((TextListener)addInternal(a, b));     */
276  }    public static ItemListener add(ItemListener a, ItemListener b)
277      {
278  /*************************************************************************/      return (ItemListener) addInternal(a, b);
279      }
280  /**  
281    * Chain <code>EventListener</code> b to a.    /**
282    *     * Chain <code>KeyListener</code> b to a.
283    * @param a - Listener to chain to.     *
284    * @param b - Listener to chain.     * @param a - Listener to chain to.
285    *     * @param b - Listener to chain.
286    * @return Latest entry in the chain.     *
287    */     * @return Latest entry in the chain.
288  public static EventListener     */
289  addInternal(EventListener a, EventListener b)    public static KeyListener add(KeyListener a, KeyListener b)
290  {    {
291    if (a == null)      return (KeyListener) addInternal(a, b);
292      return(b);    }
293    if (b == null)  
294      return(a);    /**
295         * Chain <code>MouseListener</code> b to a.
296    return(new AWTEventMulticaster(a, b));     *
297  }     * @param a - Listener to chain to.
298       * @param b - Listener to chain.
299  /*************************************************************************/     *
300       * @return Latest entry in the chain.
301  /**     */
302    * Removes the listener <code>old</code> from the listener <code>lis</code>.    public static MouseListener add(MouseListener a, MouseListener b)
303    *    {
304    * @param lis The listener to remove <code>old</code> from.      return (MouseListener) addInternal(a, b);
305    * @param old The listener to remove.    }
306    *  
307    * @return The resulting listener after the remove operation.    /**
308    */     * Chain <code>MouseMotionListener</code> b to a.
309  public static ComponentListener     *
310  remove(ComponentListener lis, ComponentListener old)     * @param a - Listener to chain to.
311  {     * @param b - Listener to chain.
312    return((ComponentListener)removeInternal(lis, old));     *
313  }     * @return Latest entry in the chain.
314       */
315  /*************************************************************************/    public static MouseMotionListener add(MouseMotionListener a,
316                                            MouseMotionListener b)
317  /**    {
318    * Removes the listener <code>old</code> from the listener <code>lis</code>.      return (MouseMotionListener) addInternal(a, b);
319    *    }
320    * @param lis The listener to remove <code>old</code> from.  
321    * @param old The listener to remove.    /**
322    *     * Chain <code>AdjustmentListener</code> b to a.
323    * @return The resulting listener after the remove operation.     *
324    */     * @param a - Listener to chain to.
325  public static ContainerListener     * @param b - Listener to chain.
326  remove(ContainerListener lis, ContainerListener old)     *
327  {     * @return Latest entry in the chain.
328    return((ContainerListener)removeInternal(lis, old));     */
329  }    public static TextListener add(TextListener a, TextListener b)
330      {
331  /*************************************************************************/      return (TextListener) addInternal(a, b);
332      }
333  /**  
334    * Removes the listener <code>old</code> from the listener <code>lis</code>.    /**
335    *     * Chain <code>WindowListener</code> b to a.
336    * @param lis The listener to remove <code>old</code> from.     *
337    * @param old The listener to remove.     * @param a - Listener to chain to.
338    *     * @param b - Listener to chain.
339    * @return The resulting listener after the remove operation.     *
340    */     * @return Latest entry in the chain.
341  public static FocusListener     */
342  remove(FocusListener lis, FocusListener old)    public static WindowListener add(WindowListener a, WindowListener b)
343  {    {
344    return((FocusListener)removeInternal(lis, old));      return (WindowListener) addInternal(a, b);
345  }    }
346    
347  /*************************************************************************/    /**
348       * Removes the listener <code>old</code> from the listener <code>lis</code>.
349  /**     *
350    * Removes the listener <code>old</code> from the listener <code>lis</code>.     * @param lis The listener to remove <code>old</code> from.
351    *     * @param old The listener to remove.
352    * @param lis The listener to remove <code>old</code> from.     *
353    * @param old The listener to remove.     * @return The resulting listener after the remove operation.
354    *     */
355    * @return The resulting listener after the remove operation.    public static ActionListener remove(ActionListener l, ActionListener oldl)
356    */    {
357  public static KeyListener      return (ActionListener) removeInternal(l, oldl);
358  remove(KeyListener lis, KeyListener old)    }
359  {  
360    return((KeyListener)removeInternal(lis, old));    /**
361  }     * Removes the listener <code>old</code> from the listener <code>lis</code>.
362       *
363  /*************************************************************************/     * @param lis The listener to remove <code>old</code> from.
364       * @param old The listener to remove.
365  /**     *
366    * Removes the listener <code>old</code> from the listener <code>lis</code>.     * @return The resulting listener after the remove operation.
367    *     */
368    * @param lis The listener to remove <code>old</code> from.    public static AdjustmentListener remove(AdjustmentListener l,
369    * @param old The listener to remove.                                            AdjustmentListener oldl)
370    *    {
371    * @return The resulting listener after the remove operation.      return (AdjustmentListener) removeInternal(l, oldl);
372    */    }
373  public static MouseListener  
374  remove(MouseListener lis, MouseListener old)    /**
375  {     * Removes the listener <code>old</code> from the listener <code>lis</code>.
376    return((MouseListener)removeInternal(lis, old));     *
377  }     * @param lis The listener to remove <code>old</code> from.
378       * @param old The listener to remove.
379  /*************************************************************************/     *
380       * @return The resulting listener after the remove operation.
381  /**     */
382    * Removes the listener <code>old</code> from the listener <code>lis</code>.    public static ComponentListener remove(ComponentListener l,
383    *                                           ComponentListener oldl)
384    * @param lis The listener to remove <code>old</code> from.    {
385    * @param old The listener to remove.      return (ComponentListener) removeInternal(l, oldl);
386    *    }
387    * @return The resulting listener after the remove operation.  
388    */    /**
389  public static MouseMotionListener     * Removes the listener <code>old</code> from the listener <code>lis</code>.
390  remove(MouseMotionListener lis, MouseMotionListener old)     *
391  {     * @param lis The listener to remove <code>old</code> from.
392    return((MouseMotionListener)removeInternal(lis, old));     * @param old The listener to remove.
393  }     *
394       * @return The resulting listener after the remove operation.
395  /*************************************************************************/     */
396      public static ContainerListener remove(ContainerListener l,
397  /**                                           ContainerListener oldl)
398    * Removes the listener <code>old</code> from the listener <code>lis</code>.    {
399    *      return (ContainerListener) removeInternal(l, oldl);
400    * @param lis The listener to remove <code>old</code> from.    }
401    * @param old The listener to remove.  
402    *    /**
403    * @return The resulting listener after the remove operation.     * Removes the listener <code>old</code> from the listener <code>lis</code>.
404    */     *
405  public static WindowListener     * @param lis The listener to remove <code>old</code> from.
406  remove(WindowListener lis, WindowListener old)     * @param old The listener to remove.
407  {     *
408    return((WindowListener)removeInternal(lis, old));     * @return The resulting listener after the remove operation.
409  }     */
410      public static FocusListener remove(FocusListener l, FocusListener oldl)
411  /*************************************************************************/    {
412        return (FocusListener) removeInternal(l, oldl);
413  /**    }
414    * Removes the listener <code>old</code> from the listener <code>lis</code>.  
415    *    public static HierarchyBoundsListener remove(HierarchyBoundsListener l,
416    * @param lis The listener to remove <code>old</code> from.                                                 HierarchyBoundsListener oldl)
417    * @param old The listener to remove.    {
418    *      return (HierarchyBoundsListener) removeInternal(l, oldl);
419    * @return The resulting listener after the remove operation.    }
420    */  
421  public static TextListener    public static HierarchyListener remove(HierarchyListener l,
422  remove(TextListener lis, TextListener old)                                           HierarchyListener oldl)
423  {    {
424    return((TextListener)removeInternal(lis, old));      return (HierarchyListener) removeInternal(l, oldl);
425  }    }
426    
427  /*************************************************************************/    public static InputMethodListener remove(InputMethodListener l,
428                                               InputMethodListener oldl)
429  /**    {
430    * Removes the listener <code>old</code> from the listener <code>lis</code>.      return (InputMethodListener) removeInternal(l, oldl);
431    *    }
432    * @param lis The listener to remove <code>old</code> from.  
433    * @param old The listener to remove.    /**
434    *     * Removes the listener <code>old</code> from the listener <code>lis</code>.
435    * @return The resulting listener after the remove operation.     *
436    */     * @param lis The listener to remove <code>old</code> from.
437  public static ActionListener     * @param old The listener to remove.
438  remove(ActionListener lis, ActionListener old)     *
439  {     * @return The resulting listener after the remove operation.
440    return((ActionListener)removeInternal(lis, old));     */
441  }    public static ItemListener remove(ItemListener l, ItemListener oldl)
442      {
443  /*************************************************************************/      return (ItemListener) removeInternal(l, oldl);
444      }
445  /**  
446    * Removes the listener <code>old</code> from the listener <code>lis</code>.    /**
447    *     * Removes the listener <code>old</code> from the listener <code>lis</code>.
448    * @param lis The listener to remove <code>old</code> from.     *
449    * @param old The listener to remove.     * @param lis The listener to remove <code>old</code> from.
450    *     * @param old The listener to remove.
451    * @return The resulting listener after the remove operation.     *
452    */     * @return The resulting listener after the remove operation.
453  public static ItemListener     */
454  remove(ItemListener lis, ItemListener old)    public static KeyListener remove(KeyListener l, KeyListener oldl)
455  {    {
456    return((ItemListener)removeInternal(lis, old));      return (KeyListener) removeInternal(l, oldl);
457  }    }
458    
459  /*************************************************************************/    /**
460       * Removes the listener <code>old</code> from the listener <code>lis</code>.
461  /**     *
462    * Removes the listener <code>old</code> from the listener <code>lis</code>.     * @param lis The listener to remove <code>old</code> from.
463    *     * @param old The listener to remove.
464    * @param lis The listener to remove <code>old</code> from.     *
465    * @param old The listener to remove.     * @return The resulting listener after the remove operation.
466    *     */
467    * @return The resulting listener after the remove operation.    public static MouseListener remove(MouseListener l, MouseListener oldl)
468    */    {
469  public static AdjustmentListener      return (MouseListener) removeInternal(l, oldl);
470  remove(AdjustmentListener lis, AdjustmentListener old)    }
471  {  
472    return((AdjustmentListener)removeInternal(lis, old));    /**
473  }     * Removes the listener <code>old</code> from the listener <code>lis</code>.
474       *
475  /*************************************************************************/     * @param lis The listener to remove <code>old</code> from.
476       * @param old The listener to remove.
477  /**     *
478    * Removes the listener <code>old</code> from the listener <code>lis</code>.     * @return The resulting listener after the remove operation.
479    *     */
480    * @param lis The listener to remove <code>old</code> from.    public static MouseMotionListener remove(MouseMotionListener l,
481    * @param old The listener to remove.                                             MouseMotionListener oldl)
482    *    {
483    * @return The resulting listener after the remove operation.      return (MouseMotionListener) removeInternal(l, oldl);
484    */    }
485  public static TextListener  
486  remove(AdjustmentListener lis, TextListener old)    /**
487  {     * Removes the listener <code>old</code> from the listener <code>lis</code>.
488    return((TextListener)removeInternal(lis, old));     *
489  }     * @param lis The listener to remove <code>old</code> from.
490       * @param old The listener to remove.
491  /*************************************************************************/     *
492       * @return The resulting listener after the remove operation.
493  /**     */
494    * Removes the listener <code>old</code> from the listener <code>lis</code>.    public static TextListener remove(TextListener l, TextListener oldl)                                            
495    *    {
496    * @param lis The listener to remove <code>old</code> from.      return (TextListener) removeInternal(l, oldl);
497    * @param old The listener to remove.    }
498    *  
499    * @return The resulting listener after the remove operation.    /**
500    */     * Removes the listener <code>old</code> from the listener <code>lis</code>.
501  public static EventListener     *
502  removeInternal(EventListener lis, EventListener old)     * @param lis The listener to remove <code>old</code> from.
503  {     * @param old The listener to remove.
504    if (lis == null)     *
505      return(null);     * @return The resulting listener after the remove operation.
506    else if (lis == old)     */
507      return(null);    public static WindowListener remove(WindowListener l, WindowListener oldl)
508    else if (lis instanceof AWTEventMulticaster)    {
509      return(((AWTEventMulticaster)lis).remove(old));      return (WindowListener) removeInternal(l, oldl);
510    else    }
511      return(lis);  
512  }    /**
513       * Handles this event by dispatching it to the "a" and "b" listener
514  /*************************************************************************/     * instances.
515       *
516  /**     * @param event The event to handle.
517    * // FIXME: What does this method do?     */
518    */    public void actionPerformed(ActionEvent e)
519  protected static void    {
520  save(ObjectOutputStream stream, String str, EventListener lis)      ((ActionListener) a).actionPerformed(e);
521       throws IOException      ((ActionListener) b).actionPerformed(e);
522  {    }
523    throw new RuntimeException("Not Implemented");  
524  }    /**
525       * Handles this event by dispatching it to the "a" and "b" listener
526  /*************************************************************************/     * instances.
527       *
528  /*     * @param event The event to handle.
529   * Constructors     */
530   */    public void adjustmentValueChanged(AdjustmentEvent e)
531      {
532  /**      ((AdjustmentListener) a).adjustmentValueChanged(e);
533    * Initializes a new instance of <code>AWTEventMulticaster</code> with      ((AdjustmentListener) b).adjustmentValueChanged(e);
534    * the specified event listener parameters.    }
535    *  
536    * @param a The "a" listener object.    /**
537    * @param b The "b" listener object.     * Handles this event by dispatching it to the "a" and "b" listener
538    */     * instances.
539  protected     *
540  AWTEventMulticaster(EventListener a, EventListener b)     * @param event The event to handle.
541  {     */
542    this.a = a;    public void componentHidden(ComponentEvent e)
543    this.b = b;    {
544        ((ComponentListener) a).componentHidden(e);
545        ((ComponentListener) b).componentHidden(e);
546      }
547    
548      /**
549       * Handles this event by dispatching it to the "a" and "b" listener
550       * instances.
551       *
552       * @param event The event to handle.
553       */
554      public void componentMoved(ComponentEvent e)
555      {
556        ((ComponentListener) a).componentMoved(e);
557        ((ComponentListener) b).componentMoved(e);
558      }
559    
560      /**
561       * Handles this event by dispatching it to the "a" and "b" listener
562       * instances.
563       *
564       * @param event The event to handle.
565       */
566      public void componentResized(ComponentEvent e)
567      {
568        ((ComponentListener) a).componentResized(e);
569        ((ComponentListener) b).componentResized(e);
570      }
571    
572      /**
573       * Handles this event by dispatching it to the "a" and "b" listener
574       * instances.
575       *
576       * @param event The event to handle.
577       */
578      public void componentShown(ComponentEvent e)
579      {
580        ((ComponentListener) a).componentShown(e);
581        ((ComponentListener) b).componentShown(e);
582      }
583    
584      /**
585       * Handles this event by dispatching it to the "a" and "b" listener
586       * instances.
587       *
588       * @param event The event to handle.
589       */
590      public void componentAdded(ContainerEvent e)
591      {
592        ((ContainerListener) a).componentAdded(e);
593        ((ContainerListener) b).componentAdded(e);
594      }
595    
596      /**
597       * Handles this event by dispatching it to the "a" and "b" listener
598       * instances.
599       *
600       * @param event The event to handle.
601       */
602      public void componentRemoved(ContainerEvent e)
603      {
604        ((ContainerListener) a).componentRemoved(e);
605        ((ContainerListener) b).componentRemoved(e);
606      }
607    
608      /**
609       * Handles this event by dispatching it to the "a" and "b" listener
610       * instances.
611       *
612       * @param event The event to handle.
613       */
614      public void focusGained(FocusEvent e)
615      {
616        ((FocusListener) a).focusGained(e);
617        ((FocusListener) b).focusGained(e);
618      }
619    
620      /**
621       * Handles this event by dispatching it to the "a" and "b" listener
622       * instances.
623       *
624       * @param event The event to handle.
625       */
626      public void focusLost(FocusEvent e)
627      {
628        ((FocusListener) a).focusLost(e);
629        ((FocusListener) b).focusLost(e);
630      }
631    
632      /**
633       * Handles this event by dispatching it to the "a" and "b" listener
634       * instances.
635       *
636       * @param event The event to handle.
637       */
638      public void ancestorMoved(HierarchyEvent e)
639      {
640        ((HierarchyBoundsListener) a).ancestorMoved(e);
641        ((HierarchyBoundsListener) b).ancestorMoved(e);
642      }
643    
644      /**
645       * Handles this event by dispatching it to the "a" and "b" listener
646       * instances.
647       *
648       * @param event The event to handle.
649       */
650      public void ancestorResized(HierarchyEvent e)
651      {
652        ((HierarchyBoundsListener) a).ancestorResized(e);
653        ((HierarchyBoundsListener) b).ancestorResized(e);
654      }
655    
656      /**
657       * Handles this event by dispatching it to the "a" and "b" listener
658       * instances.
659       *
660       * @param event The event to handle.
661       */
662      public void hierarchyChanged(HierarchyEvent e)
663      {
664        ((HierarchyListener) a).hierarchyChanged(e);
665        ((HierarchyListener) b).hierarchyChanged(e);
666      }
667    
668      /**
669       * Handles this event by dispatching it to the "a" and "b" listener
670       * instances.
671       *
672       * @param event The event to handle.
673       */
674      public void caretPositionChanged(InputMethodEvent e)
675      {
676        ((InputMethodListener) a).caretPositionChanged(e);
677        ((InputMethodListener) b).caretPositionChanged(e);
678      }
679    
680      /**
681       * Handles this event by dispatching it to the "a" and "b" listener
682       * instances.
683       *
684       * @param event The event to handle.
685       */
686      public void inputMethodTextChanged(InputMethodEvent e)
687      {
688        ((InputMethodListener) a).inputMethodTextChanged(e);
689        ((InputMethodListener) b).inputMethodTextChanged(e);
690      }
691    
692      /**
693       * Handles this event by dispatching it to the "a" and "b" listener
694       * instances.
695       *
696       * @param event The event to handle.
697       */
698      public void itemStateChanged(ItemEvent e)
699      {
700        ((ItemListener) a).itemStateChanged(e);
701        ((ItemListener) b).itemStateChanged(e);
702      }  
703    
704      /**
705       * Handles this event by dispatching it to the "a" and "b" listener
706       * instances.
707       *
708       * @param event The event to handle.
709       */
710      public void keyPressed(KeyEvent e)
711      {
712        ((KeyListener) a).keyPressed(e);
713        ((KeyListener) b).keyPressed(e);
714      }
715    
716      /**
717       * Handles this event by dispatching it to the "a" and "b" listener
718       * instances.
719       *
720       * @param event The event to handle.
721       */
722      public void keyReleased(KeyEvent e)
723      {
724        ((KeyListener) a).keyReleased(e);
725        ((KeyListener) b).keyReleased(e);
726      }
727    
728      /**
729       * Handles this event by dispatching it to the "a" and "b" listener
730       * instances.
731       *
732       * @param event The event to handle.
733       */
734      public void keyTyped(KeyEvent e)
735      {
736        ((KeyListener) a).keyTyped(e);
737        ((KeyListener) b).keyTyped(e);
738      }
739    
740      /**
741       * Handles this event by dispatching it to the "a" and "b" listener
742       * instances.
743       *
744       * @param event The event to handle.
745       */
746      public void mouseClicked(MouseEvent e)
747      {
748        ((MouseListener) a).mouseClicked(e);
749        ((MouseListener) b).mouseClicked(e);
750      }
751    
752      /**
753       * Handles this event by dispatching it to the "a" and "b" listener
754       * instances.
755       *
756       * @param event The event to handle.
757       */
758      public void mouseEntered(MouseEvent e)
759      {
760        ((MouseListener) a).mouseEntered(e);
761        ((MouseListener) b).mouseEntered(e);
762      }
763    
764      /**
765       * Handles this event by dispatching it to the "a" and "b" listener
766       * instances.
767       *
768       * @param event The event to handle.
769       */
770      public void mouseExited(MouseEvent e)
771      {
772        ((MouseListener) a).mouseExited(e);
773        ((MouseListener) b).mouseExited(e);
774      }
775    
776      /**
777       * Handles this event by dispatching it to the "a" and "b" listener
778       * instances.
779       *
780       * @param event The event to handle.
781       */
782      public void mousePressed(MouseEvent e)
783      {
784        ((MouseListener) a).mousePressed(e);
785        ((MouseListener) b).mousePressed(e);
786      }
787    
788      /**
789       * Handles this event by dispatching it to the "a" and "b" listener
790       * instances.
791       *
792       * @param event The event to handle.
793       */
794      public void mouseReleased(MouseEvent e)
795      {
796        ((MouseListener) a).mouseReleased(e);
797        ((MouseListener) b).mouseReleased(e);
798      }
799    
800      /**
801       * Handles this event by dispatching it to the "a" and "b" listener
802       * instances.
803       *
804       * @param event The event to handle.
805       */
806      public void mouseDragged(MouseEvent e)
807      {
808        ((MouseMotionListener) a).mouseDragged(e);
809        ((MouseMotionListener) b).mouseDragged(e);
810      }
811    
812      /**
813       * Handles this event by dispatching it to the "a" and "b" listener
814       * instances.
815       *
816       * @param event The event to handle.
817       */
818      public void mouseMoved(MouseEvent e)
819      {
820        ((MouseMotionListener) a).mouseMoved(e);
821        ((MouseMotionListener) b).mouseMoved(e);
822      }
823    
824      /**
825       * Handles this event by dispatching it to the "a" and "b" listener
826       * instances.
827       *
828       * @param event The event to handle.
829       */
830      public void textValueChanged(TextEvent e)
831      {
832        ((TextListener) a).textValueChanged(e);
833        ((TextListener) b).textValueChanged(e);
834      }
835    
836      /**
837       * Handles this event by dispatching it to the "a" and "b" listener
838       * instances.
839       *
840       * @param event The event to handle.
841       */
842      public void windowActivated(WindowEvent e)
843      {
844        ((WindowListener) a).windowActivated(e);
845        ((WindowListener) b).windowActivated(e);
846      }
847    
848      /**
849       * Handles this event by dispatching it to the "a" and "b" listener
850       * instances.
851       *
852       * @param event The event to handle.
853       */
854      public void windowClosed(WindowEvent e)
855      {
856        ((WindowListener) a).windowClosed(e);
857        ((WindowListener) b).windowClosed(e);
858      }
859    
860      /**
861       * Handles this event by dispatching it to the "a" and "b" listener
862       * instances.
863       *
864       * @param event The event to handle.
865       */
866      public void windowClosing(WindowEvent e)
867      {
868        ((WindowListener) a).windowClosing(e);
869        ((WindowListener) b).windowClosing(e);
870      }
871    
872      /**
873       * Handles this event by dispatching it to the "a" and "b" listener
874       * instances.
875       *
876       * @param event The event to handle.
877       */
878      public void windowDeactivated(WindowEvent e)
879      {
880        ((WindowListener) a).windowDeactivated(e);
881        ((WindowListener) b).windowDeactivated(e);
882      }
883    
884      /**
885       * Handles this event by dispatching it to the "a" and "b" listener
886       * instances.
887       *
888       * @param event The event to handle.
889       */
890      public void windowDeiconified(WindowEvent e)
891      {
892        ((WindowListener) a).windowDeiconified(e);
893        ((WindowListener) b).windowDeiconified(e);
894      }
895    
896      /**
897       * Handles this event by dispatching it to the "a" and "b" listener
898       * instances.
899       *
900       * @param event The event to handle.
901       */
902      public void windowIconified(WindowEvent e)
903      {
904        ((WindowListener) a).windowIconified(e);
905        ((WindowListener) b).windowIconified(e);
906      }
907    
908      /**
909       * Handles this event by dispatching it to the "a" and "b" listener
910       * instances.
911       *
912       * @param event The event to handle.
913       */
914      public void windowOpened(WindowEvent e)
915      {
916        ((WindowListener) a).windowOpened(e);
917        ((WindowListener) b).windowOpened(e);
918      }
919    
920      protected static void save(ObjectOutputStream s, String k, EventListener l)
921      {
922        throw new RuntimeException("Not Implemented");
923      }
924    
925      protected void saveInternal(ObjectOutputStream s, String k)
926      {
927        throw new RuntimeException("Not Implemented");
928      }
929  }  }
   
 /*************************************************************************/  
   
 /*  
  * Instance Methods  
  */  
   
 /**  
   * Removes the specified object from this multicaster object.  If the  
   * object to remove is not part of this multicaster, then the remove  
   * method on the parent multicaster (if it exists) is called and a  
   * new multicaster object is returned based on that object and this  
   * multicaster's non-parent object.  
   *  
   * @param old The object to remove from this multicaster.  
   *  
   * @return The resulting multicaster with the specified listener removed.  
   */  
 protected EventListener  
 remove(EventListener old)  
 {  
   if (this.b == old)  
     {  
       return(a);  
     }  
   else if (a instanceof AWTEventMulticaster)  
     {  
       EventListener l = ((AWTEventMulticaster)a).remove(old);  
       return(new AWTEventMulticaster(l, b));  
     }  
   else if (this.a == old)  
     {  
       return(b);  
     }  
   else  
     {  
       return(this);  
     }  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 componentResized(ComponentEvent event)  
 {  
   ((ComponentListener)a).componentResized(event);  
   ((ComponentListener)b).componentResized(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 componentMoved(ComponentEvent event)  
 {  
   ((ComponentListener)a).componentMoved(event);  
   ((ComponentListener)b).componentMoved(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 componentShown(ComponentEvent event)  
 {  
   ((ComponentListener)a).componentShown(event);  
   ((ComponentListener)b).componentShown(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 componentHidden(ComponentEvent event)  
 {  
   ((ComponentListener)a).componentHidden(event);  
   ((ComponentListener)b).componentHidden(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 componentAdded(ContainerEvent event)  
 {  
   ((ContainerListener)a).componentAdded(event);  
   ((ContainerListener)b).componentAdded(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 componentRemoved(ContainerEvent event)  
 {  
   ((ContainerListener)a).componentRemoved(event);  
   ((ContainerListener)b).componentRemoved(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 focusGained(FocusEvent event)  
 {  
   ((FocusListener)a).focusGained(event);  
   ((FocusListener)b).focusGained(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 focusLost(FocusEvent event)  
 {  
   ((FocusListener)a).focusLost(event);  
   ((FocusListener)b).focusLost(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 keyTyped(KeyEvent event)  
 {  
   ((KeyListener)a).keyTyped(event);  
   ((KeyListener)b).keyTyped(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 keyPressed(KeyEvent event)  
 {  
   ((KeyListener)a).keyPressed(event);  
   ((KeyListener)b).keyPressed(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 keyReleased(KeyEvent event)  
 {  
   ((KeyListener)a).keyReleased(event);  
   ((KeyListener)b).keyReleased(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 mouseClicked(MouseEvent event)  
 {  
   ((MouseListener)a).mouseClicked(event);  
   ((MouseListener)b).mouseClicked(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 mousePressed(MouseEvent event)  
 {  
   ((MouseListener)a).mousePressed(event);  
   ((MouseListener)b).mousePressed(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 mouseReleased(MouseEvent event)  
 {  
   ((MouseListener)a).mouseReleased(event);  
   ((MouseListener)b).mouseReleased(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 mouseEntered(MouseEvent event)  
 {  
   ((MouseListener)a).mouseEntered(event);  
   ((MouseListener)b).mouseEntered(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 mouseExited(MouseEvent event)  
 {  
   ((MouseListener)a).mouseExited(event);  
   ((MouseListener)b).mouseExited(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 mouseDragged(MouseEvent event)  
 {  
   ((MouseMotionListener)a).mouseDragged(event);  
   ((MouseMotionListener)b).mouseDragged(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 mouseMoved(MouseEvent event)  
 {  
   ((MouseMotionListener)a).mouseMoved(event);  
   ((MouseMotionListener)b).mouseMoved(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 windowOpened(WindowEvent event)  
 {  
   ((WindowListener)a).windowOpened(event);  
   ((WindowListener)b).windowOpened(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 windowClosed(WindowEvent event)  
 {  
   ((WindowListener)a).windowClosed(event);  
   ((WindowListener)b).windowClosed(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 windowClosing(WindowEvent event)  
 {  
   ((WindowListener)a).windowClosing(event);  
   ((WindowListener)b).windowClosing(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 windowIconified(WindowEvent event)  
 {  
   ((WindowListener)a).windowIconified(event);  
   ((WindowListener)b).windowIconified(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 windowDeiconified(WindowEvent event)  
 {  
   ((WindowListener)a).windowDeiconified(event);  
   ((WindowListener)b).windowDeiconified(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 windowActivated(WindowEvent event)  
 {  
   ((WindowListener)a).windowActivated(event);  
   ((WindowListener)b).windowActivated(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 windowDeactivated(WindowEvent event)  
 {  
   ((WindowListener)a).windowDeactivated(event);  
   ((WindowListener)b).windowDeactivated(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 actionPerformed(ActionEvent event)  
 {  
   ((ActionListener)a).actionPerformed(event);  
   ((ActionListener)b).actionPerformed(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 itemStateChanged(ItemEvent event)  
 {  
   ((ItemListener)a).itemStateChanged(event);  
   ((ItemListener)b).itemStateChanged(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 adjustmentValueChanged(AdjustmentEvent event)  
 {  
   ((AdjustmentListener)a).adjustmentValueChanged(event);  
   ((AdjustmentListener)b).adjustmentValueChanged(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * Handles this event by dispatching it to the "a" and "b" listener  
   * instances.  
   *  
   * @param event The event to handle.  
   */  
 public void  
 textValueChanged(TextEvent event)  
 {  
   ((TextListener)a).textValueChanged(event);  
   ((TextListener)b).textValueChanged(event);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * // FIXME: What does this method do?  
   */  
 protected void  
 saveInternal(ObjectOutputStream stream, String str) throws IOException  
 {  
   throw new RuntimeException("Not Implemented");  
 }  
   
 } // class AWTEventMulticaster  
   

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26