01: /*
02: * Copyright Javelin Software, All rights reserved.
03: */
04:
05: package com.javelin.swinglets;
06:
07: import java.awt.*;
08: import java.awt.event.*;
09: import java.util.*;
10:
11: import com.javelin.swinglets.event.*;
12:
13: /**
14: * This is an extension of AWTEventMulticaster that handles additional
15: * Swinglet Events.
16: *
17: * @author Robin Sharp
18: */
19:
20: public class SwingletEventMulticaster extends AWTEventMulticaster {
21: FormListener formListener;
22:
23: /**
24: * @see com.awt.AWTEventMulticaster()
25: */
26: protected SwingletEventMulticaster(EventListener a, EventListener b) {
27: super (a, b);
28: }
29:
30: /**
31: * Handles the formChanged event by invoking the
32: * formChanged methods on listener-a and listener-b.
33: * @param e the component event
34: */
35: public void formChanged(FormEvent e) {
36: ((FormListener) a).formSubmitted(e);
37: }
38:
39: /**
40: * Returns the resulting multicast listener from adding listener-a
41: * and listener-b together.
42: * If listener-a is null, it returns listener-b;
43: * If listener-b is null, it returns listener-a
44: * If neither are null, then it creates and returns
45: * a new AWTEventMulticaster instance which chains a with b.
46: * @param a event listener-a
47: * @param b event listener-b
48: */
49: protected static EventListener addInternal(EventListener a,
50: EventListener b) {
51: if (a == null)
52: return b;
53: if (b == null)
54: return a;
55: return new SwingletEventMulticaster(a, b);
56: }
57: }
|