OSDN Git Service

initial commit
[xdf/git-repos.git] / xdf-swing / src / main / java / jp / ac / aiit / xdf / component / swing / event / FocusEventHandler.java
1 package jp.ac.aiit.xdf.component.swing.event;
2
3 import javax.swing.JComponent;
4
5 import jp.ac.aiit.xdf.core.action.Action;
6 import jp.ac.aiit.xdf.core.model.ObjectModel;
7
8 /**
9  * フォーカス関連アクションイベントハンドル
10  * Swing コンポーネントにFocusEvent、LostFocusEventにて、ユーザ定義アクションをバンディングする
11  * @author pin.Yuan
12  *
13  */
14
15 public class FocusEventHandler extends SwingEventHandler{
16         private SwingEventType eventtype;
17         
18         /**
19          * コンストラクター
20          * @param eventtype イベントタイプ:ユーザガイドのアクションの実装にイベント名を示しているもの
21          */
22         public FocusEventHandler(SwingEventType eventtype){
23                 this.eventtype = eventtype;
24         }
25         
26         @Override
27         public void setEvent(ObjectModel target, Object component, Action action) {
28                 UIEventListener listener = new UIEventListener(target, eventtype, action);
29                 // System.out.println(component.getClass().getName());
30                         ((JComponent)component).addFocusListener(listener);
31         }
32 }