You could create a factory where you ask your instances from instead of new...
On 5/12/08, Paolo Di Tommaso <[EMAIL PROTECTED]> wrote:
> Other than using AspectJ to intercept the @Begin annotated methods, I don't
> see an elegant/straightforward solution.
>
>
> An idea could be to subclass WebPage adding a visitor to look for all
> components implementing IFormSubmitListener interface (ILinkListener .. and
> so on).
>
> That components should be replaced dynamically with an interceptor proxy.
>
> Anyway it would be a partial solution because in Wicket action could be
> submitted with behaviour also.
>
> Core developers any ideas?
>
>
> // Paolo
>
>
>
> On Fri, May 9, 2008 at 6:27 PM, Pete Muir <[EMAIL PROTECTED]> wrote:
>
>> All,
>> Looking for some ideas/suggestions here (perhaps I am missing a trick
>> here?).
>>
>> Wicket binds html layout/styling to Java objects which define the
>> component
>> behaviour:
>>
>> public class Home extends WebPage {
>>
>> @In Foo foo;
>>
>> public Home(final PageParameters parameters) {
>> add(new LoginForm("login"));
>> }
>> }
>>
>> is doable, as we use a component instantiation callback (provided by
>> Wicket) to make foo a proxy which asks Seam for the component *every time*
>> the object is accessed. This is pretty ugly though, and I would prefer to
>> use injection/disinjection.
>>
>> However, if we want to do:
>>
>> public class LoginForm extends Form {
>> public LoginForm(String id) {
>> super(id);
>> add(new TextField("username", new PropertyModel(identity,
>> "username")));
>> add(new PasswordTextField("password", new PropertyModel(identity,
>> "password")));
>> }
>>
>> @Begin
>> protected void onSubmit() {
>> // Authenticate, and display feedback to user
>> }
>> }
>> }
>> }
>>
>> then no lifecycle callback will help.
>>
>> As you can see the new operator is used almost exclusively. This means we
>> can't use a proxy based interceptor system. So, AFAICS we have to use byte
>> code enhancement to apply an interceptor, I guess either at compile time
>> or
>> through a custom classloader.
>>
>> So,
>>
>> 1) is it worth it (this is starting to get very fiddly)?
>> 2) is there a better way?
>>
>> Thanks :)
>>
>> _______________________________________________
>> seam-dev mailing list
>> [EMAIL PROTECTED]
>> https://lists.jboss.org/mailman/listinfo/seam-dev
>>
>>
>