Coverage Report - org.seasar.uruma.binding.method.impl.ViewerListenerBinder
 
Classes in this File Line Coverage Branch Coverage Complexity
ViewerListenerBinder
33%
2/6
N/A
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.jface.viewers.Viewer;
 19  
 import org.eclipse.swt.widgets.Listener;
 20  
 import org.eclipse.swt.widgets.Widget;
 21  
 import org.seasar.uruma.binding.method.EventListenerDef;
 22  
 import org.seasar.uruma.binding.method.GenericListener;
 23  
 import org.seasar.uruma.binding.method.ListenerBinder;
 24  
 import org.seasar.uruma.binding.method.MethodBinding;
 25  
 import org.seasar.uruma.context.PartContext;
 26  
 import org.seasar.uruma.context.WidgetHandle;
 27  
 
 28  
 /**
 29  
  * {@link Viewer} のための {@link ListenerBinder} です。<br />
 30  
  * 
 31  
  * @author y-komori
 32  
  */
 33  4
 public class ViewerListenerBinder extends AbstractListenerBinder {
 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  0
         Widget widget = handle.<Viewer> getCastWidget().getControl();
 44  
 
 45  0
         Listener listener = new GenericListener(context, binding);
 46  0
         widget.addListener(def.getType().getSWTEventType(), listener);
 47  0
         return GenericListener.class;
 48  
     }
 49  
 
 50  
     /*
 51  
      * @see org.seasar.uruma.binding.method.ListenerBinder#getTargetCLass()
 52  
      */
 53  
     public Class<?> getTargetCLass() {
 54  420
         return Viewer.class;
 55  
     }
 56  
 }