Coverage Report - org.seasar.uruma.annotation.EventListenerType
 
Classes in this File Line Coverage Branch Coverage Complexity
EventListenerType
100%
53/53
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.annotation;
 17  
 
 18  
 import java.util.HashMap;
 19  
 import java.util.Map;
 20  
 
 21  
 import org.eclipse.swt.SWT;
 22  
 import org.seasar.eclipse.common.util.SWTUtil;
 23  
 import org.seasar.uruma.binding.method.WindowCloseListener;
 24  
 
 25  
 /**
 26  
  * {@link EventListener} の種別を表す列挙型です。<br />
 27  
  * 
 28  
  * @author y-komori
 29  
  * @author bskuroneko
 30  
  */
 31  16
 public enum EventListenerType {
 32  
 
 33  
     // Key
 34  
     /**
 35  
      * @see SWT#KeyDown
 36  
      */
 37  4
     KEY_DOWN,
 38  
     /**
 39  
      * @see SWT#KeyUp
 40  
      */
 41  4
     KEY_UP,
 42  
 
 43  
     // Mouse
 44  
     /**
 45  
      * @see SWT#MouseDown
 46  
      */
 47  4
     MOUSE_DOWN,
 48  
 
 49  
     /**
 50  
      * @see SWT#MouseUp
 51  
      */
 52  4
     MOUSE_UP,
 53  
 
 54  
     /**
 55  
      * @see SWT#MouseMove
 56  
      */
 57  4
     MOUSE_MOVE,
 58  
 
 59  
     /**
 60  
      * @see SWT#MouseEnter
 61  
      */
 62  4
     MOUSE_ENTER,
 63  
 
 64  
     /**
 65  
      * @see SWT#MouseExit
 66  
      */
 67  4
     MOUSE_EXIT,
 68  
 
 69  
     /**
 70  
      * @see SWT#MouseDoubleClick
 71  
      */
 72  4
     MOUSE_DOUBLE_CLICK,
 73  
 
 74  
     /**
 75  
      * @see SWT#MouseHover
 76  
      */
 77  4
     MOUSE_HOVER,
 78  
 
 79  
     // Paint
 80  
     /**
 81  
      * @see SWT#Paint
 82  
      */
 83  4
     PAINT,
 84  
 
 85  
     // Control
 86  
     /**
 87  
      * @see SWT#Move
 88  
      */
 89  4
     MOVE,
 90  
 
 91  
     /**
 92  
      * @see SWT#Resize
 93  
      */
 94  4
     RESIZE,
 95  
 
 96  
     // Dispose
 97  
     /**
 98  
      * @see SWT#Dispose
 99  
      */
 100  4
     DISPOSE,
 101  
 
 102  
     // Selection
 103  
     /**
 104  
      * @see SWT#Selection
 105  
      */
 106  4
     SELECTION,
 107  
 
 108  
     /**
 109  
      * @see SWT#DefaultSelection
 110  
      */
 111  4
     DEFAULT_SELECTION,
 112  
 
 113  
     // Focus
 114  
     /**
 115  
      * @see SWT#FocusIn
 116  
      */
 117  4
     FOCUS_IN,
 118  
 
 119  
     /**
 120  
      * @see SWT#FocusOut
 121  
      */
 122  4
     FOCUS_OUT,
 123  
 
 124  
     // Tree
 125  
     /**
 126  
      * @see SWT#Expand
 127  
      */
 128  4
     EXPAND,
 129  
 
 130  
     /**
 131  
      * @see SWT#Collapse
 132  
      */
 133  4
     COLLAPSE,
 134  
 
 135  
     // Shell
 136  
     /**
 137  
      * @see SWT#Iconify
 138  
      */
 139  4
     ICONIFY,
 140  
 
 141  
     /**
 142  
      * @see SWT#Deiconify
 143  
      */
 144  4
     DEICONIFY,
 145  
 
 146  
     /**
 147  
      * @see SWT#Close
 148  
      */
 149  4
     CLOSE,
 150  
 
 151  
     /**
 152  
      * @see SWT#Activate
 153  
      */
 154  4
     ACTIVATE,
 155  
 
 156  
     /**
 157  
      * @see SWT#Deactivate
 158  
      */
 159  4
     DEACTIVATE,
 160  
 
 161  
     // Menu or Controll's visible change
 162  
     /**
 163  
      * @see SWT#Show
 164  
      */
 165  4
     SHOW,
 166  
 
 167  
     /**
 168  
      * @see SWT#Hide
 169  
      */
 170  4
     HIDE,
 171  
 
 172  
     // Modify
 173  
     /**
 174  
      * @see SWT#Modify
 175  
      */
 176  4
     MODIFY,
 177  
 
 178  
     // Verify
 179  
     /**
 180  
      * @see SWT#Verify
 181  
      */
 182  4
     VERIFY,
 183  
 
 184  
     // Help
 185  
     /**
 186  
      * @see SWT#Help
 187  
      */
 188  4
     HELP,
 189  
 
 190  
     // Arm
 191  
     /**
 192  
      * @see SWT#Arm
 193  
      */
 194  4
     ARM,
 195  
 
 196  
     // Traverse
 197  
     /**
 198  
      * @see SWT#Traverse
 199  
      */
 200  4
     TRAVERSE,
 201  
 
 202  
     // Others
 203  
     /**
 204  
      * @see SWT#DragDetect
 205  
      */
 206  4
     DRAG_DETECT,
 207  
 
 208  
     /**
 209  
      * @see SWT#HardKeyDown
 210  
      */
 211  4
     HARD_KEY_DOWN,
 212  
 
 213  
     /**
 214  
      * @see SWT#HardKeyDown
 215  
      */
 216  4
     HARD_KEY_UP,
 217  
 
 218  
     /**
 219  
      * @see SWT#MenuDetect
 220  
      */
 221  4
     MENU_DETECT,
 222  
 
 223  
     /**
 224  
      * @see SWT#SetData
 225  
      */
 226  4
     SET_DATA,
 227  
 
 228  
     /**
 229  
      * @see SWT#MouseWheel
 230  
      */
 231  4
     MOUSE_WHEEL,
 232  
 
 233  
     /**
 234  
      * ウィンドウクローズ直前に呼び出されるイベントです。<br />
 235  
      * 
 236  
      * @see WindowCloseListener
 237  
      */
 238  4
     WINDOW_CLOSING(false);
 239  
 
 240  4
     private static Map<String, Integer> constantMap = new HashMap<String, Integer>();
 241  
 
 242  
     static {
 243  4
         EventListenerType[] values = EventListenerType.values();
 244  156
         for (int i = 0; i < values.length; i++) {
 245  152
             constantMap.put(values[i].toString(), SWTUtil
 246  
                     .getSWTConstant(values[i].getName()));
 247  
         }
 248  4
     }
 249  
 
 250  152
     private boolean isSwtEvent = true;
 251  
 
 252  148
     private EventListenerType() {
 253  148
     }
 254  
 
 255  4
     private EventListenerType(final boolean isSwtEvent) {
 256  4
         this.isSwtEvent = isSwtEvent;
 257  4
     }
 258  
 
 259  
     /**
 260  
      * 名称を取得します。<br />
 261  
      * 
 262  
      * @return 名称
 263  
      */
 264  
     public String getName() {
 265  300
         return SWTUtil.convertConstantName(toString());
 266  
     }
 267  
 
 268  
     /**
 269  
      * {@link SWT} クラスで定義されたイベント型を取得します。<br />
 270  
      * 
 271  
      * @return イベント型
 272  
      */
 273  
     public int getSWTEventType() {
 274  556
         return constantMap.get(toString());
 275  
     }
 276  
 
 277  
     /**
 278  
      * {@link SWT} クラスで定義されたイベントかどうかを返します。<br />
 279  
      * 
 280  
      * @return SWT クラスで定義されたイベントの場合は <code>true</code>、そうでない場合は
 281  
      *         <code>false</code>。
 282  
      */
 283  
     public boolean isSWTEvent() {
 284  152
         return this.isSwtEvent;
 285  
     }
 286  
 }