You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2006/03/03 04:36:28 UTC

svn commit: r382638 - in /beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator: AptEventSet.java ControlBean.vm

Author: ekoneil
Date: Thu Mar  2 19:36:27 2006
New Revision: 382638

URL: http://svn.apache.org/viewcvs?rev=382638&view=rev
Log:
Two core Control changes:

- back out the change to EventSet handling that added events from the parent event set to the list of event methods.  Ultimately, this ended up duplicating a bunch of code throughout the inheritance hierarchy.  There is still a problem here where methods declared in @EventSet(s) throughout the entire hierarchy need to be added to the ClientInitializer's event adaptor, but this needs to be fixed in another way.
- use a fully qualified class name to register an event callback in the generated control bean.  When a control declares an event set that is declared in the control's parent class and the two share a name, this reference is ambiguous.

BB: self
Test: Controls pass


Modified:
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventSet.java
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventSet.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventSet.java?rev=382638&r1=382637&r2=382638&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventSet.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventSet.java Thu Mar  2 19:36:27 2006
@@ -1,4 +1,3 @@
-package org.apache.beehive.controls.runtime.generator;
 /*
  * Copyright 2004 The Apache Software Foundation.
  *
@@ -16,6 +15,7 @@
  *
  * $Header:$
  */
+package org.apache.beehive.controls.runtime.generator;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -29,8 +29,7 @@
 
 import org.apache.beehive.controls.api.events.EventSet;
 import org.apache.beehive.controls.api.packaging.EventSetInfo;
-
-import org.apache.beehive.controls.runtime.generator.apt.*;
+import org.apache.beehive.controls.runtime.generator.apt.TwoPhaseAnnotationProcessor;
 
 /**
  * The AptEventSet class represents a control EventSet where the events
@@ -89,20 +88,20 @@
                 break;
             }
         }
-         
+
         _superEventSet = initSuperEventSet();
 
         _events = initEvents();
     }
 
     /**
-     * Checks to see if this EventSet extends on declared on a parent control interface.  If
+     * Checks to see if this EventSet extends an EventSet declared on a parent control interface.  If
      * found it will return the parent EventSet, or return null if not found. 
      */
     public AptEventSet initSuperEventSet()
     {
         // This will be common, so short circuit quickly
-        AptControlInterface superControl = _controlIntf.getSuperClass(); 
+        AptControlInterface superControl = _controlIntf.getSuperClass();
         if (superControl == null)
             return null;
 
@@ -160,15 +159,13 @@
             InterfaceDeclaration intfDecl = intfList.get(i);
 
             //
-            // Don't add events that are derived from a super event set.
+            // Don't add events that are derived from a super event set.  These are not added because
+            // this class picks a single super interface to extend from when building a hierarchy
+            // of callback notifiers (etc).  So, the super event set that was chosen first is left out
+            // of the list of event methods since they're captured in superclasses in the Control's implementation
             //
-            /* todo: why does this happen?  in this case, the events from super @EventSet interfaces
-                     won't be added to the event adapter which results in an incomplete
-                     implementation of the event set interface.
-            /*
             if (_superEventSet != null && _superEventSet.getClassName().equals(intfDecl.getQualifiedName()))
                 continue;
-            */
 
             // Add all declared methods, but ignore the mystery <clinit> methods
             for (MethodDeclaration methodDecl : intfDecl.getMethods())
@@ -206,8 +203,8 @@
     /**
      * Returns the number of Events for this EventSet and any super event set
      */
-    public int getEventCount() 
-    { 
+    public int getEventCount()
+    {
         int count = _events.size();
         if (_superEventSet != null)
             count += _superEventSet.getEventCount();
@@ -300,17 +297,17 @@
      */
     public String getInfoInitializer()
     {
-       return "init" + getShortName() + "Events"; 
+       return "init" + getShortName() + "Events";
     }
 
     /**
      * Returns any EventSetInfo associated with the event set (or null if none)
-     */ 
+     */
     public EventSetInfo getEventSetInfo()
     {
         if ( _eventSet == null )
             return null;
-        
+
         return _eventSet.getAnnotation(EventSetInfo.class);
     }
 

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm?rev=382638&r1=382637&r2=382638&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm Thu Mar  2 19:36:27 2006
@@ -65,7 +65,7 @@
             // Register event notifier instances for any EventSets
             //
             #end
-            setEventNotifier(${eventSet.shortName}.class, new ${eventSet.notifierClass}());
+            setEventNotifier(${eventSet.className}.class, new ${eventSet.notifierClass}());
         #end
     }