Author: kentam
Date: Mon Apr 18 22:41:29 2005
New Revision: 161845
URL: http://svn.apache.org/viewcvs?view=rev&rev=161845
Log:
Optimize runtime control version checking code so it's only generated for
controls that require it.
Fixed some nasty bugs involving initialization of controls in the presence of
inheritance.
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/inherit/Intf1Impl.jcs
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/inherit/Intf2Impl.jcs
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java?view=diff&r1=161844&r2=161845
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java
(original)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java
Mon Apr 18 22:41:29 2005
@@ -149,7 +149,7 @@
return controls;
}
- protected boolean hasSuperClient()
+ public boolean hasSuperClient()
{
return ( getSuperClientName() != null );
}
@@ -158,13 +158,14 @@
* Returns the fully qualified classname of the closest control client in
the inheritance chain.
* @return class name of the closest control client
*/
- protected String getSuperClientName()
+ public String getSuperClientName()
{
ClassType superType = _clientDecl.getSuperclass();
- ClassDeclaration superDecl = superType.getDeclaration();
while ( superType != null )
{
+ ClassDeclaration superDecl = superType.getDeclaration();
+
Collection<FieldDeclaration> declaredFields =
superDecl.getFields();
for (FieldDeclaration fieldDecl : declaredFields)
{
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm?view=diff&r1=161844&r2=161845
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm
(original)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm
Mon Apr 18 22:41:29 2005
@@ -178,7 +178,7 @@
public static void initialize(ControlBeanContext cbc, $client.ClassName
client)
{
#if ($client.hasSuperClient())
- ${client.SuperClientName}.initialize( cbc, client );
+ ${client.superClientName}ClientInitializer.initialize( cbc, client );
#end
#if ($client.needsFieldInit())
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm?view=diff&r1=161844&r2=161845
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm
(original)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm
Mon Apr 18 22:41:29 2005
@@ -609,10 +609,12 @@
#end
+ #if ($intf.getVersionRequired())
static
{
#enforceVersionRequired()
}
+ #end
#declareConstructors()
Modified:
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/inherit/Intf1Impl.jcs
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/inherit/Intf1Impl.jcs?view=diff&r1=161844&r2=161845
==============================================================================
---
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/inherit/Intf1Impl.jcs
(original)
+++
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/inherit/Intf1Impl.jcs
Mon Apr 18 22:41:29 2005
@@ -1,6 +1,9 @@
package org.apache.beehive.controls.test.controls.inherit;
+import org.apache.beehive.controls.test.controls.basic.Hello;
+
import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.bean.Control;
import org.apache.beehive.controls.api.context.Context;
import org.apache.beehive.controls.api.context.ControlBeanContext;
import org.apache.beehive.controls.api.events.Client;
@@ -19,6 +22,8 @@
@Context ControlBeanContext context;
@Client Intf1Events intfEvents;
@Client Intf1NewEvents intfNewEvents;
+
+ @Control Hello _h1;
public int intf1Operation1()
{
Modified:
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/inherit/Intf2Impl.jcs
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/inherit/Intf2Impl.jcs?view=diff&r1=161844&r2=161845
==============================================================================
---
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/inherit/Intf2Impl.jcs
(original)
+++
incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/inherit/Intf2Impl.jcs
Mon Apr 18 22:41:29 2005
@@ -2,7 +2,10 @@
import java.lang.reflect.Method;
+import org.apache.beehive.controls.test.controls.basic.Hello;
+
import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.bean.Control;
import org.apache.beehive.controls.api.bean.Extensible;
import org.apache.beehive.controls.api.context.Context;
import org.apache.beehive.controls.api.context.ControlBeanContext;
@@ -21,6 +24,8 @@
@Context ControlBeanContext context;
@Client Intf2Events intfEvents;
@Client Intf2NewEvents intfNewEvents;
+
+ @Control Hello _h2;
public int intf2Operation1()
{