1 16 package org.apache.cocoon.forms.event; 17 18 import java.awt.AWTEventMulticaster ; 19 import java.util.EventListener ; 20 21 import org.apache.cocoon.forms.formmodel.tree.TreeSelectionEvent; 22 import org.apache.cocoon.forms.formmodel.tree.TreeSelectionListener; 23 24 31 public class WidgetEventMulticaster extends AWTEventMulticaster implements 32 ActionListener, ValueChangedListener, ProcessingPhaseListener { 33 34 protected WidgetEventMulticaster(EventListener a, EventListener b) { 35 super(a, b); 36 } 37 38 40 public static CreateListener add(CreateListener a, CreateListener b) { 41 return (CreateListener)addInternal(a, b); 42 } 43 44 public static CreateListener remove(CreateListener l, CreateListener oldl) { 45 return (CreateListener)removeInternal(l, oldl); 46 } 47 48 public void widgetCreated(CreateEvent e) { 49 ((CreateListener)a).widgetCreated(e); 50 ((CreateListener)b).widgetCreated(e); 51 } 52 53 55 public static ActionListener add(ActionListener a, ActionListener b) { 56 return (ActionListener)addInternal(a, b); 57 } 58 59 public static ActionListener remove(ActionListener l, ActionListener oldl) { 60 return (ActionListener)removeInternal(l, oldl); 61 } 62 63 public void actionPerformed(ActionEvent e) { 64 ((ActionListener)a).actionPerformed(e); 65 ((ActionListener)b).actionPerformed(e); 66 } 67 68 70 public static ValueChangedListener add(ValueChangedListener a, ValueChangedListener b) { 71 return (ValueChangedListener)addInternal(a, b); 72 } 73 74 public static ValueChangedListener remove(ValueChangedListener l, ValueChangedListener oldl) { 75 return (ValueChangedListener)removeInternal(l, oldl); 76 } 77 78 public void valueChanged(ValueChangedEvent e) { 79 ((ValueChangedListener)a).valueChanged(e); 80 ((ValueChangedListener)b).valueChanged(e); 81 } 82 83 85 public void phaseEnded(ProcessingPhaseEvent e) { 86 ((ProcessingPhaseListener)a).phaseEnded(e); 87 ((ProcessingPhaseListener)b).phaseEnded(e); 88 } 89 90 public static ProcessingPhaseListener add(ProcessingPhaseListener a, ProcessingPhaseListener b) { 91 return (ProcessingPhaseListener)addInternal(a, b); 92 } 93 94 public static ProcessingPhaseListener remove(ProcessingPhaseListener l, ProcessingPhaseListener oldl) { 95 return (ProcessingPhaseListener)removeInternal(l, oldl); 96 } 97 98 100 public static TreeSelectionListener add(TreeSelectionListener a, TreeSelectionListener b) { 101 return (TreeSelectionListener)addInternal(a, b); 102 } 103 104 public static TreeSelectionListener remove(TreeSelectionListener l, TreeSelectionListener oldl) { 105 return (TreeSelectionListener)removeInternal(l, oldl); 106 } 107 108 public void selectionChanged(TreeSelectionEvent e) { 109 ((TreeSelectionListener)a).selectionChanged(e); 110 ((TreeSelectionListener)b).selectionChanged(e); 111 } 112 113 116 protected static EventListener addInternal(EventListener a, EventListener b) { 117 if (a == null) return b; 118 if (b == null) return a; 119 return new WidgetEventMulticaster(a, b); 120 } 121 } 122 | Popular Tags |