Updating zones from a page that uses a layout

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Updating zones from a page that uses a layout

Muhammad Gelbana
Hello everyone,

I have a layout component, used by a page called "Start".
This layout component has a zone component in it that I intend to load components into it using ajax. The links supposed to initiate such update is in the layout component. But the link events must be handled by the page utilizing the layout component (after a search on google).

So after I added the following method to the "Start" page:

e.g.
onActionFromLayout(){
 ...
}

I couldn't refer to "Blocks" defined in the layout component from the Start page, because simply they doesn't exist in the Start page's tml file !
I can put those components in the Start page .tml file instead, but then I'll have to redefine all the components I could load by ajax into each other. As any component lead to the other one !

Generally, how can I tackle such organization issue ? May be you guys know some other easier\more efficient way to do that.

Please find attached a picture to elaborate my case.
Thank you all for your time.

--
Regards,
Muhammad Gelbana
Java Software Programmer



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Updating zones from a page that uses a layout

Mats Andersson-2
Hi,

Why not have everything in the layout component, both event handlers and
zone? An example:

layout.tml:

...
<t:zone t:id="testzone">
<t:eventlink event="updatetestzone" zone="testzone">update
time</t:eventlink>
                 ${CurrentTime}
</t:zone>
..

Layout.java:

...
     @InjectComponent
     private Zone testzone;

     public Date getCurrentTime()
     {
         return new Date();
     }
     public Object onUpdatetestzone() {
         return testzone.getBody();
     }
...


Best Regards
Mats

____________________________________________
Mats Andersson
Ronsoft AB - Fridhemsvägen 8 - 372 25 Ronneby
Tel. 073-368 79 82
http://www.ronsoft.se
____________________________________________


Muhammad Mohsen skrev 2010-10-31 01:43:

> Hello everyone,
>
> I have a layout component, used by a page called "Start".
> This layout component has a zone component in it that I intend to load
> components into it using ajax. The links supposed to initiate such
> update is in the layout component. But the link events must be handled
> by the page utilizing the layout component (after a search on google).
>
> So after I added the following method to the "Start" page:
>
> e.g.
> onActionFromLayout(){
>  ...
> }
>
> I couldn't refer to "Blocks" defined in the layout component from the
> Start page, because simply they doesn't exist in the Start page's tml
> file !
> I can put those components in the Start page .tml file instead, but
> then I'll have to redefine all the components I could load by ajax
> into each other. As any component lead to the other one !
>
> Generally, how can I tackle such organization issue ? May be you guys
> know some other easier\more efficient way to do that.
>
> Please find attached a picture to elaborate my case.
> Thank you all for your time.
>
> --
> /Regards,/
> /Muhammad Gelbana
> Java Software Programmer/
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Updating zones from a page that uses a layout

Muhammad Gelbana
Thank you Mark for replying.

That's not my case. The layout component will have to refer to components
defined in it's tml file.

Anyway I tried that yesterday, still an error message appeared saying that
"Start" doesn't have handlers for the fired events.

I found this page
http://wiki.apache.org/tapestry/Tapestry5SimpleAndPowerfulLayouts
<http://wiki.apache.org/tapestry/Tapestry5SimpleAndPowerfulLayouts>Which
made me think, why am I using layouts ? It's more convincing to me that
layouts are best for pages utilizing a layout component and that's it.

My design is more about components. So far I'm only using a single page and
didn't benefit from the layout thing, I implemented something I don't need,
guess I was just trying to explore tapestry.

I'll implement the idea in that page and get back to you with any good info
I reach.

Thank you very much for your time :)

On Sun, Oct 31, 2010 at 12:53 PM, Mats Andersson
<[hidden email]>wrote:

> Hi,
>
> Why not have everything in the layout component, both event handlers and
> zone? An example:
>
> layout.tml:
>
> ...
> <t:zone t:id="testzone">
> <t:eventlink event="updatetestzone" zone="testzone">update
> time</t:eventlink>
>                ${CurrentTime}
> </t:zone>
> ..
>
> Layout.java:
>
> ...
>    @InjectComponent
>    private Zone testzone;
>
>    public Date getCurrentTime()
>    {
>        return new Date();
>    }
>    public Object onUpdatetestzone() {
>        return testzone.getBody();
>    }
> ...
>
>
> Best Regards
> Mats
>
> ____________________________________________
> Mats Andersson
> Ronsoft AB - Fridhemsvägen 8 - 372 25 Ronneby
> Tel. 073-368 79 82
> http://www.ronsoft.se
> ____________________________________________
>
>
> Muhammad Mohsen skrev 2010-10-31 01:43:
>
>> Hello everyone,
>>
>> I have a layout component, used by a page called "Start".
>> This layout component has a zone component in it that I intend to load
>> components into it using ajax. The links supposed to initiate such update is
>> in the layout component. But the link events must be handled by the page
>> utilizing the layout component (after a search on google).
>>
>> So after I added the following method to the "Start" page:
>>
>> e.g.
>> onActionFromLayout(){
>>  ...
>> }
>>
>> I couldn't refer to "Blocks" defined in the layout component from the
>> Start page, because simply they doesn't exist in the Start page's tml file !
>> I can put those components in the Start page .tml file instead, but then
>> I'll have to redefine all the components I could load by ajax into each
>> other. As any component lead to the other one !
>>
>> Generally, how can I tackle such organization issue ? May be you guys know
>> some other easier\more efficient way to do that.
>>
>> Please find attached a picture to elaborate my case.
>> Thank you all for your time.
>>
>> --
>> /Regards,/
>> /Muhammad Gelbana
>> Java Software Programmer/
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>


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