Re: Feature idea: sealed flag on MarkupContainer

2008-11-20 Thread Peter Ertl
Wouldn't it be more powerful to override / hook into the process of adding a component of a container? Something like that ... new WebMarkupContainer(id) { @Override public void onComponentAdd(Component child) { // check the sealed flag, decorate the child, throw exception, or do

Re: Feature idea: sealed flag on MarkupContainer

2008-11-20 Thread John Krasnay
Yeah, I thought about that. The problem is add() is usually called from a component's constructor, so you would have a case of a constructor (indirectly) calling a non-final method, jk On Thu, Nov 20, 2008 at 11:27:39AM +0100, Peter Ertl wrote: Wouldn't it be more powerful to override / hook

Re: Feature idea: sealed flag on MarkupContainer

2008-11-20 Thread Peter Ertl
I was thinking about something like this: [warning, sketchy pseudo code will follow] method org.apache.wicket.MarkupContainer.add(Component... children) : - call empty overridable method onComponentAdd(Component child) for each component - add component protected void

Re: Feature idea: sealed flag on MarkupContainer

2008-11-20 Thread John Krasnay
Here's the problem (also with sketchy pseudo code :) public class BasePanel extends Panel { public BasePanel(String id) { super(id); add(new Label(foo, ...)); } } public class SubPanel extends BasePanel { @Override public void onComponentAdd(Component child) {

Re: Feature idea: sealed flag on MarkupContainer

2008-11-20 Thread Peter Ertl
for SubPanel the ctor is called that order - - Panel - BasePanel - SubPanel so the fields will be initialized, eh?! Am 20.11.2008 um 16:32 schrieb John Krasnay: Here's the problem (also with sketchy pseudo code :) public class BasePanel extends Panel { public BasePanel(String id) {

Re: Feature idea: sealed flag on MarkupContainer

2008-11-20 Thread John Krasnay
On Thu, Nov 20, 2008 at 07:18:11PM +0100, Peter Ertl wrote: for SubPanel the ctor is called that order - - Panel - BasePanel calls MarkupContainer.add() calls SubPanel.onComponentAdd() (before SubPanel ctor!) - SubPanel so the fields will be initialized, eh?! Am