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 [whatever]
  }
}




Am 20.11.2008 um 05:25 schrieb John Krasnay:

Hi folks,

In my current Wicket app I have a panel that contains a vertically
stacked list of sub-panels. Because the precise list of sub-panels is
not known until runtime, I've implemented this with a RepeatingView. My
parent panel has the following methods that I use to build the list of
sub-panels ("rv" is my RepeatingView instance):

 public void addSubPanel(Panel subPanel) { rv.add(subPanel); }
 public String newSubPanelId() { return rv.newChildId(); }

I use this same pattern in a number of other instances such as menus and
button bars.

The problem is that I often mistakenly call add instead of addSubPanel,
which of course fails at render time with an exception that I always
find hard to decipher.

It would be nice if there was a way to "seal" a MarkupContainer once I
had populated it such that any subsequent call to add, remove, or
replace would fail immediately with an exception. This would make it
much easier to find out where I had made the mistake.

Does anyone else think this would be a worthwhile feature?

jk

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


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

Reply via email to