|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
SyntheticListener.java | - | 100% | 100% | 100% |
|
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 java.lang.reflect.Method;
|
|
18 |
|
|
19 |
import org.apache.tapestry.IActionListener;
|
|
20 |
import org.apache.tapestry.IComponent;
|
|
21 |
import org.apache.tapestry.IRequestCycle;
|
|
22 |
|
|
23 |
/**
|
|
24 |
* @author Howard Lewis Ship
|
|
25 |
* @since 3.1
|
|
26 |
*/
|
|
27 |
|
|
28 |
public class SyntheticListener implements IActionListener |
|
29 |
{ |
|
30 |
private Object _target;
|
|
31 |
|
|
32 |
private Method _method;
|
|
33 |
|
|
34 | 48 |
public SyntheticListener(Object target, Method method)
|
35 |
{ |
|
36 | 48 |
_target = target; |
37 | 48 |
_method = method; |
38 |
} |
|
39 |
|
|
40 | 65 |
private void invoke(IRequestCycle cycle) |
41 |
{ |
|
42 | 65 |
Object[] args = new Object[]
|
43 |
{ cycle }; |
|
44 |
|
|
45 | 65 |
ListenerMap.invokeTargetMethod(_target, _method, args); |
46 |
} |
|
47 |
|
|
48 | 65 |
public void actionTriggered(IComponent component, IRequestCycle cycle) |
49 |
{ |
|
50 | 65 |
invoke(cycle); |
51 |
} |
|
52 |
|
|
53 | 1 |
public String toString()
|
54 |
{ |
|
55 | 1 |
StringBuffer buffer = new StringBuffer("SyntheticListener["); |
56 |
|
|
57 | 1 |
buffer.append(_target); |
58 | 1 |
buffer.append(' '); |
59 | 1 |
buffer.append(_method); |
60 | 1 |
buffer.append(']'); |
61 |
|
|
62 | 1 |
return buffer.toString();
|
63 |
} |
|
64 |
|
|
65 |
} |
|