Thanks for the answer, but that is not what I am looking for. I already know how to replace a component with another one.

My question is: I need to access a model's object to know which panel to add to a page (a persisted user preference). Since I shouldn't access a model's object in a component's constructor, when (onBeforeRender, onConfigure) should I do it to add the proper panel to the page?

Using addOrReplace could very well be part of the overall solution, but this does not answer my core question.

On 31/10/2011 9:54 AM, manuelbarzi wrote:
MarkupContainer addOrReplace :?
.



On Mon, Oct 31, 2011 at 2:49 PM, Bertrand Guay-Paquet<
ber...@step.polymtl.ca>  wrote:

Hi,

Was is the proper way to choose which panel to add to a page based on a
model's object value? Currently, I directly access the model and check the
value during construction of the page. However, this is wrong since a
model's object shouldn't be accessed until component rendering (see thread
"LDMs load too early - hold outdated application data").

One obvious approach is to add all possible panels to the page and
override their isVisible() method to inspect the model objects. This seems
like wasted processing and memory so I'd like to avoid it.

The page's onConfigure() and onBeforeRender() methods are the candidates I
can think of to inspect the model object's value and add the proper panel.
Is one better or is there another solution? Are there other issues with
this approach?

Regards,
Bertrand

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



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

Reply via email to