> We need to wait until all components are added so that we can arrange
them into correct hireracy before rendering.

May I suggest that components are added with help of a builder object, for 

public MyPanel(String id) {
Builder b = new Builder(this); // the Builder gets reference to this MyPanel
b.add(new TextField("name")); // can be child of "form" which is added later
b.add(new SomeForm("form"));
b.build(); // after this line this MyPanel contains the components name and form

If MyPanel's super class needs to access the same builder, it can provide a 
constructor for it. In that case b.build() should be only invoked in MyPanel's 

If a developer uses more than one builder in a constructor, he can restrict 
moving of components in markup to some extent:

public MyPanel(String id) {
Builder b1 = new Builder(this);
b1.add(new TextField("name")); // in markup, "name" can't be put under "form" 
because it's in a different builder
Builder b2 = new Builder(this);
b2.add(new SomeForm("form");

Of course this doesn't solve the problem Igor mentioned. For that you'd need 
the "old-fashioned way":

public MyPanel(String id) {
SomeForm form = new SomeForm("form");
form.add(new TextField("name"); // in markup, "name" can't be moved out from 

Developers would need to mix different approaches for building hierarchies if 
security is an issue. On second thought, I should use a broader term than 
security because there is more than one reason to restrict those pesky 
designers ;)

To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to