We have done exact that -- a lot. Driving isVisible() from the state
of the model is very clean, but the performance is potentially awful.
I have wondered whether this should be the default implementation for
Component.isVisible().
Is IVisitor.beforeRender() an appropriate place in the rendering cycle
to make the determination -- i.e.
public abstract class Visibility extends AbstractBehavior {
@Override
public void beforeRender(Component c) {
c.setVisible(isVisible());
}
public abstract boolean isVisible();
}
On Thu, Jan 15, 2009 at 2:45 AM, Martin Makundi
<[email protected]> 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?
>
>> -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?
>
> I consider overriding isVisible a more clean OO approach. Using
> setVisible results in messy non transparent chain of command.
>
> **
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]