Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
WidgetListenerBinder |
|
| 0.0;0 |
1 | /* | |
2 | * Copyright 2004-2008 the Seasar Foundation and the Others. | |
3 | * | |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | |
13 | * either express or implied. See the License for the specific language | |
14 | * governing permissions and limitations under the License. | |
15 | */ | |
16 | package org.seasar.uruma.binding.method.impl; | |
17 | ||
18 | import org.eclipse.swt.widgets.Listener; | |
19 | import org.eclipse.swt.widgets.Widget; | |
20 | import org.seasar.uruma.binding.method.EventListenerDef; | |
21 | import org.seasar.uruma.binding.method.GenericListener; | |
22 | import org.seasar.uruma.binding.method.ListenerBinder; | |
23 | import org.seasar.uruma.binding.method.MethodBinding; | |
24 | import org.seasar.uruma.context.PartContext; | |
25 | import org.seasar.uruma.context.WidgetHandle; | |
26 | ||
27 | /** | |
28 | * {@link Widget} のための {@link ListenerBinder} です。<br /> | |
29 | * | |
30 | * @author y-komori | |
31 | */ | |
32 | 4 | public class WidgetListenerBinder extends AbstractListenerBinder { |
33 | ||
34 | /* | |
35 | * @see org.seasar.uruma.binding.method.ListenerBinder#bindListener(org.seasar.uruma.context.WidgetHandle, | |
36 | * org.seasar.uruma.context.PartContext, | |
37 | * org.seasar.uruma.binding.method.MethodBinding, | |
38 | * org.seasar.uruma.binding.method.EventListenerDef) | |
39 | */ | |
40 | public Class<?> bindListener(final WidgetHandle handle, | |
41 | final PartContext context, final MethodBinding binding, | |
42 | final EventListenerDef def) { | |
43 | 408 | Widget widget = handle.<Widget> getCastWidget(); |
44 | 408 | Listener listener = new GenericListener(context, binding); |
45 | 408 | widget.addListener(def.getType().getSWTEventType(), listener); |
46 | 408 | return GenericListener.class; |
47 | } | |
48 | ||
49 | /* | |
50 | * @see org.seasar.uruma.binding.method.ListenerBinder#getTargetCLass() | |
51 | */ | |
52 | public Class<?> getTargetCLass() { | |
53 | 416 | return Widget.class; |
54 | } | |
55 | } |