Why do you do it in onBeforeRender()? Can't you just initialize it
lazily, like LoadableDetachableModel does? I.e. on first getObject()
invocation.

-Matej

On 9/18/07, Alex Objelean <[EMAIL PROTECTED]> wrote:
>
> What is a common usecase for overriding onBeforeRender besides adding
> automatic validators to components? I'm a little bit confused, because I use
> it for updating (initializing) the model by calling service  methods and now
> I doubt that I do it right way.
>
> Thank you!
> Alex.
>
>
> Matej Knopp-2 wrote:
> >
> > This is not what the listener was intended to do. The main purpose was
> > to add automatic validators to components, e.g. based on model object
> > annotation. I don't know if what you are trying to accomplish is a
> > good idea or not, but it certainly doesn't seem to be a very common
> > usecase.
> >
> > -Matej
> >
> > On 9/17/07, Alex Objelean <[EMAIL PROTECTED]> wrote:
> >>
> >> Currently, I override the onBeforeRender() when I want to make some
> >> changes
> >> to the modelObject used by my custom component. For instance, if
> >> (condition)
> >> {//update model object from service}. This is what I mean by "own logic".
> >> I
> >> thought that it would be interesting idea to decouple this logic from
> >> each
> >> component and move it to IComponentOnBeforeRenderListener implementation
> >> (just thinking out loud :) ). But since the listeners are fired actually
> >> after onBefeforeRender, it is too late.
> >>
> >> PS: if you think that this is not a good idea, then never mind :)
> >>
> >> Alex.
> >>
> >>
> >> Matej Knopp-2 wrote:
> >> >
> >> > Could you please specify what it is that you can't do now? The thread
> >> > is rather long and I don't have time to go through it all. I don't
> >> > think we should reverse the other. What exactly do you mean by "own
> >> > logic" ?
> >> >
> >> > -Matej
> >> >
> >> > On 9/17/07, Alex Objelean <[EMAIL PROTECTED]> wrote:
> >> >>
> >> >> I've noticed that the execution order inside the
> >> Component#beforeRender()
> >> >> is
> >> >> the following:
> >> >>
> >> >> onBeforeRender();
> >> >> getApplication().notifyComponentOnBeforeRenderListeners(this);
> >> >>
> >> >> I wonder if it shouldn't be changed as follows:
> >> >>
> >> >> getApplication().notifyComponentOnBeforeRenderListeners(this);
> >> >> onBeforeRender();
> >> >>
> >> >>
> >> >> The reason is that the super.onbeforerender() call has to be done last
> >> >> when
> >> >> you want to add your own logic (See
> >> >>
> >> http://www.nabble.com/Why-the-AbstractRepeater-onBeforeRender-is-final-wicket-1.3.0-SNAPSHOT-%286-sept-2007%29--tf4391492.html#a12520558
> >> >> this  topic)
> >> >>
> >> >> Any thoughts?
> >> >>
> >> >> Alex.
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/Question-about-notifyComponentOnBeforeRenderListeners-tf4466023.html#a12733888
> >> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> 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]
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Question-about-notifyComponentOnBeforeRenderListeners-tf4466023.html#a12737607
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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]
> >
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/Question-about-notifyComponentOnBeforeRenderListeners-tf4466023.html#a12751791
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to