1 16 package org.apache.cocoon.woody.event; 17 18 import java.awt.AWTEventMulticaster ; 19 import java.util.EventListener ; 20 21 28 public class WidgetEventMulticaster extends AWTEventMulticaster implements 29 ActionListener, ValueChangedListener, ProcessingPhaseListener { 30 31 protected WidgetEventMulticaster(EventListener a, EventListener b) { 32 super(a, b); 33 } 34 35 public static ActionListener add(ActionListener a, ActionListener b) { 36 return (ActionListener)addInternal(a, b); 37 } 38 39 public static ActionListener remove(ActionListener l, ActionListener oldl) { 40 return (ActionListener)removeInternal(l, oldl); 41 } 42 43 public void actionPerformed(ActionEvent e) { 44 ((ActionListener)a).actionPerformed(e); 45 ((ActionListener)b).actionPerformed(e); 46 } 47 48 public static ValueChangedListener add(ValueChangedListener a, ValueChangedListener b) { 49 return (ValueChangedListener)addInternal(a, b); 50 } 51 52 public static ValueChangedListener remove(ValueChangedListener l, ValueChangedListener oldl) { 53 return (ValueChangedListener)removeInternal(l, oldl); 54 } 55 56 public void phaseEnded(ProcessingPhaseEvent e) { 57 ((ProcessingPhaseListener)a).phaseEnded(e); 58 ((ProcessingPhaseListener)b).phaseEnded(e); 59 } 60 61 public static ProcessingPhaseListener add(ProcessingPhaseListener a, ProcessingPhaseListener b) { 62 return (ProcessingPhaseListener)addInternal(a, b); 63 } 64 65 public static ProcessingPhaseListener remove(ProcessingPhaseListener l, ProcessingPhaseListener oldl) { 66 return (ProcessingPhaseListener)removeInternal(l, oldl); 67 } 68 69 public void valueChanged(ValueChangedEvent e) { 70 ((ValueChangedListener)a).valueChanged(e); 71 ((ValueChangedListener)b).valueChanged(e); 72 } 73 74 77 protected static EventListener addInternal(EventListener a, EventListener b) { 78 if (a == null) return b; 79 if (b == null) return a; 80 return new WidgetEventMulticaster(a, b); 81 } 82 } 83 | Popular Tags |