OSDN Git Service

srcディレクトリとdocディレクトリを作成
[xdf/git-repos.git] / xdf-swing / src / main / java / jp / ac / aiit / xdf / component / swing / event / SwingEventHandler.java
1 package jp.ac.aiit.xdf.component.swing.event;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 import jp.ac.aiit.xdf.core.action.Action;
7 import jp.ac.aiit.xdf.core.action.EventHandler;
8 import jp.ac.aiit.xdf.core.action.EventType;
9 import jp.ac.aiit.xdf.core.model.ObjectModel;
10
11 /**
12  * @author Pin Yuan
13  *
14  */
15 public class SwingEventHandler implements EventHandler{
16         public void setEvent(ObjectModel target, Object component, Action action) {     }
17
18         protected static boolean hasAction(Map<EventType, Action> actions, EventType ...events) {
19                 for(EventType event : events) {
20                         if( actions.containsKey(event) ) {
21                                 return true;
22                         }
23                 }
24                 return false;
25         }
26         
27         /**
28          * Swingの共通イベントバンディング方法を取得する
29          * @return 共通イベントバンディング方法 
30          */
31         public static Map<String, EventHandler> commonEvent(){
32                 Map<String, EventHandler> action = new HashMap<String, EventHandler>();
33                 action.put("focus", new FocusEventHandler(SwingEventType.FOCUS));
34                 action.put("focuslose", new FocusEventHandler(SwingEventType.FOCUSLOSE));
35                 return action;
36         }
37 }