Martin Makundi wrote:
-1- isVisible is called a lot. It is easily called ten times within 1
request
If you need to optimize, you can use lazy initialization of a boolean
variable here and reset it in onBeforeRender?
Yes, you could use lazy evaluation. (You should reset the boolean in an
overriden detach). However, this approach would not prevent problem 2
for all cases. As a simple change can let problem 2 occur, I rather have
one strategy that works always.
BTW onBeforeRender is called before the render phase (surprise),
isVisible is called /during/ the render phase, detach is called at end
of the render phase.
-2- isVisible can make your model be reloaded multiple times within 1
request
If you need to optimize, you can use lazy initialization of a boolean
variable here and reset it in onBeforeRender?
No, this won't work. The problem occurs because during detach of the
component hierarchy there are still calls to isVisible (instead of only
to detach). There are no more callbacks after detach (and that would not
make sense any way).
I consider overriding isVisible a more clean OO approach. Using
setVisible results in messy non transparent chain of command.
Yes, with that I agree.
Regards,
Erik.
--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]