I tested with:

public class MyPanel extends Panel {

        public MyPanel(String id) {
                super(id);              
        }

        @Override
        protected void onBeforeRender() {
                super.onBeforeRender();
                
                add(new MyLabel("l1", "Label 1"));
                add(new MyLabel("l2", "Label 2"));
                add(new MyLabel("l3", "Label 3"));
         }

}

in MyPanel, where MyLabel extends Label with the constructor contains and
debug message:

public MyLabel(String id, String label) {
       super(id, label);
                
        System.out.println("MyLabel.MyLabel():" + id);
}

And yes, the MyLabel constructed is not called if MyPanel is not visible.

My impression was that in onBeforeRender I cannot change the hierarchy (add
children).

The 100 children was a random number that show you that my panel contains
many components :)

Thanks,
Decebal




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/a-little-question-about-add-new-XComponent-id-setVisible-false-tp4663041p4663045.html
Sent from the Users forum mailing list archive at Nabble.com.

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

Reply via email to