You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jorge Vásquez <jv...@3eyegroup.com> on 2006/10/01 01:06:38 UTC
Low level myFaces component maniulation...
Regards,
I have run into a very complex situation due to the fact that I use dynamic
includes in my application. I need to change the whole component tree of an
include and I have found that the bound components inside an include are
processed in the RenderResponse phase (In case it helps I use myfaces
combined with facelets). So I have tried all the alternatives that you can
imagine:
1. I created a listener that generated the components before the Render
Response but unfortunately the generated components weren´t bound to the
included page as the binding process in the included page took place during
the Render Response phase and not before.
2. I decided to intercept somehow the binding process by introducing a
binding component for each included page that would act as a trigger to the
generation of the other components that were binded, but during this process
I discovered that the getters for a binding are only called once in the
history of that component and not for each cycle, and I was using a binding
getter as trigger. I know this may sound quite confusing but my current
project´s nature is so complex to transmit these ideas just in one email.
I think that my new idea is to able to reset some elements of the component
tree related to the included pages to permit the trigger getter to be
invoked always and in this way be able to generate the tree composition for
the included page again.
Again, my main issue to simplify more my question is being able to clear
specific parts of a component tree (this demands for me to know where is
this tree kept in order to clear specific elements that I wish). Can
somebody give help me with a brief example of jsf component tree
manipulation or at least suggest me which are the classes involved in this
process?
Thanks a lot for your time,
Jorge Vásquez
Re: Low level myFaces component maniulation...
Posted by Jorge V?squez <jo...@gmail.com>.
Thanks so much Craig.
JV
Craig McClanahan-3 wrote:
>
> On 9/30/06, Jorge V?squez <jv...@3eyegroup.com> wrote:
>>
>> Thanks Craig,
>>
>> Another question: After finding a component how can I erase it from the
>> tree in order to force its "rebinding" during the RenderResponse phase.
>>
>
> Every component has a couple of very useful properties that tie the tree
> together:
>
> * parent (of type UIComponent) -- the component that is the parent of
> this
> component in the tree
>
> * children (of type java.uitl.List) -- the list of children components of
> this component in the tree.
>
> Whey you manipulate these values, you are explicitly modifying the
> structure
> of the tree. Thus, to delete a particular component from its parent:
>
> UIComponent component = ...; // The component to be deleted
> component.getParent().getChildren().remove(component); // Remove this
> component from its parent
>
> Craig
>
>
--
View this message in context: http://www.nabble.com/Low-level-myFaces-component-maniulation...-tf2363297.html#a6585201
Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: Low level myFaces component maniulation...
Posted by Craig McClanahan <cr...@apache.org>.
On 9/30/06, Jorge Vásquez <jv...@3eyegroup.com> wrote:
>
> Thanks Craig,
>
> Another question: After finding a component how can I erase it from the
> tree in order to force its "rebinding" during the RenderResponse phase.
>
Every component has a couple of very useful properties that tie the tree
together:
* parent (of type UIComponent) -- the component that is the parent of this
component in the tree
* children (of type java.uitl.List) -- the list of children components of
this component in the tree.
Whey you manipulate these values, you are explicitly modifying the structure
of the tree. Thus, to delete a particular component from its parent:
UIComponent component = ...; // The component to be deleted
component.getParent().getChildren().remove(component); // Remove this
component from its parent
Craig
RE: Low level myFaces component maniulation...
Posted by Jorge Vásquez <jv...@3eyegroup.com>.
Thanks Craig,
Another question: After finding a component how can I erase it from the
tree in order to force its rebinding during the RenderResponse phase.
Regards,
Jorge Vásquez
_____
De: craigmcc@gmail.com [mailto:craigmcc@gmail.com] En nombre de Craig
McClanahan
Enviado el: sábado, 30 de septiembre de 2006 18:12
Para: MyFaces Discussion
Asunto: Re: Low level myFaces component maniulation...
On 9/30/06, Jorge Vásquez <jv...@3eyegroup.com> wrote:
Regards,
I have run into a very complex situation due to the fact that I use dynamic
includes in my application. I need to change the whole component tree of an
include and I have found that the bound components inside an include are
processed in the RenderResponse phase (In case it helps I use myfaces
combined with facelets). So I have tried all the alternatives that you can
imagine:
1. I created a listener that generated the components before the Render
Response but unfortunately the generated components weren´t bound to the
included page as the binding process in the included page took place during
the Render Response phase and not before.
2. I decided to intercept somehow the binding process by introducing a
binding component for each included page that would act as a trigger to the
generation of the other components that were binded, but during this process
I discovered that the getters for a binding are only called once in the
history of that component and not for each cycle, and I was using a binding
getter as trigger. I know this may sound quite confusing but my current
project´s nature is so complex to transmit these ideas just in one email.
I think that my new idea is to able to reset some elements of the component
tree related to the included pages to permit the trigger getter to be
invoked always and in this way be able to generate the tree composition for
the included page again.
Again, my main issue to simplify more my question is being able to clear
specific parts of a component tree (this demands for me to know where is
this tree kept in order to clear specific elements that I wish). Can
somebody give help me with a brief example of jsf component tree
manipulation or at least suggest me which are the classes involved in this
process?
The root of the component tree can be retrieved like this:
UIViewRoot root = FacesContext.getCurrentInstance ().getViewRoot();
>From there, you can walk the entire tree to find what you need, or perhaps
use the findComponent() method to locate a component based on its
identifiers.
Craig
Thanks a lot for your time,
Jorge Vásquez
Re: Low level myFaces component maniulation...
Posted by Craig McClanahan <cr...@apache.org>.
On 9/30/06, Jorge Vásquez <jv...@3eyegroup.com> wrote:
>
> Regards,
>
> I have run into a very complex situation due to the fact that I use
> dynamic includes in my application. I need to change the whole component
> tree of an include and I have found that the bound components inside an
> include are processed in the RenderResponse phase (In case it helps I use
> myfaces combined with facelets). So I have tried all the alternatives that
> you can imagine:
>
> 1. I created a listener that generated the components before the Render
> Response but unfortunately the generated components weren´t bound to the
> included page as the binding process in the included page took place during
> the Render Response phase and not before.
>
> 2. I decided to intercept somehow the binding process by introducing a
> binding component for each included page that would act as a trigger to the
> generation of the other components that were binded, but during this process
> I discovered that the getters for a binding are only called once in the
> history of that component and not for each cycle, and I was using a binding
> getter as trigger. I know this may sound quite confusing but my current
> project´s nature is so complex to transmit these ideas just in one email.
>
> I think that my new idea is to able to reset some elements of the
> component tree related to the included pages to permit the trigger getter to
> be invoked always and in this way be able to generate the tree composition
> for the included page again.
>
> Again, my main issue to simplify more my question is being able to clear
> specific parts of a component tree (this demands for me to know where is
> this tree kept in order to clear specific elements that I wish). Can
> somebody give help me with a brief example of jsf component tree
> manipulation or at least suggest me which are the classes involved in this
> process?
>
The root of the component tree can be retrieved like this:
UIViewRoot root = FacesContext.getCurrentInstance().getViewRoot();
>From there, you can walk the entire tree to find what you need, or perhaps
use the findComponent() method to locate a component based on its
identifiers.
Craig
Thanks a lot for your time,
>
> Jorge Vásquez
>