Coverage Report - org.seasar.uruma.binding.method.WindowCloseListener
 
Classes in this File Line Coverage Branch Coverage Complexity
WindowCloseListener
83%
5/6
50%
1/2
2
 
 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;
 17  
 
 18  
 import org.eclipse.jface.window.Window;
 19  
 import org.seasar.uruma.context.PartContext;
 20  
 
 21  
 /**
 22  
  * ウィンドウを閉じる直前に呼び出されるリスナクラスです。<br />
 23  
  * 
 24  
  * @author y-komori
 25  
  */
 26  
 public class WindowCloseListener extends AbstractGenericListener {
 27  
 
 28  
     /**
 29  
      * {@link WindowCloseListener} を構築します。<br />
 30  
      * 
 31  
      * @param context
 32  
      *            {@link PartContext} オブジェクト
 33  
      * @param methodBinding
 34  
      *            {@link MethodBinding} オブジェクト
 35  
      */
 36  
     public WindowCloseListener(final PartContext context,
 37  
             final MethodBinding methodBinding) {
 38  4
         super(context, methodBinding);
 39  4
     }
 40  
 
 41  
     /**
 42  
      * ウィンドウクローズを許可してよいかを調べます。<br />
 43  
      * 
 44  
      * @return ウィンドウクローズを許可する場合は <code>true</code>、 許可しない場合は
 45  
      *         <code>false</code>。
 46  
      */
 47  
     public boolean canWindowClose(final Window window) {
 48  4
         Object ret = invokeMethod();
 49  4
         if (ret instanceof Boolean) {
 50  4
             return ((Boolean) ret).booleanValue();
 51  
         } else {
 52  0
             return true;
 53  
         }
 54  
     }
 55  
 }