You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Koller <ch...@net-m.ch> on 2010/08/08 16:28:27 UTC

inject component from parent component

Hi 

With the annotation @Component I can inject components which are defined in the component's template, for example:
@Component(id="myComponent")
private ActionLink link;

Is there a way to inject a component from the parent component? Something like:
@Component(id="../myComponent")
private ActionLink mark;

Thank you
chris




Re: inject component from parent component

Posted by Josh Canfield <jo...@gmail.com>.
> The Zone is just a component:
>
> MyPage.java:
>
>  @InjectComponent @Property private Zone myZone;
>
> MyPage.tml:
>
>  <t:yourcomponent zoneid="myZone.clientId" .../>
>

myZone.clientId is null until Zone.beginRender is called. If
<t:yourcomponent> is rendered before the zone then zoneid will be
null.

Josh

On Tue, Aug 10, 2010 at 12:34 PM, Howard Lewis Ship <hl...@gmail.com> wrote:
> The Zone is just a component:
>
> MyPage.java:
>
>  @InjectComponent @Property private Zone myZone;
>
> MyPage.tml:
>
>  <t:yourcomponent zoneid="myZone.clientId" .../>
>
> This passes the client element id of the Zone to your component.
> Alternately, you could pass the Zone itself (so that an ActionLink
> inside YourComponent could return zone.getBody() to re-render the
> Zone).
>
> On Tue, Aug 10, 2010 at 9:26 AM, Christian Koller
> <ch...@net-m.ch> wrote:
>> Hi
>>
>> I'm not sure how I can pass an embedded zone in the template as a parameter. I tried for several hours but wasn't able to do that.
>> I can inject the zone to the page but then, how can I handle the zone down to the sub component as parameter?
>>
>> I know about the publish params and inherit params, but it does not work with a zone as parameter or maybe I do something wrong.
>>
>> I'm considering to put the zone to the session as a sso and then grab for it in the needed sub component. What do you think about this solution?
>>
>>
>> On 08.08.2010, at 18:33, Josh Canfield wrote:
>>
>>> It's generally not considered good design for a component to have knowledge of the design of it's container. This would be a universal design principle, not limited to tapestry.
>>>
>>> So if all you want to do is update a zone then couldn't you just pass the zone or zone id as a parameter to your component?
>>>
>>> -- Josh
>>>
>>> On Aug 8, 2010, at 7:49 AM, Christian Koller <ch...@net-m.ch> wrote:
>>>
>>>> In an inner component I handle an ajax request from an action link and want to update a zone in a outer component.
>>>>
>>>> As a work around I use the ComponentSource like:
>>>>
>>>> Object onActionFromMark(long wishedStartTime) {
>>>> this.wishedStartTime = wishedStartTime;
>>>> CalendarComponent cal = (CalendarComponent) componentSource.getComponent("AppointmentPage:calendarCollection.cal0");
>>>> return cal;
>>>>
>>>> Unfortunately I have to give the full id here with page name and so on.
>>>> Is there no way to get an outer component to update a zone there?
>>>>
>>>>
>>>> On 08.08.2010, at 16:37, Igor Drobiazko wrote:
>>>>
>>>>> Nope, this is not possible. What are you trying to do?
>>>>>
>>>>> On Sun, Aug 8, 2010 at 4:28 PM, Christian Koller
>>>>> <ch...@net-m.ch>wrote:
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> With the annotation @Component I can inject components which are defined in
>>>>>> the component's template, for example:
>>>>>> @Component(id="myComponent")
>>>>>> private ActionLink link;
>>>>>>
>>>>>> Is there a way to inject a component from the parent component? Something
>>>>>> like:
>>>>>> @Component(id="../myComponent")
>>>>>> private ActionLink mark;
>>>>>>
>>>>>> Thank you
>>>>>> chris
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best regards,
>>>>>
>>>>> Igor Drobiazko
>>>>> http://tapestry5.de
>>>>
>>>> Christian Koller
>>>> Sofwareentwickler
>>>>
>>>> net mobile Schweiz AG
>>>> Seestrasse 45
>>>> CH ñ 8702 Zollikon
>>>>
>>>> Tel:     + 41 (0) 44 918 99 99
>>>> Fax:     + 41 (0) 44 918 99 98
>>>> Direkt:  + 41 (0) 44 918 99 72
>>>>
>>>> Mail: christian.koller@net-m.ch
>>>> Web:  www.net-m.ch
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>> Christian Koller
>> Sofwareentwickler
>>
>> net mobile Schweiz AG
>> Seestrasse 45
>> CH ñ 8702 Zollikon
>>
>> Tel:     + 41 (0) 44 918 99 99
>> Fax:     + 41 (0) 44 918 99 98
>> Direkt:  + 41 (0) 44 918 99 72
>>
>> Mail: christian.koller@net-m.ch
>> Web:  www.net-m.ch
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> (971) 678-5210
> http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: inject component from parent component

Posted by Howard Lewis Ship <hl...@gmail.com>.
The Zone is just a component:

MyPage.java:

  @InjectComponent @Property private Zone myZone;

MyPage.tml:

  <t:yourcomponent zoneid="myZone.clientId" .../>

This passes the client element id of the Zone to your component.
Alternately, you could pass the Zone itself (so that an ActionLink
inside YourComponent could return zone.getBody() to re-render the
Zone).

On Tue, Aug 10, 2010 at 9:26 AM, Christian Koller
<ch...@net-m.ch> wrote:
> Hi
>
> I'm not sure how I can pass an embedded zone in the template as a parameter. I tried for several hours but wasn't able to do that.
> I can inject the zone to the page but then, how can I handle the zone down to the sub component as parameter?
>
> I know about the publish params and inherit params, but it does not work with a zone as parameter or maybe I do something wrong.
>
> I'm considering to put the zone to the session as a sso and then grab for it in the needed sub component. What do you think about this solution?
>
>
> On 08.08.2010, at 18:33, Josh Canfield wrote:
>
>> It's generally not considered good design for a component to have knowledge of the design of it's container. This would be a universal design principle, not limited to tapestry.
>>
>> So if all you want to do is update a zone then couldn't you just pass the zone or zone id as a parameter to your component?
>>
>> -- Josh
>>
>> On Aug 8, 2010, at 7:49 AM, Christian Koller <ch...@net-m.ch> wrote:
>>
>>> In an inner component I handle an ajax request from an action link and want to update a zone in a outer component.
>>>
>>> As a work around I use the ComponentSource like:
>>>
>>> Object onActionFromMark(long wishedStartTime) {
>>> this.wishedStartTime = wishedStartTime;
>>> CalendarComponent cal = (CalendarComponent) componentSource.getComponent("AppointmentPage:calendarCollection.cal0");
>>> return cal;
>>>
>>> Unfortunately I have to give the full id here with page name and so on.
>>> Is there no way to get an outer component to update a zone there?
>>>
>>>
>>> On 08.08.2010, at 16:37, Igor Drobiazko wrote:
>>>
>>>> Nope, this is not possible. What are you trying to do?
>>>>
>>>> On Sun, Aug 8, 2010 at 4:28 PM, Christian Koller
>>>> <ch...@net-m.ch>wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> With the annotation @Component I can inject components which are defined in
>>>>> the component's template, for example:
>>>>> @Component(id="myComponent")
>>>>> private ActionLink link;
>>>>>
>>>>> Is there a way to inject a component from the parent component? Something
>>>>> like:
>>>>> @Component(id="../myComponent")
>>>>> private ActionLink mark;
>>>>>
>>>>> Thank you
>>>>> chris
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Best regards,
>>>>
>>>> Igor Drobiazko
>>>> http://tapestry5.de
>>>
>>> Christian Koller
>>> Sofwareentwickler
>>>
>>> net mobile Schweiz AG
>>> Seestrasse 45
>>> CH ñ 8702 Zollikon
>>>
>>> Tel:     + 41 (0) 44 918 99 99
>>> Fax:     + 41 (0) 44 918 99 98
>>> Direkt:  + 41 (0) 44 918 99 72
>>>
>>> Mail: christian.koller@net-m.ch
>>> Web:  www.net-m.ch
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
> Christian Koller
> Sofwareentwickler
>
> net mobile Schweiz AG
> Seestrasse 45
> CH ñ 8702 Zollikon
>
> Tel:     + 41 (0) 44 918 99 99
> Fax:     + 41 (0) 44 918 99 98
> Direkt:  + 41 (0) 44 918 99 72
>
> Mail: christian.koller@net-m.ch
> Web:  www.net-m.ch
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: inject component from parent component

Posted by Igor Drobiazko <ig...@gmail.com>.
Hi,

On Tue, Aug 10, 2010 at 6:26 PM, Christian Koller <christian.koller@net-m.ch
> wrote:

> Hi
>
> I'm not sure how I can pass an embedded zone in the template as a
> parameter. I tried for several hours but wasn't able to do that.
> I can inject the zone to the page but then, how can I handle the zone down
> to the sub component as parameter?
>

You should reconsider your design. Why don't you handle the ajax request in
the same component where the zone is defined?

>
> I know about the publish params and inherit params, but it does not work
> with a zone as parameter or maybe I do something wrong.
>
> I'm considering to put the zone to the session as a sso and then grab for
> it in the needed sub component. What do you think about this solution?
>

This is definitely a bad solution. You should not do it.

>
>
> On 08.08.2010, at 18:33, Josh Canfield wrote:
>
> > It's generally not considered good design for a component to have
> knowledge of the design of it's container. This would be a universal design
> principle, not limited to tapestry.
> >
> > So if all you want to do is update a zone then couldn't you just pass the
> zone or zone id as a parameter to your component?
> >
> > -- Josh
> >
> > On Aug 8, 2010, at 7:49 AM, Christian Koller <ch...@net-m.ch>
> wrote:
> >
> >> In an inner component I handle an ajax request from an action link and
> want to update a zone in a outer component.
> >>
> >> As a work around I use the ComponentSource like:
> >>
> >> Object onActionFromMark(long wishedStartTime) {
> >> this.wishedStartTime = wishedStartTime;
> >> CalendarComponent cal = (CalendarComponent)
> componentSource.getComponent("AppointmentPage:calendarCollection.cal0");
> >> return cal;
> >>
> >> Unfortunately I have to give the full id here with page name and so on.
> >> Is there no way to get an outer component to update a zone there?
> >>
> >>
> >> On 08.08.2010, at 16:37, Igor Drobiazko wrote:
> >>
> >>> Nope, this is not possible. What are you trying to do?
> >>>
> >>> On Sun, Aug 8, 2010 at 4:28 PM, Christian Koller
> >>> <ch...@net-m.ch>wrote:
> >>>
> >>>> Hi
> >>>>
> >>>> With the annotation @Component I can inject components which are
> defined in
> >>>> the component's template, for example:
> >>>> @Component(id="myComponent")
> >>>> private ActionLink link;
> >>>>
> >>>> Is there a way to inject a component from the parent component?
> Something
> >>>> like:
> >>>> @Component(id="../myComponent")
> >>>> private ActionLink mark;
> >>>>
> >>>> Thank you
> >>>> chris
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>> --
> >>> Best regards,
> >>>
> >>> Igor Drobiazko
> >>> http://tapestry5.de
> >>
> >> Christian Koller
> >> Sofwareentwickler
> >>
> >> net mobile Schweiz AG
> >> Seestrasse 45
> >> CH ñ 8702 Zollikon
> >>
> >> Tel:     + 41 (0) 44 918 99 99
> >> Fax:     + 41 (0) 44 918 99 98
> >> Direkt:  + 41 (0) 44 918 99 72
> >>
> >> Mail: christian.koller@net-m.ch
> >> Web:  www.net-m.ch
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
>
> Christian Koller
> Sofwareentwickler
>
> net mobile Schweiz AG
> Seestrasse 45
> CH ñ 8702 Zollikon
>
> Tel:     + 41 (0) 44 918 99 99
> Fax:     + 41 (0) 44 918 99 98
> Direkt:  + 41 (0) 44 918 99 72
>
> Mail: christian.koller@net-m.ch
> Web:  www.net-m.ch
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Best regards,

Igor Drobiazko
http://tapestry5.de

Re: inject component from parent component

Posted by Josh Canfield <jo...@gmail.com>.
> I'm not sure how I can pass an embedded zone in the template as a parameter.

It sounds like what you are trying to do is have your inner component
render a block into a zone in the parent. What I would do is have the
page tell your inner component which block to render, and what zone to
update. If you want to change a value in the block then you are also
going to have to pass that value into your inner component.

Here is a really simple example:

/**
 * Simple page class, contains a value that is rendered in a zone so
it can be updated
 */
public class AjaxPickedPage {

    @Property
    private String _value;

    @Property
    @Component
    private Zone _pickedZone;
}

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">

<body>
<t:ajaxpicker t:id="picker" zoneId="pickedZone"
renderBlock="pickedZone.body" t:value="value"/>

<t:zone t:id="pickedZone" id="pickedZone"> <!-- use both t:id and id
to make sure the zone id is fixed so you can safely pass it around -->
    <t:ajaxpicked t:id="picked" t:value="value"/>
</t:zone>

</body>
</html>

/**
 * component class which takes handles a "pick" event to update the
"value" parameter. The event returns the block Parameter, which does
something with the "value". The passed "zoneId" is used to tie the
template generated EventLink components to a zone in the page.
 */
public class AjaxPicker {

    @Parameter
    private String _value;

    @Parameter
    @Property
    private Block _renderBlock;

    @Parameter(defaultPrefix = "literal")
    @Property
    private String _zoneId;

    @Inject
    private ComponentResources _resources;

    public Block onPick(String value) {
        _value = value;
        return _renderBlock;
    }

}

<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">

    <t:loop source="1..5" t:value="var:value">
        <t:eventLink event="pick" context="var:value"
zone="prop:zoneId">${var:value}</t:eventLink>
        <br/>
    </t:loop>

</t:container>

/**
 * Renders a "value" parameter passed in by the container.
 */
public class AjaxPicked {

    @Parameter
    @Property
    private String _value;

}

<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">

    This is the value! ${value}

</t:container>


Josh


On Tue, Aug 10, 2010 at 9:26 AM, Christian Koller
<ch...@net-m.ch> wrote:
> Hi
>
> I'm not sure how I can pass an embedded zone in the template as a parameter. I tried for several hours but wasn't able to do that.
> I can inject the zone to the page but then, how can I handle the zone down to the sub component as parameter?
>
> I know about the publish params and inherit params, but it does not work with a zone as parameter or maybe I do something wrong.
>
> I'm considering to put the zone to the session as a sso and then grab for it in the needed sub component. What do you think about this solution?
>
>
> On 08.08.2010, at 18:33, Josh Canfield wrote:
>
>> It's generally not considered good design for a component to have knowledge of the design of it's container. This would be a universal design principle, not limited to tapestry.
>>
>> So if all you want to do is update a zone then couldn't you just pass the zone or zone id as a parameter to your component?
>>
>> -- Josh
>>
>> On Aug 8, 2010, at 7:49 AM, Christian Koller <ch...@net-m.ch> wrote:
>>
>>> In an inner component I handle an ajax request from an action link and want to update a zone in a outer component.
>>>
>>> As a work around I use the ComponentSource like:
>>>
>>> Object onActionFromMark(long wishedStartTime) {
>>> this.wishedStartTime = wishedStartTime;
>>> CalendarComponent cal = (CalendarComponent) componentSource.getComponent("AppointmentPage:calendarCollection.cal0");
>>> return cal;
>>>
>>> Unfortunately I have to give the full id here with page name and so on.
>>> Is there no way to get an outer component to update a zone there?
>>>
>>>
>>> On 08.08.2010, at 16:37, Igor Drobiazko wrote:
>>>
>>>> Nope, this is not possible. What are you trying to do?
>>>>
>>>> On Sun, Aug 8, 2010 at 4:28 PM, Christian Koller
>>>> <ch...@net-m.ch>wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> With the annotation @Component I can inject components which are defined in
>>>>> the component's template, for example:
>>>>> @Component(id="myComponent")
>>>>> private ActionLink link;
>>>>>
>>>>> Is there a way to inject a component from the parent component? Something
>>>>> like:
>>>>> @Component(id="../myComponent")
>>>>> private ActionLink mark;
>>>>>
>>>>> Thank you
>>>>> chris
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Best regards,
>>>>
>>>> Igor Drobiazko
>>>> http://tapestry5.de
>>>
>>> Christian Koller
>>> Sofwareentwickler
>>>
>>> net mobile Schweiz AG
>>> Seestrasse 45
>>> CH ñ 8702 Zollikon
>>>
>>> Tel:     + 41 (0) 44 918 99 99
>>> Fax:     + 41 (0) 44 918 99 98
>>> Direkt:  + 41 (0) 44 918 99 72
>>>
>>> Mail: christian.koller@net-m.ch
>>> Web:  www.net-m.ch
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
> Christian Koller
> Sofwareentwickler
>
> net mobile Schweiz AG
> Seestrasse 45
> CH ñ 8702 Zollikon
>
> Tel:     + 41 (0) 44 918 99 99
> Fax:     + 41 (0) 44 918 99 98
> Direkt:  + 41 (0) 44 918 99 72
>
> Mail: christian.koller@net-m.ch
> Web:  www.net-m.ch
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: inject component from parent component

Posted by Geoff Callender <ge...@gmail.com>.
The link http://jumpstart.doublenegative.com.au/jumpstart/examples/ajaxcomponentscrud
has been replaced by:

	http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/componentscrud/persons


On 11/08/2010, at 11:32 AM, Geoff Callender wrote:

> It's best that the component knows nothing of what's around it. Instead, have it trigger an event to bubble up to its container and let the container decide what to do with it. Perhaps this example will help?
> 
> 	http://jumpstart.doublenegative.com.au/jumpstart/examples/ajaxcomponentscrud 
> 
> Geoff
> 
> On 11/08/2010, at 2:26 AM, Christian Koller wrote:
> 
>> Hi
>> 
>> I'm not sure how I can pass an embedded zone in the template as a parameter. I tried for several hours but wasn't able to do that.
>> I can inject the zone to the page but then, how can I handle the zone down to the sub component as parameter?
>> 
>> I know about the publish params and inherit params, but it does not work with a zone as parameter or maybe I do something wrong.
>> 
>> I'm considering to put the zone to the session as a sso and then grab for it in the needed sub component. What do you think about this solution?
>> 
>> 
>> On 08.08.2010, at 18:33, Josh Canfield wrote:
>> 
>>> It's generally not considered good design for a component to have knowledge of the design of it's container. This would be a universal design principle, not limited to tapestry.
>>> 
>>> So if all you want to do is update a zone then couldn't you just pass the zone or zone id as a parameter to your component? 
>>> 
>>> -- Josh
>>> 
>>> On Aug 8, 2010, at 7:49 AM, Christian Koller <ch...@net-m.ch> wrote:
>>> 
>>>> In an inner component I handle an ajax request from an action link and want to update a zone in a outer component.
>>>> 
>>>> As a work around I use the ComponentSource like:
>>>> 
>>>> Object onActionFromMark(long wishedStartTime) {
>>>> this.wishedStartTime = wishedStartTime;
>>>> CalendarComponent cal = (CalendarComponent) componentSource.getComponent("AppointmentPage:calendarCollection.cal0"); 
>>>> return cal;
>>>> 
>>>> Unfortunately I have to give the full id here with page name and so on.
>>>> Is there no way to get an outer component to update a zone there?
>>>> 
>>>> 
>>>> On 08.08.2010, at 16:37, Igor Drobiazko wrote:
>>>> 
>>>>> Nope, this is not possible. What are you trying to do?
>>>>> 
>>>>> On Sun, Aug 8, 2010 at 4:28 PM, Christian Koller
>>>>> <ch...@net-m.ch>wrote:
>>>>> 
>>>>>> Hi
>>>>>> 
>>>>>> With the annotation @Component I can inject components which are defined in
>>>>>> the component's template, for example:
>>>>>> @Component(id="myComponent")
>>>>>> private ActionLink link;
>>>>>> 
>>>>>> Is there a way to inject a component from the parent component? Something
>>>>>> like:
>>>>>> @Component(id="../myComponent")
>>>>>> private ActionLink mark;
>>>>>> 
>>>>>> Thank you
>>>>>> chris
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> -- 
>>>>> Best regards,
>>>>> 
>>>>> Igor Drobiazko
>>>>> http://tapestry5.de
>>>> 
>>>> Christian Koller
>>>> Sofwareentwickler
>>>> 
>>>> net mobile Schweiz AG
>>>> Seestrasse 45
>>>> CH ñ 8702 Zollikon
>>>> 
>>>> Tel:     + 41 (0) 44 918 99 99
>>>> Fax:     + 41 (0) 44 918 99 98
>>>> Direkt:  + 41 (0) 44 918 99 72
>>>> 
>>>> Mail: christian.koller@net-m.ch
>>>> Web:  www.net-m.ch
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>> 
>> 
>> Christian Koller
>> Sofwareentwickler
>> 
>> net mobile Schweiz AG
>> Seestrasse 45
>> CH ñ 8702 Zollikon
>> 
>> Tel:     + 41 (0) 44 918 99 99
>> Fax:     + 41 (0) 44 918 99 98
>> Direkt:  + 41 (0) 44 918 99 72
>> 
>> Mail: christian.koller@net-m.ch
>> Web:  www.net-m.ch
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: inject component from parent component

Posted by Muhammad Mohsen <m....@gmail.com>.
This is an old thread but REALLY thank you all for the concepts you
demonstrated and specially *Josh* for the code to clear everything out :)

On Wed, Aug 11, 2010 at 3:32 AM, Geoff Callender <
geoff.callender.jumpstart@gmail.com> wrote:

> It's best that the component knows nothing of what's around it. Instead,
> have it trigger an event to bubble up to its container and let the container
> decide what to do with it. Perhaps this example will help?
>
>
> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajaxcomponentscrud
>
> Geoff
>
> On 11/08/2010, at 2:26 AM, Christian Koller wrote:
>
> > Hi
> >
> > I'm not sure how I can pass an embedded zone in the template as a
> parameter. I tried for several hours but wasn't able to do that.
> > I can inject the zone to the page but then, how can I handle the zone
> down to the sub component as parameter?
> >
> > I know about the publish params and inherit params, but it does not work
> with a zone as parameter or maybe I do something wrong.
> >
> > I'm considering to put the zone to the session as a sso and then grab for
> it in the needed sub component. What do you think about this solution?
> >
> >
> > On 08.08.2010, at 18:33, Josh Canfield wrote:
> >
> >> It's generally not considered good design for a component to have
> knowledge of the design of it's container. This would be a universal design
> principle, not limited to tapestry.
> >>
> >> So if all you want to do is update a zone then couldn't you just pass
> the zone or zone id as a parameter to your component?
> >>
> >> -- Josh
> >>
> >> On Aug 8, 2010, at 7:49 AM, Christian Koller <ch...@net-m.ch>
> wrote:
> >>
> >>> In an inner component I handle an ajax request from an action link and
> want to update a zone in a outer component.
> >>>
> >>> As a work around I use the ComponentSource like:
> >>>
> >>> Object onActionFromMark(long wishedStartTime) {
> >>> this.wishedStartTime = wishedStartTime;
> >>> CalendarComponent cal = (CalendarComponent)
> componentSource.getComponent("AppointmentPage:calendarCollection.cal0");
> >>> return cal;
> >>>
> >>> Unfortunately I have to give the full id here with page name and so on.
> >>> Is there no way to get an outer component to update a zone there?
> >>>
> >>>
> >>> On 08.08.2010, at 16:37, Igor Drobiazko wrote:
> >>>
> >>>> Nope, this is not possible. What are you trying to do?
> >>>>
> >>>> On Sun, Aug 8, 2010 at 4:28 PM, Christian Koller
> >>>> <ch...@net-m.ch>wrote:
> >>>>
> >>>>> Hi
> >>>>>
> >>>>> With the annotation @Component I can inject components which are
> defined in
> >>>>> the component's template, for example:
> >>>>> @Component(id="myComponent")
> >>>>> private ActionLink link;
> >>>>>
> >>>>> Is there a way to inject a component from the parent component?
> Something
> >>>>> like:
> >>>>> @Component(id="../myComponent")
> >>>>> private ActionLink mark;
> >>>>>
> >>>>> Thank you
> >>>>> chris
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>> --
> >>>> Best regards,
> >>>>
> >>>> Igor Drobiazko
> >>>> http://tapestry5.de
> >>>
> >>> Christian Koller
> >>> Sofwareentwickler
> >>>
> >>> net mobile Schweiz AG
> >>> Seestrasse 45
> >>> CH ñ 8702 Zollikon
> >>>
> >>> Tel:     + 41 (0) 44 918 99 99
> >>> Fax:     + 41 (0) 44 918 99 98
> >>> Direkt:  + 41 (0) 44 918 99 72
> >>>
> >>> Mail: christian.koller@net-m.ch
> >>> Web:  www.net-m.ch
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >
> > Christian Koller
> > Sofwareentwickler
> >
> > net mobile Schweiz AG
> > Seestrasse 45
> > CH ñ 8702 Zollikon
> >
> > Tel:     + 41 (0) 44 918 99 99
> > Fax:     + 41 (0) 44 918 99 98
> > Direkt:  + 41 (0) 44 918 99 72
> >
> > Mail: christian.koller@net-m.ch
> > Web:  www.net-m.ch
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
*Regards,*
*Muhammad Gelbana
Java Software Programmer*

Re: inject component from parent component

Posted by Geoff Callender <ge...@gmail.com>.
It's best that the component knows nothing of what's around it. Instead, have it trigger an event to bubble up to its container and let the container decide what to do with it. Perhaps this example will help?

	http://jumpstart.doublenegative.com.au/jumpstart/examples/ajaxcomponentscrud 

Geoff

On 11/08/2010, at 2:26 AM, Christian Koller wrote:

> Hi
> 
> I'm not sure how I can pass an embedded zone in the template as a parameter. I tried for several hours but wasn't able to do that.
> I can inject the zone to the page but then, how can I handle the zone down to the sub component as parameter?
> 
> I know about the publish params and inherit params, but it does not work with a zone as parameter or maybe I do something wrong.
> 
> I'm considering to put the zone to the session as a sso and then grab for it in the needed sub component. What do you think about this solution?
> 
> 
> On 08.08.2010, at 18:33, Josh Canfield wrote:
> 
>> It's generally not considered good design for a component to have knowledge of the design of it's container. This would be a universal design principle, not limited to tapestry.
>> 
>> So if all you want to do is update a zone then couldn't you just pass the zone or zone id as a parameter to your component? 
>> 
>> -- Josh
>> 
>> On Aug 8, 2010, at 7:49 AM, Christian Koller <ch...@net-m.ch> wrote:
>> 
>>> In an inner component I handle an ajax request from an action link and want to update a zone in a outer component.
>>> 
>>> As a work around I use the ComponentSource like:
>>> 
>>> Object onActionFromMark(long wishedStartTime) {
>>> this.wishedStartTime = wishedStartTime;
>>> CalendarComponent cal = (CalendarComponent) componentSource.getComponent("AppointmentPage:calendarCollection.cal0"); 
>>> return cal;
>>> 
>>> Unfortunately I have to give the full id here with page name and so on.
>>> Is there no way to get an outer component to update a zone there?
>>> 
>>> 
>>> On 08.08.2010, at 16:37, Igor Drobiazko wrote:
>>> 
>>>> Nope, this is not possible. What are you trying to do?
>>>> 
>>>> On Sun, Aug 8, 2010 at 4:28 PM, Christian Koller
>>>> <ch...@net-m.ch>wrote:
>>>> 
>>>>> Hi
>>>>> 
>>>>> With the annotation @Component I can inject components which are defined in
>>>>> the component's template, for example:
>>>>> @Component(id="myComponent")
>>>>> private ActionLink link;
>>>>> 
>>>>> Is there a way to inject a component from the parent component? Something
>>>>> like:
>>>>> @Component(id="../myComponent")
>>>>> private ActionLink mark;
>>>>> 
>>>>> Thank you
>>>>> chris
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> Best regards,
>>>> 
>>>> Igor Drobiazko
>>>> http://tapestry5.de
>>> 
>>> Christian Koller
>>> Sofwareentwickler
>>> 
>>> net mobile Schweiz AG
>>> Seestrasse 45
>>> CH ñ 8702 Zollikon
>>> 
>>> Tel:     + 41 (0) 44 918 99 99
>>> Fax:     + 41 (0) 44 918 99 98
>>> Direkt:  + 41 (0) 44 918 99 72
>>> 
>>> Mail: christian.koller@net-m.ch
>>> Web:  www.net-m.ch
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
> 
> Christian Koller
> Sofwareentwickler
> 
> net mobile Schweiz AG
> Seestrasse 45
> CH ñ 8702 Zollikon
> 
> Tel:     + 41 (0) 44 918 99 99
> Fax:     + 41 (0) 44 918 99 98
> Direkt:  + 41 (0) 44 918 99 72
> 
> Mail: christian.koller@net-m.ch
> Web:  www.net-m.ch
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


inject component from parent component

Posted by Christian Koller <ch...@net-m.ch>.
Hi

I'm not sure how I can pass an embedded zone in the template as a parameter. I tried for several hours but wasn't able to do that.
I can inject the zone to the page but then, how can I handle the zone down to the sub component as parameter?

I know about the publish params and inherit params, but it does not work with a zone as parameter or maybe I do something wrong.

I'm considering to put the zone to the session as a sso and then grab for it in the needed sub component. What do you think about this solution?


On 08.08.2010, at 18:33, Josh Canfield wrote:

> It's generally not considered good design for a component to have knowledge of the design of it's container. This would be a universal design principle, not limited to tapestry.
> 
> So if all you want to do is update a zone then couldn't you just pass the zone or zone id as a parameter to your component? 
> 
> -- Josh
> 
> On Aug 8, 2010, at 7:49 AM, Christian Koller <ch...@net-m.ch> wrote:
> 
>> In an inner component I handle an ajax request from an action link and want to update a zone in a outer component.
>> 
>> As a work around I use the ComponentSource like:
>> 
>> Object onActionFromMark(long wishedStartTime) {
>> this.wishedStartTime = wishedStartTime;
>> CalendarComponent cal = (CalendarComponent) componentSource.getComponent("AppointmentPage:calendarCollection.cal0"); 
>> return cal;
>> 
>> Unfortunately I have to give the full id here with page name and so on.
>> Is there no way to get an outer component to update a zone there?
>> 
>> 
>> On 08.08.2010, at 16:37, Igor Drobiazko wrote:
>> 
>>> Nope, this is not possible. What are you trying to do?
>>> 
>>> On Sun, Aug 8, 2010 at 4:28 PM, Christian Koller
>>> <ch...@net-m.ch>wrote:
>>> 
>>>> Hi
>>>> 
>>>> With the annotation @Component I can inject components which are defined in
>>>> the component's template, for example:
>>>> @Component(id="myComponent")
>>>> private ActionLink link;
>>>> 
>>>> Is there a way to inject a component from the parent component? Something
>>>> like:
>>>> @Component(id="../myComponent")
>>>> private ActionLink mark;
>>>> 
>>>> Thank you
>>>> chris
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> -- 
>>> Best regards,
>>> 
>>> Igor Drobiazko
>>> http://tapestry5.de
>> 
>> Christian Koller
>> Sofwareentwickler
>> 
>> net mobile Schweiz AG
>> Seestrasse 45
>> CH ñ 8702 Zollikon
>> 
>> Tel:     + 41 (0) 44 918 99 99
>> Fax:     + 41 (0) 44 918 99 98
>> Direkt:  + 41 (0) 44 918 99 72
>> 
>> Mail: christian.koller@net-m.ch
>> Web:  www.net-m.ch
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

Christian Koller
Sofwareentwickler
 
net mobile Schweiz AG
Seestrasse 45
CH ñ 8702 Zollikon
 
Tel:     + 41 (0) 44 918 99 99
Fax:     + 41 (0) 44 918 99 98
Direkt:  + 41 (0) 44 918 99 72

Mail: christian.koller@net-m.ch
Web:  www.net-m.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: inject component from parent component

Posted by Josh Canfield <jo...@gmail.com>.
It's generally not considered good design for a component to have knowledge of the design of it's container. This would be a universal design principle, not limited to tapestry.

So if all you want to do is update a zone then couldn't you just pass the zone or zone id as a parameter to your component? 

-- Josh

On Aug 8, 2010, at 7:49 AM, Christian Koller <ch...@net-m.ch> wrote:

> In an inner component I handle an ajax request from an action link and want to update a zone in a outer component.
> 
> As a work around I use the ComponentSource like:
> 
> Object onActionFromMark(long wishedStartTime) {
> this.wishedStartTime = wishedStartTime;
> CalendarComponent cal = (CalendarComponent) componentSource.getComponent("AppointmentPage:calendarCollection.cal0"); 
> return cal;
> 
> Unfortunately I have to give the full id here with page name and so on.
> Is there no way to get an outer component to update a zone there?
> 
> 
> On 08.08.2010, at 16:37, Igor Drobiazko wrote:
> 
>> Nope, this is not possible. What are you trying to do?
>> 
>> On Sun, Aug 8, 2010 at 4:28 PM, Christian Koller
>> <ch...@net-m.ch>wrote:
>> 
>>> Hi
>>> 
>>> With the annotation @Component I can inject components which are defined in
>>> the component's template, for example:
>>> @Component(id="myComponent")
>>> private ActionLink link;
>>> 
>>> Is there a way to inject a component from the parent component? Something
>>> like:
>>> @Component(id="../myComponent")
>>> private ActionLink mark;
>>> 
>>> Thank you
>>> chris
>>> 
>>> 
>>> 
>>> 
>> 
>> 
>> -- 
>> Best regards,
>> 
>> Igor Drobiazko
>> http://tapestry5.de
> 
> Christian Koller
> Sofwareentwickler
> 
> net mobile Schweiz AG
> Seestrasse 45
> CH ñ 8702 Zollikon
> 
> Tel:     + 41 (0) 44 918 99 99
> Fax:     + 41 (0) 44 918 99 98
> Direkt:  + 41 (0) 44 918 99 72
> 
> Mail: christian.koller@net-m.ch
> Web:  www.net-m.ch
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


inject component from parent component

Posted by Christian Koller <ch...@net-m.ch>.
In an inner component I handle an ajax request from an action link and want to update a zone in a outer component.

As a work around I use the ComponentSource like:

Object onActionFromMark(long wishedStartTime) {
this.wishedStartTime = wishedStartTime;
CalendarComponent cal = (CalendarComponent) componentSource.getComponent("AppointmentPage:calendarCollection.cal0"); 
return cal;

Unfortunately I have to give the full id here with page name and so on.
Is there no way to get an outer component to update a zone there?


On 08.08.2010, at 16:37, Igor Drobiazko wrote:

> Nope, this is not possible. What are you trying to do?
> 
> On Sun, Aug 8, 2010 at 4:28 PM, Christian Koller
> <ch...@net-m.ch>wrote:
> 
>> Hi
>> 
>> With the annotation @Component I can inject components which are defined in
>> the component's template, for example:
>> @Component(id="myComponent")
>> private ActionLink link;
>> 
>> Is there a way to inject a component from the parent component? Something
>> like:
>> @Component(id="../myComponent")
>> private ActionLink mark;
>> 
>> Thank you
>> chris
>> 
>> 
>> 
>> 
> 
> 
> -- 
> Best regards,
> 
> Igor Drobiazko
> http://tapestry5.de

Christian Koller
Sofwareentwickler
 
net mobile Schweiz AG
Seestrasse 45
CH ñ 8702 Zollikon
 
Tel:     + 41 (0) 44 918 99 99
Fax:     + 41 (0) 44 918 99 98
Direkt:  + 41 (0) 44 918 99 72

Mail: christian.koller@net-m.ch
Web:  www.net-m.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: inject component from parent component

Posted by Igor Drobiazko <ig...@gmail.com>.
Nope, this is not possible. What are you trying to do?

On Sun, Aug 8, 2010 at 4:28 PM, Christian Koller
<ch...@net-m.ch>wrote:

> Hi
>
> With the annotation @Component I can inject components which are defined in
> the component's template, for example:
> @Component(id="myComponent")
> private ActionLink link;
>
> Is there a way to inject a component from the parent component? Something
> like:
> @Component(id="../myComponent")
> private ActionLink mark;
>
> Thank you
> chris
>
>
>
>


-- 
Best regards,

Igor Drobiazko
http://tapestry5.de