You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Taha Hafeez <ta...@gmail.com> on 2010/12/29 05:54:12 UTC

Tapestry5 Dynamics Parameter Binding

Hi

I have two components on a single page and I want a property of one
component to be bound to parameter of another component.
I can easy do that in a page but can I do that using
ComponentClassTransformWorker.

tml is like

<t:component1 t:parameterToBeBound='propertyFromComponent2'/>
<t:component2 />

Java Class is

public class Page {
   @Component
   private Component2 component2;

   public String getPropertyFromComponent2(){
      return component2.getPropertyFromComponent2();
   }
}

What I want is

<t:component1/>
<t:component2 t:attached='component1'/>

Everything else happens Auto-ComponentClassTransformWorker-matically



I think I should be able to but am sure how ?

regards
Taha

Re: Tapestry5 Dynamics Parameter Binding

Posted by Taha Hafeez <ta...@gmail.com>.
Thanks Josh

regards
Taha



On Wed, Dec 29, 2010 at 11:12 PM, Josh Canfield <jo...@gmail.com>wrote:

> Have you tried putting the @Property tag on your Component1?
>
> public class Page {
>  @Component
>  @Property
>  private Component1 component1;
> }
>
> <t:component1/>
> <t:component2 t:attached='component1'/>
>
> Assuming component2 takes a parameter named "attached" with default binding
> as property and an appropriate type to accept component1...
>
> I haven't run this code, but I believe it should work...
> Josh
>
> On Tue, Dec 28, 2010 at 8:54 PM, Taha Hafeez <tawus.tapestry@gmail.com
> >wrote:
>
> > Hi
> >
> > I have two components on a single page and I want a property of one
> > component to be bound to parameter of another component.
> > I can easy do that in a page but can I do that using
> > ComponentClassTransformWorker.
> >
> > tml is like
> >
> > <t:component1 t:parameterToBeBound='propertyFromComponent2'/>
> > <t:component2 />
> >
> > Java Class is
> >
> > public class Page {
> >   @Component
> >   private Component2 component2;
> >
> >   public String getPropertyFromComponent2(){
> >      return component2.getPropertyFromComponent2();
> >   }
> > }
> >
> > What I want is
> >
> > <t:component1/>
> > <t:component2 t:attached='component1'/>
> >
> > Everything else happens Auto-ComponentClassTransformWorker-matically
> >
> >
> >
> > I think I should be able to but am sure how ?
> >
> > regards
> > Taha
> >
>

Re: Tapestry5 Dynamics Parameter Binding

Posted by Josh Canfield <jo...@gmail.com>.
Have you tried putting the @Property tag on your Component1?

public class Page {
  @Component
  @Property
  private Component1 component1;
}

<t:component1/>
<t:component2 t:attached='component1'/>

Assuming component2 takes a parameter named "attached" with default binding
as property and an appropriate type to accept component1...

I haven't run this code, but I believe it should work...
Josh

On Tue, Dec 28, 2010 at 8:54 PM, Taha Hafeez <ta...@gmail.com>wrote:

> Hi
>
> I have two components on a single page and I want a property of one
> component to be bound to parameter of another component.
> I can easy do that in a page but can I do that using
> ComponentClassTransformWorker.
>
> tml is like
>
> <t:component1 t:parameterToBeBound='propertyFromComponent2'/>
> <t:component2 />
>
> Java Class is
>
> public class Page {
>   @Component
>   private Component2 component2;
>
>   public String getPropertyFromComponent2(){
>      return component2.getPropertyFromComponent2();
>   }
> }
>
> What I want is
>
> <t:component1/>
> <t:component2 t:attached='component1'/>
>
> Everything else happens Auto-ComponentClassTransformWorker-matically
>
>
>
> I think I should be able to but am sure how ?
>
> regards
> Taha
>