Actions
機能 #2014
closedComponentAction listener の追加
Status:
終了
Priority:
高め
Assignee:
-
Target version:
-
Start date:
01/27/2011
Due date:
% Done:
100%
Estimated time:
Description
- RTコンポーネントの各種アクション(ComponentAction)をフックするためのリスナクラス、ComponentAction listener を追加する。
- PreAction: 引数に ec_id を取るリスナ
- PostAction: 引数に ec_id と ReturnCode_t をとるリスナ
- RTObject にリスナホルダを持たせる
- RTObject のon_xxx() 関数内の onXxx() の前後にPreActionとPostActionを仕掛ける
- RTObject にリスナをセットする関数を追加する
Updated by Anonymous almost 14 years ago
- Status changed from 新規 to 担当
Updated by Anonymous over 13 years ago
Generics を使用して実装予定。
リスナの登録では、method名を文字列で指定する。
public <DataType> PreComponentActionListener addPreComponentActionListener(int listener_type, DataType obj, String memfunc) { class Noname extends PreComponentActionListener { public Noname(DataType obj, String memfunc) { m_obj = obj; try { Class clazz = m_obj.getClass(); m_method = clazz.getMethod(memfunc,int.class); } catch(java.lang.Exception e){ rtcout.println(Logbuf.WARN, "Exception caught."+e.toString()); } } public void operator(final int exec_handle) { try { m_method.invoke( m_obj, exec_handle); } catch(java.lang.Exception e){ rtcout.println(Logbuf.WARN, "Exception caught."+e.toString()); } } private DataType m_obj; private Method m_method; }; Noname listener = new Noname(obj, memfunc); addPreComponentActionListener(listener_type, listener, true); return listener; }
Updated by Anonymous over 13 years ago
コールバック
リスナーを準備する。
public class TestPreComponentActionListener { public void listener_ON_INITIALIZE(int ic){ System.out.println("------------------------------"); System.out.println("PreComponentActionListener PRE_ON_INITIALIZE"); System.out.println("------------------------------"); } }
リスナーを登録する。
TestPreComponentActionListener pcal = new TestPreComponentActionListener(); addPreComponentActionListener(0,pcal,"listener_ON_INITIALIZE");
Updated by Anonymous over 13 years ago
- Status changed from 担当 to 解決
- % Done changed from 30 to 100
Actions