beehive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ky...@apache.org
Subject svn commit: r124217 - /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java
Date Wed, 05 Jan 2005 15:03:56 GMT
Author: kylem
Date: Wed Jan  5 07:03:54 2005
New Revision: 124217

URL: http://svn.apache.org/viewcvs?view=rev&rev=124217
Log:
Modified the container dispatch path for externally initiated events, to allow the control
implementation associated with a bean to intercept and process the event, if it directly implements
the EventSet interface.  It can then conditionally decide to fire the event to external listeners
(using a @Client notifier), fire a different event, or ...

Modified:
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java?view=diff&rev=124217&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java&r1=124216&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java&r2=124217
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java
(original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java
Wed Jan  5 07:03:54 2005
@@ -579,6 +579,8 @@
                          throws IllegalAccessException,IllegalArgumentException,
                                 InvocationTargetException
     {
+        ensureControl();
+
         //
         // Translate the EventRef back to an actual event method on the ControlInterface
         //
@@ -586,17 +588,35 @@
         Method method = event.getEventMethod(controlInterface);
         
         //
-        // Find the event notifier instance for the EventSet interface associated with the
-        // method.
+        // Locate the target of the event
         //
-        Object eventNotifier = _notifiers.get(method.getDeclaringClass());
-        if (eventNotifier == null)
-            throw new IllegalArgumentException("No event notifier found for " + event);
+        Object eventTarget = null;
+        if (method.getDeclaringClass().isAssignableFrom(_control.getClass()))
+        {
+            //
+            // If the control implementation implements that EventSet interface, then 
+            // dispatch the event directly to it, and allow it do make the decision about

+            // how/when to dispatch to any external listeners (via a @Client notifier 
+            // instance)
+            //
+            eventTarget = _control; 
+        }
+        else
+        {
+            //
+            // The associated control implementation does not directly handle the event,
+            // so find the event notifier instance for the EventSet interface associated

+            // with the method.
+            //
+            eventTarget = _notifiers.get(method.getDeclaringClass());
+            if (eventTarget == null)
+                throw new IllegalArgumentException("No event notifier found for " + event);
+        }
 
         //
         // Dispatch the event
         //
-        return method.invoke(eventNotifier, args);
+        return method.invoke(eventTarget, args);
     }
 
     /**

Mime
View raw message