jp.co.fujitsu.reffi.client.swing.controller
クラス EventBinder

java.lang.Object
  上位を拡張 jp.co.fujitsu.reffi.client.swing.controller.EventBinder

public class EventBinder
extends Object

[概 要]

イベント紐付け情報保持クラスです。

[詳 細]

AbstractController.bind(EventBinder)によるコンポーネント、イベントタイプ、アクションクラス の紐付け情報を、bindInfoフィールドMapに保持します。
bindInfoオブジェクトは以下のような構造を持ちます。
 [
 コンポーネント名1 = 
     イベントリスナクラス型 = 
         [イベントタイプ1(イベントハンドラメソッド名) = アクションクラス, 
          イベントタイプ2(イベントハンドラメソッド名) = アクションクラス],
 コンポーネント名2 =
     イベントリスナクラス型 =
         [イベントタイプ1(イベントハンドラメソッド名) = アクションクラス] 
 ]
 
                eventBinder.addEventBinding("chatFrame.jbEnterChannel", ActionListener.class, "actionPerformed", EnterChannelAction.class);
                eventBinder.addEventBinding("chatFrame.jbRemarkSend", ActionListener.class, "actionPerformed", RemarkSendAction.class);
                eventBinder.addEventBinding("chatFrame", WindowListener.class, "windowClosing", ChatFrameCloseAction.class);
 
上記の場合、以下のようになります。
 [
 "chatFrame.jbEnterChannel" = 
     ActionListener.class =
         ["actionPerformed" = EnterChannelAction.class]
 "chatFrame.jbRemarkSend" =
     ActionListener.class =
         ["actionPerformed" = RemarkSendAction.class] 
 ]
 
 

[備 考]

アプリケーション動作中に紐付け情報を追加する場合、以下のようにEventBinderオブジェクト を取得してaddEventBinding、又はaddEventBindingImmediatelyをコールします。
        getController().getEventBinder().addEventBinding("inputFormFrame.jtfUserId", FocusListener.class, "focusLost", UserIdFocusLostAction.class);
 

[環 境] JDK 6.0 Update 11

Copyright (c) 2008-2009 FUJITSU Japan All rights reserved.

作成者:
Project Reffi

コンストラクタの概要
EventBinder(AbstractController controller)
          [概 要] デフォルトコンストラクタです。
 
メソッドの概要
 void addEventBinding(String componentName, Class<? extends EventListener> listenerType, String eventType, Class<? extends AbstractAction> actionClass)
          [概 要] イベント紐付け情報追加メソッドです。
 void addEventBinding(String componentName, Class<? extends EventListener> listenerType, String eventType, String actionFqcn)
          [概 要] イベント紐付け情報追加メソッドです。
 void addEventBinding(String componentName, String listenerFqcn, String eventType, String actionFqcn)
          [概 要] イベント紐付け情報追加メソッドです。
 void addEventBindingImmediately(Component component, Class<? extends EventListener> listenerType, String eventType, Class<? extends AbstractAction> actionClass)
          [概 要] イベント紐付け情報追加メソッドです。
 void addEventBindingImmediately(String componentName, Class<? extends EventListener> listenerType, String eventType, Class<? extends AbstractAction> actionClass)
          [概 要] イベント紐付け情報追加メソッドです。
 Class<? extends AbstractAction> getActionClass(String componentName, Class<? extends EventListener> listenerType, String eventType)
          [概 要] 引数componentName、listenerType、eventTypeに紐付いているイベントタイプリストを返却します。
 Map<String,Map<Class<? extends EventListener>,Map<String,Class<? extends AbstractAction>>>> getBindInfo()
          [概 要] イベント紐付け情報保持オブジェクトを取得します。
 AbstractController getController()
          [概 要] コントローラオブジェクトを取得します。
 List<String> getEventTypes(String componentName, Class<? extends EventListener> listenerType)
          [概 要] 引数componentName、listenerTypeに紐付いているイベントタイプリストを返却します。
 Map<Class<? extends EventListener>,Map<String,Class<? extends AbstractAction>>> getListenerTypeMap(String componentName)
          [概 要] 引数componentNameに紐付いているイベントリスナタイプマップを返却します。
 List<Class<? extends EventListener>> getListenerTypes(String componentName)
          [概 要] 引数componentNameに紐付いているイベントリスナのリストを返却します。
 boolean isEventBinding(String componentName)
          [概 要] 引数componentNameに対してイベント紐付けが行われているかどうか調べます。
 void removeEventBinding(String componentName)
          [概 要] イベント紐付け情報削除メソッドです.
 void removeEventBinding(String componentName, Class<? extends EventListener> listenerType)
          [概 要] イベント紐付け情報削除メソッドです.
 void removeEventBinding(String componentName, Class<? extends EventListener> listenerType, String eventType)
          [概 要] イベント紐付け情報削除メソッドです.
 void removeEventBindingImmediately(Component component, Class listenerType, String eventType, EventListener listener)
          [概 要] イベント紐付け情報削除メソッドです。
 void setBindInfo(Map<String,Map<Class<? extends EventListener>,Map<String,Class<? extends AbstractAction>>>> bindInfo)
          [概 要] イベント紐付け情報保持オブジェクトを設定します。
 void setController(AbstractController controller)
          [概 要] コントローラオブジェクトを設定します。
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

EventBinder

public EventBinder(AbstractController controller)

[概 要]

デフォルトコンストラクタです。

[詳 細]

bindInfoフィールドインスタンスを生成します。

[備 考]

メソッドの詳細

getBindInfo

public Map<String,Map<Class<? extends EventListener>,Map<String,Class<? extends AbstractAction>>>> getBindInfo()

[概 要]

イベント紐付け情報保持オブジェクトを取得します。

[詳 細]

bindInfoフィールドを返却します。

[備 考]

戻り値:
イベント紐付け情報

setBindInfo

public void setBindInfo(Map<String,Map<Class<? extends EventListener>,Map<String,Class<? extends AbstractAction>>>> bindInfo)

[概 要]

イベント紐付け情報保持オブジェクトを設定します。

[詳 細]

bindInfoフィールドを、引数bindInfoで設定します。

[備 考]

パラメータ:
bindInfo - イベント紐付け情報

getController

public AbstractController getController()

[概 要]

コントローラオブジェクトを取得します。

[詳 細]

controllerフィールドを返却します。

[備 考]

戻り値:
コントローラオブジェクト

setController

public void setController(AbstractController controller)

[概 要]

コントローラオブジェクトを設定します。

[詳 細]

controllerフィールドを引数controllerで設定します。

[備 考]

パラメータ:
controller - コントローラオブジェクト

addEventBinding

public void addEventBinding(String componentName,
                            String listenerFqcn,
                            String eventType,
                            String actionFqcn)
                     throws Exception

[概 要]

イベント紐付け情報追加メソッドです。

[詳 細]

引数componentNameが既に登録されている場合、componentName用のMapを取り出し、 イベントタイプをキーにしてアクションを登録します。
componentNameが未登録の場合、componentName用のMapを新規に生成して、 イベントタイプをキーにしてアクションを登録します。
登録された情報はイベント紐付け情報保持オブジェクト(bindInfoフィールド)に保持され、 コントローラのコンポーネント挿抜ハンドラによって参照されます。

[備 考]

登録された紐付け情報が反映されるのは、componentNameをname属性値として持つ コンポーネントが画面追加されたタイミングです。

パラメータ:
componentName -
listenerFqcn -
eventType -
actionFqcn -
例外:
Exception

addEventBinding

public void addEventBinding(String componentName,
                            Class<? extends EventListener> listenerType,
                            String eventType,
                            String actionFqcn)
                     throws Exception

[概 要]

イベント紐付け情報追加メソッドです。

[詳 細]

引数componentNameが既に登録されている場合、componentName用のMapを取り出し、 イベントタイプをキーにしてアクションを登録します。
componentNameが未登録の場合、componentName用のMapを新規に生成して、 イベントタイプをキーにしてアクションを登録します。
登録された情報はイベント紐付け情報保持オブジェクト(bindInfoフィールド)に保持され、 コントローラのコンポーネント挿抜ハンドラによって参照されます。

[備 考]

登録された紐付け情報が反映されるのは、componentNameをname属性値として持つ コンポーネントが画面追加されたタイミングです。

パラメータ:
componentName -
listenerType -
eventType -
actionFqcn -
例外:
Exception

addEventBinding

public void addEventBinding(String componentName,
                            Class<? extends EventListener> listenerType,
                            String eventType,
                            Class<? extends AbstractAction> actionClass)

[概 要]

イベント紐付け情報追加メソッドです。

[詳 細]

引数componentNameが既に登録されている場合、componentName用のMapを取り出し、 イベントタイプをキーにしてアクションを登録します。
componentNameが未登録の場合、componentName用のMapを新規に生成して、 イベントタイプをキーにしてアクションを登録します。
登録された情報はイベント紐付け情報保持オブジェクト(bindInfoフィールド)に保持され、 コントローラのコンポーネント挿抜ハンドラによって参照されます。

[備 考]

登録された紐付け情報が反映されるのは、componentNameをname属性値として持つ コンポーネントが画面追加されたタイミングです。

パラメータ:
componentName -
listenerType -
eventType -
actionClass -

getListenerTypeMap

public Map<Class<? extends EventListener>,Map<String,Class<? extends AbstractAction>>> getListenerTypeMap(String componentName)

[概 要]

引数componentNameに紐付いているイベントリスナタイプマップを返却します。

[詳 細]

下記構造のMapを返却します。
 [
   イベントリスナ型 = [イベントハンドラメソッド名 = アクションクラス],
   イベントリスナ型 = [イベントハンドラメソッド名 = アクションクラス],
   イベントリスナ型 = [イベントハンドラメソッド名 = アクションクラス],
 ]
 

[備 考]

パラメータ:
componentName - イベントリスナタイプマップを取得するコンポーネント名
戻り値:
イベントリスナタイプマップ

getListenerTypes

public List<Class<? extends EventListener>> getListenerTypes(String componentName)

[概 要]

引数componentNameに紐付いているイベントリスナのリストを返却します。

[詳 細]

componentNameに対して以下のリスナタイプマップが紐付けられている場合、
 [
   イベントリスナ型1 = [イベントハンドラメソッド名 = アクションクラス],
   イベントリスナ型2 = [イベントハンドラメソッド名 = アクションクラス],
   イベントリスナ型3 = [イベントハンドラメソッド名 = アクションクラス],
 ]
 
以下のリストを返却します。
 [イベントリスナ型1、イベントリスナ型2、イベントリスナ型3]
 

[備 考]

パラメータ:
componentName - イベントリスナリストを取得するコンポーネント名
戻り値:
イベントリスナリスト

getEventTypes

public List<String> getEventTypes(String componentName,
                                  Class<? extends EventListener> listenerType)

[概 要]

引数componentName、listenerTypeに紐付いているイベントタイプリストを返却します。

[詳 細]

componentNameに対して以下のリスナタイプマップが紐付けられている場合、
 [
   イベントリスナ型1 = [イベントハンドラメソッド名1 = アクションクラス,
                       イベントハンドラメソッド名2 = アクションクラス],
   イベントリスナ型2 = [イベントハンドラメソッド名2 = アクションクラス],
   イベントリスナ型3 = [イベントハンドラメソッド名3 = アクションクラス],
 ]
 
イベントリスナ型1に対して以下のリストを返却します。
 [イベントハンドラメソッド名1、イベントハンドラメソッド名2]
 

[備 考]

パラメータ:
componentName - イベントタイプリストを取得するコンポーネント名
listenerType - イベントタイプリストを取得するイベントリスナタイプ
戻り値:
イベントタイプリスト

getActionClass

public Class<? extends AbstractAction> getActionClass(String componentName,
                                                      Class<? extends EventListener> listenerType,
                                                      String eventType)

[概 要]

引数componentName、listenerType、eventTypeに紐付いているイベントタイプリストを返却します。

[詳 細]

componentNameに対して以下のリスナタイプマップが紐付けられている場合、
 [
   イベントリスナ型1 = [イベントハンドラメソッド名1 = アクションクラス1,
                       イベントハンドラメソッド名2 = アクションクラス2],
   イベントリスナ型2 = [イベントハンドラメソッド名2 = アクションクラス3],
   イベントリスナ型3 = [イベントハンドラメソッド名3 = アクションクラス4],
 ]
 
イベントリスナ型1、イベントハンドラメソッド名1に対してアクションクラス1を返却します。

[備 考]

パラメータ:
componentName - アクションクラスを取得するコンポーネント名
listenerType - アクションクラスを取得するイベントリスナタイプ
eventType - アクションクラスを取得するイベントタイプ
戻り値:
アクションクラス

isEventBinding

public boolean isEventBinding(String componentName)

[概 要]

引数componentNameに対してイベント紐付けが行われているかどうか調べます。

[詳 細]

bindInfoフィールドにcomponentNameがキーとして含まれているかどうか調べます。

[備 考]

パラメータ:
componentName - イベント紐付けが行われているかどうか調べるコンポーネント名
戻り値:
true : 紐付け有り、false : 紐付け無し

addEventBindingImmediately

public void addEventBindingImmediately(String componentName,
                                       Class<? extends EventListener> listenerType,
                                       String eventType,
                                       Class<? extends AbstractAction> actionClass)

[概 要]

イベント紐付け情報追加メソッドです。

[詳 細]

addEventBindingImmediately(Component, Class, String, Class)メソッドに 処理委譲します。 引数componentNameを名前として持つコンポーネントがメモリ上に存在しない場合、 処理は行われません。

[備 考]

パラメータ:
componentName -
listenerType -
eventType -
actionClass -

addEventBindingImmediately

public void addEventBindingImmediately(Component component,
                                       Class<? extends EventListener> listenerType,
                                       String eventType,
                                       Class<? extends AbstractAction> actionClass)

[概 要]

イベント紐付け情報追加メソッドです。

[詳 細]

addEventBinding(String, Class, String, Class)オーバーロードメソッドを 呼び出して、イベント紐付け情報保持オブジェクト(bindInfo)に追加します。
追加後、ui Documentを取得して、追加された紐付け情報を即座に反映します。

[備 考]

addEventBinding(String, Class, String, Class)と違い、 登録された情報が画面コンポーネントにイベントリスナ追加されるのはメソッド呼び出し直後です。

パラメータ:
component -
listenerType -
eventType -
actionClass -

removeEventBinding

public void removeEventBinding(String componentName)

[概 要]

イベント紐付け情報削除メソッドです.

[詳 細]

保持されているコンポーネン紐付け情報から、引数componentName に紐付いている全リスナを削除します。

[備 考]

パラメータ:
componentName -

removeEventBinding

public void removeEventBinding(String componentName,
                               Class<? extends EventListener> listenerType)

[概 要]

イベント紐付け情報削除メソッドです.

[詳 細]

保持されているコンポーネン紐付け情報から、引数componentName に紐付いている引数listenerTypeを削除します。

[備 考]

パラメータ:
componentName -
listenerType -

removeEventBinding

public void removeEventBinding(String componentName,
                               Class<? extends EventListener> listenerType,
                               String eventType)

[概 要]

イベント紐付け情報削除メソッドです.

[詳 細]

保持されているコンポーネン紐付け情報から、引数componentNameの 引数listenerTypeに紐付いているeventTypeを削除します。

[備 考]

パラメータ:
componentName -
listenerType -
eventType -

removeEventBindingImmediately

public void removeEventBindingImmediately(Component component,
                                          Class listenerType,
                                          String eventType,
                                          EventListener listener)
                                   throws SecurityException,
                                          NoSuchFieldException,
                                          IllegalArgumentException,
                                          IllegalAccessException

[概 要]

イベント紐付け情報削除メソッドです。

[詳 細]

removeEventBinding(String, Class, String)メソッドを 呼び出して、イベント紐付け情報保持オブジェクト(bindInfo)から 引数情報を元に削除を行います。
削除後、引数componentから引数listenerを即座に削除反映します。

[備 考]

パラメータ:
component -
listenerType -
eventType -
listener -
例外:
SecurityException
NoSuchFieldException
IllegalArgumentException
IllegalAccessException


Copyright(C) Fujitsu All Rights Reserved.