beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kyle Marvin" <>
Subject RE: Control container
Date Wed, 01 Sep 2004 14:11:26 GMT
Hi Mridul,

You are correct that the reason the field annotated by @Control is because there is no control
container or construction-time code for Test instances that is creating a new instance of
TestControl and initializing the field.   For the various control-aware component types that
are part of Beehive (pageflows, web services, and composite controls [control impls that nest
other controls], the component types will handle the required initialization transparently.

But we see being able to use the declarative syntax inside of a plain Java class as important
too... Ken Tam is working on a design that hopefully can be published to the Beehive Controls
Wiki soon that will code generate a simple initializer class for 'Test' (or any class that
contains an @Control declaration).  This initializer helper class will contain all the necessarily
logic to init @Control references as well as to register event listeners and route events
for @EventHandler annotation methods for these controls.   

Once this work is done, then the test class below might only need the following added constructor
to achieve the desired effect:

     private Test(){ TestInitializer.initialize(this); }

[the syntax may not look _exactly_ like this... Ken will propose the mechanism for invoking
initialization services of the generated init helper class]

With this minor change, you'd then have a fully initialized Test instance (including hookup
of all declarative semantics) by the time you'd reached the end of construction.

In the interim, programmatic (i.e. manual) initialization is the only supported option, except
in the component types listed above.

-- Kyle

> -----Original Message-----
> From: Mridul Muralidharan [mailto:Mridul.Muralidharan@Sun.COM]
> Sent: Sunday, August 29, 2004 1:24 AM
> To:
> Subject: Control container
> Hi,
>   While using declarative programming , I am facing following problem.
> Assume an example like this :
> public class Test{
>   @Control
>     TestControl test;
>     public getValue(){
>         return test.someMethod();
>     }
> }
> Here , the value of test is always null.
> While doing a programatic initialisation , everything workd fine.
> Assuming that this is 'cos there is no runtime control container.
> Am I correct on this ?
> If yes , where can I find an control container which I can 
> play around 
> with ? Is it part of beehive already ?
> Is there someway to convert all declarative initialisations to a 
> corresponding programatic initislisation during build time ?
> Thanks and Regards
> Mridul

View raw message