Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
IComponentEventInvoker |
|
| 1.0;1 |
1 | // Copyright 2004, 2005 The Apache Software Foundation |
|
2 | // |
|
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
|
4 | // you may not use this file except in compliance with the License. |
|
5 | // You may obtain a copy of the License at |
|
6 | // |
|
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
|
8 | // |
|
9 | // Unless required by applicable law or agreed to in writing, software |
|
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
12 | // See the License for the specific language governing permissions and |
|
13 | // limitations under the License. |
|
14 | package org.apache.tapestry.internal.event; |
|
15 | ||
16 | import org.apache.tapestry.IComponent; |
|
17 | import org.apache.tapestry.IForm; |
|
18 | import org.apache.tapestry.IRequestCycle; |
|
19 | import org.apache.tapestry.event.BrowserEvent; |
|
20 | import org.apache.tapestry.event.ResetEventListener; |
|
21 | import org.apache.tapestry.form.FormSupport; |
|
22 | import org.apache.tapestry.spec.IComponentSpecification; |
|
23 | ||
24 | import java.util.List; |
|
25 | ||
26 | ||
27 | /** |
|
28 | * Managed and handles invoking listener methods for components |
|
29 | * in response to requested event listener invocations. |
|
30 | * |
|
31 | * @author jkuhnert |
|
32 | */ |
|
33 | public interface IComponentEventInvoker extends ResetEventListener |
|
34 | { |
|
35 | /** |
|
36 | * Adds a listener mapping for events related to the specified |
|
37 | * component. |
|
38 | * |
|
39 | * @param componentId |
|
40 | * The component to map a listener with. |
|
41 | * @param listener |
|
42 | * The listener. |
|
43 | */ |
|
44 | void addEventListener(String componentId, IComponentSpecification listener); |
|
45 | ||
46 | /** |
|
47 | * Returns a list of all known listeners for the specified component. |
|
48 | * |
|
49 | * @param componentId |
|
50 | * The component id to find listeners for. |
|
51 | * @return The bound listeners, or null if none exist. |
|
52 | */ |
|
53 | List getEventListeners(String componentId); |
|
54 | ||
55 | /** |
|
56 | * Gets all bound property event listeners for the specified componentIdPath. |
|
57 | * |
|
58 | * @param componentIdPath |
|
59 | * The unique id path of the component, as returned from {@link org.apache.tapestry.IComponent#getIdPath()}. |
|
60 | * |
|
61 | * @return The aggregated array of all event properties bound to the specified component, empty if none exist. |
|
62 | */ |
|
63 | ComponentEventProperty[] getEventPropertyListeners(String componentIdPath); |
|
64 | ||
65 | /** |
|
66 | * Adds a mapping for an event listener that should be triggered when the specified |
|
67 | * form component with id of <code>formId</code> is submitted. This will later |
|
68 | * be used when the form is submitted to find event listeners bound to fire when |
|
69 | * a particular form is submitted. |
|
70 | * |
|
71 | * @param formId |
|
72 | * The form the event listener is bound to. This is the submitForm parameter |
|
73 | * of the EventListener annotation/spec driving an event occurrence to submit a particular form. It doesn't |
|
74 | * mean that the actual event target was the form . |
|
75 | * @param listener |
|
76 | * The listener that has form bound event listeners. |
|
77 | */ |
|
78 | void addFormEventListener(String formId, IComponentSpecification listener); |
|
79 | ||
80 | /** |
|
81 | * Gets a list of form bound event listeners previously bound via {@link #addFormEventListener(String, IComponentSpecification)}. |
|
82 | * |
|
83 | * @param formId |
|
84 | * The form to get mapped listeners for. |
|
85 | * @return The list of form event listeners of type {@link IComponentSpecification}, |
|
86 | * if any exist. Null if none exist. |
|
87 | */ |
|
88 | List getFormEventListeners(String formId); |
|
89 | ||
90 | /** |
|
91 | * Causes the configured listeners for the passed component to |
|
92 | * be invoked. |
|
93 | * |
|
94 | * @param component |
|
95 | * The component that recieved the invocations. |
|
96 | * @param cycle |
|
97 | * The associated request. |
|
98 | * @param event |
|
99 | * The event that started it all. |
|
100 | */ |
|
101 | void invokeListeners(IComponent component, final IRequestCycle cycle, final BrowserEvent event); |
|
102 | ||
103 | /** |
|
104 | * Causes the configured listeners for the passed {@link FormSupport}'s {@link IForm} to |
|
105 | * be invoked, if mapped to this request/event. |
|
106 | * |
|
107 | * @param formSupport |
|
108 | * The form support object being rendered. |
|
109 | * @param cycle |
|
110 | * The associated request. |
|
111 | * @param event |
|
112 | * The event that started it all. |
|
113 | */ |
|
114 | void invokeFormListeners(FormSupport formSupport, final IRequestCycle cycle, final BrowserEvent event); |
|
115 | } |