This is an acceptable solution.  However, there is another way that I
generally prefer:

Say you have your content panel that you want displayed on some condition,
for instance, if the model object is not null.    Just do this:

public class ContentPanel extends WebPanel<Foo> {
    public ContentPanel(String id, IModel<Foo> model) {
        super(id, model);
    }

    @Override
    public boolean isVisible() {
       return getModelObject() != null;
       // or, you can do return someOtherCondition.
    }
}

This gives you the benefit of the panel automatically appearing if something
else on your page changes the state in a way that makes the condition now
true.

-- 
Jeremy Thomerson
http://www.wickettraining.com


On Thu, Jun 26, 2008 at 9:47 AM, Sergey Podatelev <
[EMAIL PROTECTED]> wrote:

> Hello,
>
> I'm sorry for this maybe stupid question, but is it okay to use an
> EmptyPanel with an empty template in case I want to do an "if" and display
> nothing in some cases and contains of a certain panel in all other cases?
> I know, this also could be handled by inheritance, but in certain cases an
> EmptyPanel looks like a much easier solution, but a bit strange.
> Maybe there're any other easier ways to do this?
>
> --
> sp
>

Reply via email to