I'm wondering if this is expected behaviour:

Create a <wicket:enclosure> element around to Labels, and let one of them be the child="" referenced in the enclosure tag. Let that Label return false on isVisible(). Even though the other Label isn't rendered, the getObject() method of it's model is still called. Do I need to override isVisible() on all components inside an enclosure to avoid this, or am I missing something?

Markup:

<wicket:enclosure child="label1">
        <span wicket:id="label1">Label 1</span>
        <span wicket:id="label2">Label 2</span>
</wicket:enclosure>


Java:

add(new Label("label1") {
        @Override
        public boolean isVisible() {
                return false;
        }
});
                
add(new Label("label2", new Model() {
        @Override
        public Object getObject() {
                System.out.println("Getting object of model 2");
                return "MODEL2 OBJECT";
        }
        
}));

Everytime the page is loaded, I get the output to stdout from the getObject() method of label2. If I add a isVisible() to label2 which returns false, everything is ofcourse dandy.

Sincerely,
Edvin Syse

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

Reply via email to