You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Roberto Ramírez Vique <ro...@gmail.com> on 2006/11/03 12:35:04 UTC

Re: How can I pass a component as a parameter to my custom component

Hello to everybody,

I have the problem again but a bit more complex. Probably some of you
already have had the same, but I don't know how exactly this problem should
be solved using the Tapestry way of work.

I'm using Tap 4.0.2, jdk 1.5 , and tomcat 5.5 .

My question is how can I pass as a parameter a listener method(if is
possible to be done). I need this because I have a component which prepare
all the form elements, like the text field, the checkboxes. This component
is repeated lot of times, then I want to call different methods depending on
the situation. Then I want to pass a listener to the parameter.

Thanks in advance, robert

On 10/24/06, Roberto Ramírez Vique <ro...@gmail.com> wrote:
>
> thanks you very much !!!!!
>
> I didn't know about this component ... Finally I realized that I can use
> the RenderBody component in an smarter way and solve my problem.
>
> r.
>
> On 10/24/06, Jiří Mareš <Ji...@svt.cz> wrote:
> >
> >
> > Hi,
> >
> > In component-specification:
> >
> > <component-specification>
> >   ...
> >   <parameter name="myParamComp"/>
> >   ...
> > </component-specification>
> >
> > Then in component template can be component referenced e.g.:
> >
> > <spand jwcid="@RenderBlock" block="ognl:myParamComp"/>
> >
> > And when you use the component and wants to pass the component as
> > parameter:
> >
> > <span jwcid="..." ... header="ognl:
> > components.nameOfComponentToPassAsParameter" ... />
> >
> > Jirka
> >
> > > I am working with tap 4.0, in tomcat 5.5.14 with jdk 1.5.
> > >
> > > I would like to create my own component. This component should receive
> > a
> > > parameter (not required) that specify another component (in this case
> > is a
> > > submit button component), I would like to use the container defined
> > > component in the custom component, but I don't know how to do this.
> > I'll
> > > try
> > > to explain this more carefully with an example:
> > >
> > > containerPage.page
> > > ...
> > > <component id="definedButon" type="Submit">
> > >    <binding name="action">listener:onSubmit</binding>
> > >    <binding name="selected" value="selectedEvent"/>
> > >    <binding name="tag" value="currentElement"/>
> > > </component>
> > >
> > >
> > > <component id="customComponentId" type="customComponnent">
> > >     <binding id="submitButtonParameter" value="definedButon"/>
> > > </component>
> > > ....
> > > componentPage.jwc (here is my biggest doubt!)
> > > ...
> > > <parameter name="submitButtonParameter" required="false"/>
> > >
> > > <component id="submitButton" type="Submit">
> > >    <!-- Here I should add something to copy the parameter in this
> > component
> > > -->
> > > </component>
> > > ...
> > >
> > > componentPage.html
> > > ...
> > > <input type="Submit" jwcid="submitButton"/>
> > > ...
> > >
> > > The componentPage.html should show the button passed as a parameter
> > from
> > > the
> > > containerPage.page ... this parameter will call the onSubmit of the
> > class
> > > containerPage.
> > >
> > > Any one has done this ??? There is an easy and clean way to do this ?
> > >
> > > Thanks in advance.
> > >
> >
> > --
> > Jiří Mareš (mailto:Jiri.Mares@svt.cz)
> > ČSAD SVT Praha, s.r.o. ( http://www.svt.cz)
> > Czech Republic
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Robert Ramírez Vique
> Computer Science Engineer
>



-- 
Robert Ramírez Vique
Computer Science Engineer

Re: Re: How can I pass a component as a parameter to my custom component

Posted by Roberto Ramírez Vique <ro...@gmail.com>.
Lot of thanks Sam & Karthik. I'll try it !

sincerely,
       robert

On 11/3/06, Karthik N <ka...@gmail.com> wrote:
>
> Sam is right.
>
> <binding name="yadda" value="listener:nameOfFunction">
>
> is correct
>
> We have used this before and it works well.
>
>
> On 11/3/06, Sam Gendler <sg...@ideasculptor.com> wrote:
> >
> > I've never actually done this, but I imagine that the following
> > statement in the your .page file would pass an IActionListener to your
> > components
> >
> > <binding name="yadda" value="listener:nameOfFunction">
> >
> > That might be "listeners:nameOfFunction" - I can't remember offhand.
> > Also, if you look in the javadocs at the IActionListener class and
> > related, you should see how you can use it.  Hopefully, that will get
> > you started.  Also, there is a description in the tap 4 user guide of
> > how to go about adding a listener parameter to your own components.
> > That might also be helpful to you.
> >
> > --sam
> >
> >
> > On 11/3/06, Roberto Ramírez Vique <ro...@gmail.com> wrote:
> > > Hello to everybody,
> > >
> > > I have the problem again but a bit more complex. Probably some of you
> > > already have had the same, but I don't know how exactly this problem
> > should
> > > be solved using the Tapestry way of work.
> > >
> > > I'm using Tap 4.0.2, jdk 1.5 , and tomcat 5.5 .
> > >
> > > My question is how can I pass as a parameter a listener method(if is
> > > possible to be done). I need this because I have a component which
> > prepare
> > > all the form elements, like the text field, the checkboxes. This
> > component
> > > is repeated lot of times, then I want to call different methods
> > depending on
> > > the situation. Then I want to pass a listener to the parameter.
> > >
> > > Thanks in advance, robert
> > >
> > > On 10/24/06, Roberto Ramírez Vique <ro...@gmail.com> wrote:
> > > >
> > > > thanks you very much !!!!!
> > > >
> > > > I didn't know about this component ... Finally I realized that I can
> > use
> > > > the RenderBody component in an smarter way and solve my problem.
> > > >
> > > > r.
> > > >
> > > > On 10/24/06, Jiří Mareš <Ji...@svt.cz> wrote:
> > > > >
> > > > >
> > > > > Hi,
> > > > >
> > > > > In component-specification:
> > > > >
> > > > > <component-specification>
> > > > >   ...
> > > > >   <parameter name="myParamComp"/>
> > > > >   ...
> > > > > </component-specification>
> > > > >
> > > > > Then in component template can be component referenced e.g.:
> > > > >
> > > > > <spand jwcid="@RenderBlock" block="ognl:myParamComp"/>
> > > > >
> > > > > And when you use the component and wants to pass the component as
> > > > > parameter:
> > > > >
> > > > > <span jwcid="..." ... header="ognl:
> > > > > components.nameOfComponentToPassAsParameter" ... />
> > > > >
> > > > > Jirka
> > > > >
> > > > > > I am working with tap 4.0, in tomcat 5.5.14 with jdk 1.5.
> > > > > >
> > > > > > I would like to create my own component. This component should
> > receive
> > > > > a
> > > > > > parameter (not required) that specify another component (in this
> > case
> > > > > is a
> > > > > > submit button component), I would like to use the container
> > defined
> > > > > > component in the custom component, but I don't know how to do
> > this.
> > > > > I'll
> > > > > > try
> > > > > > to explain this more carefully with an example:
> > > > > >
> > > > > > containerPage.page
> > > > > > ...
> > > > > > <component id="definedButon" type="Submit">
> > > > > >    <binding name="action">listener:onSubmit</binding>
> > > > > >    <binding name="selected" value="selectedEvent"/>
> > > > > >    <binding name="tag" value="currentElement"/>
> > > > > > </component>
> > > > > >
> > > > > >
> > > > > > <component id="customComponentId" type="customComponnent">
> > > > > >     <binding id="submitButtonParameter" value="definedButon"/>
> > > > > > </component>
> > > > > > ....
> > > > > > componentPage.jwc (here is my biggest doubt!)
> > > > > > ...
> > > > > > <parameter name="submitButtonParameter" required="false"/>
> > > > > >
> > > > > > <component id="submitButton" type="Submit">
> > > > > >    <!-- Here I should add something to copy the parameter in
> this
> > > > > component
> > > > > > -->
> > > > > > </component>
> > > > > > ...
> > > > > >
> > > > > > componentPage.html
> > > > > > ...
> > > > > > <input type="Submit" jwcid="submitButton"/>
> > > > > > ...
> > > > > >
> > > > > > The componentPage.html should show the button passed as a
> > parameter
> > > > > from
> > > > > > the
> > > > > > containerPage.page ... this parameter will call the onSubmit of
> > the
> > > > > class
> > > > > > containerPage.
> > > > > >
> > > > > > Any one has done this ??? There is an easy and clean way to do
> > this ?
> > > > > >
> > > > > > Thanks in advance.
> > > > > >
> > > > >
> > > > > --
> > > > > Jiří Mareš (mailto:Jiri.Mares@svt.cz)
> > > > > ČSAD SVT Praha, s.r.o. ( http://www.svt.cz)
> > > > > Czech Republic
> > > > >
> > > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Robert Ramírez Vique
> > > > Computer Science Engineer
> > > >
> > >
> > >
> > >
> > > --
> > > Robert Ramírez Vique
> > > Computer Science Engineer
> > >
> >
>
>
>
> --
> Thanks, Karthik
>



-- 
Robert Ramírez Vique
Computer Science Engineer

Re: Re: How can I pass a component as a parameter to my custom component

Posted by Karthik N <ka...@gmail.com>.
Sam is right.

<binding name="yadda" value="listener:nameOfFunction">

is correct

We have used this before and it works well.


On 11/3/06, Sam Gendler <sg...@ideasculptor.com> wrote:
>
> I've never actually done this, but I imagine that the following
> statement in the your .page file would pass an IActionListener to your
> components
>
> <binding name="yadda" value="listener:nameOfFunction">
>
> That might be "listeners:nameOfFunction" - I can't remember offhand.
> Also, if you look in the javadocs at the IActionListener class and
> related, you should see how you can use it.  Hopefully, that will get
> you started.  Also, there is a description in the tap 4 user guide of
> how to go about adding a listener parameter to your own components.
> That might also be helpful to you.
>
> --sam
>
>
> On 11/3/06, Roberto Ramírez Vique <ro...@gmail.com> wrote:
> > Hello to everybody,
> >
> > I have the problem again but a bit more complex. Probably some of you
> > already have had the same, but I don't know how exactly this problem
> should
> > be solved using the Tapestry way of work.
> >
> > I'm using Tap 4.0.2, jdk 1.5 , and tomcat 5.5 .
> >
> > My question is how can I pass as a parameter a listener method(if is
> > possible to be done). I need this because I have a component which
> prepare
> > all the form elements, like the text field, the checkboxes. This
> component
> > is repeated lot of times, then I want to call different methods
> depending on
> > the situation. Then I want to pass a listener to the parameter.
> >
> > Thanks in advance, robert
> >
> > On 10/24/06, Roberto Ramírez Vique <ro...@gmail.com> wrote:
> > >
> > > thanks you very much !!!!!
> > >
> > > I didn't know about this component ... Finally I realized that I can
> use
> > > the RenderBody component in an smarter way and solve my problem.
> > >
> > > r.
> > >
> > > On 10/24/06, Jiří Mareš <Ji...@svt.cz> wrote:
> > > >
> > > >
> > > > Hi,
> > > >
> > > > In component-specification:
> > > >
> > > > <component-specification>
> > > >   ...
> > > >   <parameter name="myParamComp"/>
> > > >   ...
> > > > </component-specification>
> > > >
> > > > Then in component template can be component referenced e.g.:
> > > >
> > > > <spand jwcid="@RenderBlock" block="ognl:myParamComp"/>
> > > >
> > > > And when you use the component and wants to pass the component as
> > > > parameter:
> > > >
> > > > <span jwcid="..." ... header="ognl:
> > > > components.nameOfComponentToPassAsParameter" ... />
> > > >
> > > > Jirka
> > > >
> > > > > I am working with tap 4.0, in tomcat 5.5.14 with jdk 1.5.
> > > > >
> > > > > I would like to create my own component. This component should
> receive
> > > > a
> > > > > parameter (not required) that specify another component (in this
> case
> > > > is a
> > > > > submit button component), I would like to use the container
> defined
> > > > > component in the custom component, but I don't know how to do
> this.
> > > > I'll
> > > > > try
> > > > > to explain this more carefully with an example:
> > > > >
> > > > > containerPage.page
> > > > > ...
> > > > > <component id="definedButon" type="Submit">
> > > > >    <binding name="action">listener:onSubmit</binding>
> > > > >    <binding name="selected" value="selectedEvent"/>
> > > > >    <binding name="tag" value="currentElement"/>
> > > > > </component>
> > > > >
> > > > >
> > > > > <component id="customComponentId" type="customComponnent">
> > > > >     <binding id="submitButtonParameter" value="definedButon"/>
> > > > > </component>
> > > > > ....
> > > > > componentPage.jwc (here is my biggest doubt!)
> > > > > ...
> > > > > <parameter name="submitButtonParameter" required="false"/>
> > > > >
> > > > > <component id="submitButton" type="Submit">
> > > > >    <!-- Here I should add something to copy the parameter in this
> > > > component
> > > > > -->
> > > > > </component>
> > > > > ...
> > > > >
> > > > > componentPage.html
> > > > > ...
> > > > > <input type="Submit" jwcid="submitButton"/>
> > > > > ...
> > > > >
> > > > > The componentPage.html should show the button passed as a
> parameter
> > > > from
> > > > > the
> > > > > containerPage.page ... this parameter will call the onSubmit of
> the
> > > > class
> > > > > containerPage.
> > > > >
> > > > > Any one has done this ??? There is an easy and clean way to do
> this ?
> > > > >
> > > > > Thanks in advance.
> > > > >
> > > >
> > > > --
> > > > Jiří Mareš (mailto:Jiri.Mares@svt.cz)
> > > > ČSAD SVT Praha, s.r.o. ( http://www.svt.cz)
> > > > Czech Republic
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Robert Ramírez Vique
> > > Computer Science Engineer
> > >
> >
> >
> >
> > --
> > Robert Ramírez Vique
> > Computer Science Engineer
> >
>



-- 
Thanks, Karthik

Re: Re: How can I pass a component as a parameter to my custom component

Posted by Sam Gendler <sg...@ideasculptor.com>.
I've never actually done this, but I imagine that the following
statement in the your .page file would pass an IActionListener to your
components

<binding name="yadda" value="listener:nameOfFunction">

That might be "listeners:nameOfFunction" - I can't remember offhand.
Also, if you look in the javadocs at the IActionListener class and
related, you should see how you can use it.  Hopefully, that will get
you started.  Also, there is a description in the tap 4 user guide of
how to go about adding a listener parameter to your own components.
That might also be helpful to you.

--sam


On 11/3/06, Roberto Ramírez Vique <ro...@gmail.com> wrote:
> Hello to everybody,
>
> I have the problem again but a bit more complex. Probably some of you
> already have had the same, but I don't know how exactly this problem should
> be solved using the Tapestry way of work.
>
> I'm using Tap 4.0.2, jdk 1.5 , and tomcat 5.5 .
>
> My question is how can I pass as a parameter a listener method(if is
> possible to be done). I need this because I have a component which prepare
> all the form elements, like the text field, the checkboxes. This component
> is repeated lot of times, then I want to call different methods depending on
> the situation. Then I want to pass a listener to the parameter.
>
> Thanks in advance, robert
>
> On 10/24/06, Roberto Ramírez Vique <ro...@gmail.com> wrote:
> >
> > thanks you very much !!!!!
> >
> > I didn't know about this component ... Finally I realized that I can use
> > the RenderBody component in an smarter way and solve my problem.
> >
> > r.
> >
> > On 10/24/06, Jiří Mareš <Ji...@svt.cz> wrote:
> > >
> > >
> > > Hi,
> > >
> > > In component-specification:
> > >
> > > <component-specification>
> > >   ...
> > >   <parameter name="myParamComp"/>
> > >   ...
> > > </component-specification>
> > >
> > > Then in component template can be component referenced e.g.:
> > >
> > > <spand jwcid="@RenderBlock" block="ognl:myParamComp"/>
> > >
> > > And when you use the component and wants to pass the component as
> > > parameter:
> > >
> > > <span jwcid="..." ... header="ognl:
> > > components.nameOfComponentToPassAsParameter" ... />
> > >
> > > Jirka
> > >
> > > > I am working with tap 4.0, in tomcat 5.5.14 with jdk 1.5.
> > > >
> > > > I would like to create my own component. This component should receive
> > > a
> > > > parameter (not required) that specify another component (in this case
> > > is a
> > > > submit button component), I would like to use the container defined
> > > > component in the custom component, but I don't know how to do this.
> > > I'll
> > > > try
> > > > to explain this more carefully with an example:
> > > >
> > > > containerPage.page
> > > > ...
> > > > <component id="definedButon" type="Submit">
> > > >    <binding name="action">listener:onSubmit</binding>
> > > >    <binding name="selected" value="selectedEvent"/>
> > > >    <binding name="tag" value="currentElement"/>
> > > > </component>
> > > >
> > > >
> > > > <component id="customComponentId" type="customComponnent">
> > > >     <binding id="submitButtonParameter" value="definedButon"/>
> > > > </component>
> > > > ....
> > > > componentPage.jwc (here is my biggest doubt!)
> > > > ...
> > > > <parameter name="submitButtonParameter" required="false"/>
> > > >
> > > > <component id="submitButton" type="Submit">
> > > >    <!-- Here I should add something to copy the parameter in this
> > > component
> > > > -->
> > > > </component>
> > > > ...
> > > >
> > > > componentPage.html
> > > > ...
> > > > <input type="Submit" jwcid="submitButton"/>
> > > > ...
> > > >
> > > > The componentPage.html should show the button passed as a parameter
> > > from
> > > > the
> > > > containerPage.page ... this parameter will call the onSubmit of the
> > > class
> > > > containerPage.
> > > >
> > > > Any one has done this ??? There is an easy and clean way to do this ?
> > > >
> > > > Thanks in advance.
> > > >
> > >
> > > --
> > > Jiří Mareš (mailto:Jiri.Mares@svt.cz)
> > > ČSAD SVT Praha, s.r.o. ( http://www.svt.cz)
> > > Czech Republic
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> > --
> > Robert Ramírez Vique
> > Computer Science Engineer
> >
>
>
>
> --
> Robert Ramírez Vique
> Computer Science Engineer
>