If i understand correctly, it is possible to use @Environmental in render
phase, as the parent and nested components both go through that
phase but in action phase only the nested component events will be called.

Your second suggestion seems very interesting. It will be very helpful if
you can elaborate on that (especially with a small example).

regards
Taha

On Tue, Apr 12, 2011 at 4:02 PM, Kristian Marinkovic <
[email protected]> wrote:

> there are two phases in tapestry: the action phase and the render phase.
> for every phase you have to set your environmental services explicitly.
>
> i often have services that use the ApplicationStateManager service
> directly to access the persisted data, so my components are only aware of
> the service interface. this way i can reload the data whenever i need it
> lazily without coupling the components to my data objects. i hope this
> gives you some ideas.
>
> g,
> kris
>
>
>
> Von:    Taha Hafeez <[email protected]>
> An:     Tapestry users <[email protected]>
> Datum:  12.04.2011 12:24
> Betreff:        Re: Components communication with nested components
>
>
>
> I am also using @Environmental but it is not availiable at all times. e.g.
> when the nested component contains a form and that form is submitted... So
> in order to deal with it I use @Persist, first time around and on form
> submission I use the persisted value as the environment does not contain
> the
> context...
>
> What i was asking is, whether what I am doing is the way to go or there is
> any other alternative.
>
> regards
> Taha
>
>
> On Tue, Apr 12, 2011 at 3:47 PM, Kristian Marinkovic <
> [email protected]> wrote:
>
> > Declaring all possible values as parameters leads to high coupling. Just
> > imagine declaring the parameters in a hierarchy of 5 components just to
> > have it.
> >
> > I'd use Environmental services to pass data between different component
> > hierarchies. You can also apply the MVC pattern: create a service
> (thread
> > scoped service or SSO) that acts as the model that the components can
> use
> > to pull data from it. the service interface acts as the contract between
> > component and model
> >
> > g,
> > kris
> >
> >
> >
> > Von:    Taha Hafeez <[email protected]>
> > An:     Tapestry users <[email protected]>
> > Datum:  11.04.2011 18:00
> > Betreff:        Re: Components communication with nested components
> >
> >
> >
> > But my problem is parent does not have any knowledge of the child. Child
> > is
> > either contained in the body somewhere or in an override block
> >
> > e.g
> >
> > Parent
> >
> > <t:container>
> >   <t:body>
> > </t:container>
> >
> > Later in use
> >
> > <t:parent>
> >   <t:someChild/>
> > </t:parent>
> >
> > so, parameters is not an option
> >
> > regards
> > Taha
> >
> >
> > On Mon, Apr 11, 2011 at 9:04 PM, Christian Köberl <
> > [email protected]> wrote:
> >
> > > You could use parameters - Tapestry keeps them always in sync:
> > >
> > > public class Parent
> > > {
> > >  // here Parent's state is bound to Child's state
> > >  @Component(parameters = "state=state")
> > >  private Child child;
> > >
> > >  @Property
> > >  private String state;
> > > }
> > >
> > > public class Child
> > > {
> > >  @Parameter
> > >  private String state;
> > > }
> > >
> > > see also http://tapestry.apache.org/component-parameters.html
> > >
> > > --
> > > Chris
> > >
> > > --
> > > View this message in context:
> > >
> >
> >
>
> http://tapestry-users.832.n2.nabble.com/Components-communication-with-nested-components-tp6261431p6261909.html
>
> >
> > > Sent from the Tapestry Users mailing list archive at Nabble.com.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [email protected]
> > > For additional commands, e-mail: [email protected]
> > >
> > >
> >
> >
>
>

Reply via email to