hello mario,

there is also a second possible solution for this problem.

advantage: you don't have to walk through the component tree once more.
disadvantage: it's maybe a bit more work than the PhaseListener approach
mentioned by cagatay.

you can decorate all renderers and manually add (it is real adding - no
replacement) your ValueChangeListener

if you would like to choose this solution you are welcome to look at the
implementation of jtracc (http://jtracc.org or direclty at
http://code.google.com/p/jtracc/source) - there i implemented such a wrapper
(TranslationRendererWrapper).
it's an other domain so you can ignore what's going on in this wrapper in
detail.

in your case you have to add a ValueChangeListener manually by using code
like:
( (EditableValueHolder) component ).addValueChangeListener(...) -- before
you do that you have to check if the current component is a component which
implements the EditableValueHolder interface!
after adding the listener you can simply delegate to the decorated renderer.

regards,
gerhard



2007/11/12, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
> Hi Cheers, but if a componenet already has a ValueChangeListener setted
> by the programmer for other reasons? The new ValueChangeListener si
> added or replace existings?
>
> Thank, Mario
>
> -----Original Message-----
> From: Cagatay Civici [mailto:[EMAIL PROTECTED]
> Sent: 12 novembre 2007 14.50
> To: MyFaces Discussion
> Subject: Re: How know witch data in changed
>
> Hi,
>
> A phaselistener may work here, in after phase of restore view,
> traverse the component tree, if the component is an
> editablevalueholder,
> cast the component to editablevalueholder and add the
> valuechangelistener by addValueChangeListener or
> setValueChangeListener.
>
> A valuechangelistener implementation needs a processValueChange method
> or it can be a method binding, in your case the first option is a
> better alternative
>
> See editableValueHolder for more info.
>
> Cheers,
>
> Cagatay Civici
> [EMAIL PROTECTED]
> ps3 network id : facescontext
>
> On Nov 12, 2007 3:06 PM,  <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> > Is there a way to set the same ValueChangeListener to all component of
> all
> > view without specific code in the page? I don't want leave my
> programmers
> > manage the logic to know witch component is changed, because I need to
> > managed this kind of problem in the framework code.
> >
> >
> >
> > Any suggestions?
> >
> >
> >
> > Thanks, M.
> >
> >
> >
> >  ________________________________
> >
> >
> > From: Gerhard Petracek [mailto:[EMAIL PROTECTED]
> >  Sent: 12 novembre 2007 13.34
> >  To: MyFaces Discussion
> >  Subject: Re: How know witch data in changed
> >
> >
> >
> >
> > hello mario,
> >
> >  sounds like you are searching for the mechanism of
> ValueChangeListeners.
> >
> >  regards,
> >  gerhard
> >
> >
> >
> >
> >
> > 2007/11/12, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]>:
> >
> >
> >
> > Hello, I need to know witch data of a view is changed. Is there a way
> to do
> > that with no specific code? I'm going to do it in a PhaseListener that
> > compare data of each component before and after "apply Request" phase.
> >
> >
> >
> > What do you think?
> >
> >
> >
> > Any suggestion is Appreciated.
> >
> >
> >
> > Regards
> >
> > Mario
> >
> >
> >
> >  ________________________________
> >
> >
> > This message is for the designated recipient only and may contain
> > privileged, proprietary, or otherwise private information. If you have
> > received it in error, please notify the sender immediately and delete
> the
> > original. Any other use of the email by you is prohibited.
> >
> >
> >
> >
> >  --
> >
> >  http://www.irian.at
> >
> >  Your JSF powerhouse -
> >  JSF Consulting, Development and
> >  Courses in English and German
> >
> >  Professional Support for Apache MyFaces
> >
> >
> >
> >
> >
> > This message is for the designated recipient only and may contain
> > privileged, proprietary, or otherwise private information. If you have
> > received it in error, please notify the sender immediately and delete
> the
> > original. Any other use of the email by you is prohibited.
>
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information.  If you have
> received it in error, please notify the sender immediately and delete the
> original.  Any other use of the email by you is prohibited.
>



-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to