On Nov 7, 2007 5:13 PM, John Krasnay <[EMAIL PROTECTED]> wrote: > You've just illustrated one of the major problems with the > panel-from-a-subclass approach: it's easy to get it wrong. In your > example, addAbstract1 and addAbstract2 will be called in a class whose > constructor has not yet been called. Consider: > > public DerivedPage extends BasePage { > > private String name; > > public DerivedPage(String name) { > super(); > this.name = name; > } > > public abstract addAbstract1(String abstractId1) { > add(new NamePanel(abstractId1, name)); > } > } > > This code is broken, since you're constructing NamePanel before name has > been initialized. Someone later in this thread shows a better way to do > this, by calling the overridable methods from onBeforeRender. But this > is also tricky; because onBeforeRender can be called multiple times you > must maintain a flag to ensure you only add your panels once. > > Given these subtle problems with this approach, I admit I'm warming to > the multiple extend/child idea.
I stand corrected! :) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]