Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ListenerMap |
|
| 1.0;1 |
1 | // Copyright 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 | ||
15 | package org.apache.tapestry.listener; | |
16 | ||
17 | import org.apache.hivemind.ApplicationRuntimeException; | |
18 | import org.apache.tapestry.IActionListener; | |
19 | import org.apache.tapestry.IComponent; | |
20 | ||
21 | import java.util.Collection; | |
22 | ||
23 | /** | |
24 | * @author Howard M. Lewis Ship | |
25 | */ | |
26 | public interface ListenerMap | |
27 | { | |
28 | ||
29 | /** | |
30 | * Gets a listener for the given name (which is both a property name and a | |
31 | * method name). The listener is created as needed, but is also cached for | |
32 | * later use. The returned object implements the | |
33 | * {@link org.apache.tapestry.IActionListener}. | |
34 | * | |
35 | * @param name | |
36 | * the name of the method to invoke (the most appropriate method | |
37 | * will be selected if there are multiple overloadings of the | |
38 | * same method name) | |
39 | * @return an object implementing {@link IActionListener}. | |
40 | * @throws ApplicationRuntimeException | |
41 | * if the listener can not be created. | |
42 | */ | |
43 | IActionListener getListener(String name); | |
44 | ||
45 | /** | |
46 | * Gets a listener on the given component generated from the capitalized | |
47 | * component id, prefixed by "do". For example, jwcid="clear@DirectLink" | |
48 | * would have a listener called doClear(). | |
49 | * | |
50 | * @param component | |
51 | * the component whose id is used to make up the name of the | |
52 | * expected listener | |
53 | * @return an object implementing {@link IActionListener}. | |
54 | * @throws ApplicationRuntimeException | |
55 | * if the listener can not be found on the component | |
56 | */ | |
57 | IActionListener getImplicitListener(IComponent component); | |
58 | ||
59 | /** | |
60 | * Returns an unmodifiable collection of the names of the listeners | |
61 | * implemented by the target class. | |
62 | * | |
63 | * @return List of known listener names. | |
64 | * @since 1.0.6 | |
65 | */ | |
66 | Collection getListenerNames(); | |
67 | ||
68 | /** | |
69 | * Returns true if this ListenerMapImpl can provide a listener with the | |
70 | * given name. | |
71 | * | |
72 | * @param name Name of the method to check listener existance of. | |
73 | * @return True if there is a matching listener of that name, false otherwise. | |
74 | * @since 2.2 | |
75 | */ | |
76 | boolean canProvideListener(String name); | |
77 | } |