On Mon, Apr 28, 2008 at 5:57 AM, James Carman
<[EMAIL PROTECTED]> wrote:
> On Sat, Apr 26, 2008 at 4:55 PM, Maurice Marrink <[EMAIL PROTECTED]> wrote:
>  >  Such an initialize method can easily be done by users them self with a
>  >  simple factory pattern. So why bloat our api with it?
>
>  Could one come up with their own interface which means they want
>  delayed intialization and use an IComponentInstantiationListener to
>  invoke the method?
>
>  public interface Initializable
>  {
>   public void initialize();
>  }
>
>  public class InitializableInstantiationListener implements
>  IComponentInstantiationListener
>  {
>   public void onInstantiation(Component component)
>   {
>     if(component instanceof Initializable)
>     {
>       ( ( Initializable )component ).initialize();
>     }
>   }
>  }
>

Or, perhaps Wicket could add in some lifecycle method annotations?
One such annotation would mean that a method needs to be invoked
directly after the component is fully instantiated?

public class MyPanel extends Panel
{
  @Initializer
  public void init()
  {
    add(new Label("blah"));
    ...
  }
}

Then, one of the default component instantiation listeners merely
looks for methods annotated with this annotation and invokes it (and
optionally remembers what methods need to be invoked for what
component classes probably).

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to