You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Sumanth <ro...@gmail.com> on 2014/09/03 18:40:53 UTC

Different Zone Update's

Hello Experts,

I have encountered one more hurdle now regarding zones,

I have a layout
component>componentA>componentB>componentC>NotificationComponent>Zone

This zone is a count zone and is updated using a mixin (periodiczonerefresh
mixin).

I have a notification page in which i have a Zone(a table inside a zone
containing notifications) and an actionlink to delete the selected
notifications.(bulk delete). On delete of these notifications i want the
count which is in layout component (mentioned above) to be updated.

How can i do it?

Thank you,
Sumanth

Re: Different Zone Update's

Posted by Lance Java <la...@googlemail.com>.
I've raised a pub/sub jira with an initial brain dump. I'm leaning towards
adding it to ComponentResources. Please add your suggestions / thoughts.

https://issues.apache.org/jira/browse/TAP5-2383

Re: Different Zone Update's

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Wed, 03 Sep 2014 19:29:36 -0300, Lance Java <la...@googlemail.com>  
wrote:

> This topic had come up a few times. I agree that a serverside pub sub
> mechanism would be great for decoupling.
>
> I've got a few ideas for how it would work. It would be nice if
> subscription handlers could be done via annotations or naming  
> conventions,
> similar to event handlers.

As far as I remember, someone already implemented that, but I couldn't  
find it.

>  On 3 Sep 2014 23:09, "Geoff Callender"  
> <ge...@gmail.com>
> wrote:
>
>> I think the issue here is that he'd like one deeply nested component,
>> let's call it Z, to be refreshed when another deeply nested component,
>> let's call it N, that doesn't know about Z, is refreshed.
>>
>> One way is to bubble up an event from N until it reaches a common  
>> parent,
>> C, which in this example is the parent of the layout. C then calls
>> component.doChangeOfNotifications(), which calls
>> componentA.doChangeOfNotifications(), which calls ... etc. .. which  
>> calls
>> Z.doChangeOfNotifications(). Messy, with lots of components needing new
>> method doChangeOfNotifications. You can see something like this in:
>>
>>
>> http://jumpstart.doublenegative.com.au/jumpstart7/together/ajaxcomponentscrud/persons
>>
>> where Persons, which is the page, calls list.doChangeOfSelectedPerson()  
>> in
>> response to several bubbled-up events.
>>
>> Ideally, a synchronous pub-sub server-side could solve it. N would  
>> publish
>> and Z would subscribe. Z would use AjaxResponseRenderer to add its zone  
>> to
>> the render list. Unfortunately, I don't know of such a mechanism.
>>
>> Any other suggestions?
>>
>> On 4 Sep 2014, at 3:51 am, Thiago H de Paula Figueiredo <
>> thiagohp@gmail.com> wrote:
>>
>> > On Wed, 03 Sep 2014 13:40:53 -0300, Sumanth <ro...@gmail.com>
>> wrote:
>> >
>> >> Hello Experts,
>> >
>> > Hi!
>> >
>> >>
>> >> I have encountered one more hurdle now regarding zones,
>> >>
>> >> I have a layout
>> >> component>componentA>componentB>componentC>NotificationComponent>Zone
>> >>
>> >> This zone is a count zone and is updated using a mixin
>> (periodiczonerefresh
>> >> mixin).
>> >>
>> >> I have a notification page in which i have a Zone(a table inside a  
>> zone
>> >> containing notifications) and an actionlink to delete the selected
>> >> notifications.(bulk delete). On delete of these notifications i want  
>> the
>> >> count which is in layout component (mentioned above) to be updated.
>> >>
>> >> How can i do it?
>> >
>> > The easiest way is to define the id of the zone to be updated and use
>> its addRender(String clientId, Object renderer) to update it.
>> >
>> > --
>> > Thiago H. de Paula Figueiredo
>> > Tapestry, Java and Hibernate consultant and developer
>> > http://machina.com.br
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>


-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: Different Zone Update's

Posted by Lance Java <la...@googlemail.com>.
This topic had come up a few times. I agree that a serverside pub sub
mechanism would be great for decoupling.

I've got a few ideas for how it would work. It would be nice if
subscription handlers could be done via annotations or naming conventions,
similar to event handlers.
 On 3 Sep 2014 23:09, "Geoff Callender" <ge...@gmail.com>
wrote:

> I think the issue here is that he'd like one deeply nested component,
> let's call it Z, to be refreshed when another deeply nested component,
> let's call it N, that doesn't know about Z, is refreshed.
>
> One way is to bubble up an event from N until it reaches a common parent,
> C, which in this example is the parent of the layout. C then calls
> component.doChangeOfNotifications(), which calls
> componentA.doChangeOfNotifications(), which calls ... etc. .. which calls
> Z.doChangeOfNotifications(). Messy, with lots of components needing new
> method doChangeOfNotifications. You can see something like this in:
>
>
> http://jumpstart.doublenegative.com.au/jumpstart7/together/ajaxcomponentscrud/persons
>
> where Persons, which is the page, calls list.doChangeOfSelectedPerson() in
> response to several bubbled-up events.
>
> Ideally, a synchronous pub-sub server-side could solve it. N would publish
> and Z would subscribe. Z would use AjaxResponseRenderer to add its zone to
> the render list. Unfortunately, I don't know of such a mechanism.
>
> Any other suggestions?
>
> On 4 Sep 2014, at 3:51 am, Thiago H de Paula Figueiredo <
> thiagohp@gmail.com> wrote:
>
> > On Wed, 03 Sep 2014 13:40:53 -0300, Sumanth <ro...@gmail.com>
> wrote:
> >
> >> Hello Experts,
> >
> > Hi!
> >
> >>
> >> I have encountered one more hurdle now regarding zones,
> >>
> >> I have a layout
> >> component>componentA>componentB>componentC>NotificationComponent>Zone
> >>
> >> This zone is a count zone and is updated using a mixin
> (periodiczonerefresh
> >> mixin).
> >>
> >> I have a notification page in which i have a Zone(a table inside a zone
> >> containing notifications) and an actionlink to delete the selected
> >> notifications.(bulk delete). On delete of these notifications i want the
> >> count which is in layout component (mentioned above) to be updated.
> >>
> >> How can i do it?
> >
> > The easiest way is to define the id of the zone to be updated and use
> its addRender(String clientId, Object renderer) to update it.
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Tapestry, Java and Hibernate consultant and developer
> > http://machina.com.br
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Different Zone Update's

Posted by Geoff Callender <ge...@gmail.com>.
I've raised a JIRA for client-side pub/sub. 

https://issues.apache.org/jira/browse/TAP5-2416


On 4 Sep 2014, at 5:57 pm, Geoff Callender <ge...@gmail.com> wrote:

> In an AJAX request the server-side would have no way of knowing how many subscribers there are within the page unless it exactly rebuilds the entire page state. For example some subscribers could be within a loop, and they might be conditional.
> 
> However, the client-side has the full page state, so I think that's where the pub-sub has to happen. 
> 
> A simple mechanism that might be sufficient:
> - give the Zone component a "refreshOnMessage" parameter, and 
> - give AjaxResponseRenderer a publishMessage(String s) method, and 
> - Tapestry could do the rest, client-side, triggering all the necessary zone refreshes.
> 
> What do you think?
> 
> 
> On 4 Sep 2014, at 3:01 pm, Sumanth <ro...@gmail.com> wrote:
> 
>> Exactly, It's too messy to do it that way, and hence I had to post it here
>> to find an alternative for it.
>> 
>> We also need a decoupled solution. We thought of  pub-sub  but have no idea
>> on how to implement it (Cant find much about this topic). So if anyone
>> knows of such a way to do it , this would help a lot.
>> 
>> This is one of our common requirement, cause we have many zones under
>> multiple nested components in layout component and on action of some of the
>> nested components in pages, those layout component needs to be updated.
>> 
>> On Thu, Sep 4, 2014 at 12:08 AM, Geoff Callender <
>> geoff.callender.jumpstart@gmail.com> wrote:
>> 
>>> I think the issue here is that he'd like one deeply nested component,
>>> let's call it Z, to be refreshed when another deeply nested component,
>>> let's call it N, that doesn't know about Z, is refreshed.
>>> 
>>> One way is to bubble up an event from N until it reaches a common parent,
>>> C, which in this example is the parent of the layout. C then calls
>>> component.doChangeOfNotifications(), which calls
>>> componentA.doChangeOfNotifications(), which calls ... etc. .. which calls
>>> Z.doChangeOfNotifications(). Messy, with lots of components needing new
>>> method doChangeOfNotifications. You can see something like this in:
>>> 
>>> 
>>> http://jumpstart.doublenegative.com.au/jumpstart7/together/ajaxcomponentscrud/persons
>>> 
>>> where Persons, which is the page, calls list.doChangeOfSelectedPerson() in
>>> response to several bubbled-up events.
>>> 
>>> Ideally, a synchronous pub-sub server-side could solve it. N would publish
>>> and Z would subscribe. Z would use AjaxResponseRenderer to add its zone to
>>> the render list. Unfortunately, I don't know of such a mechanism.
>>> 
>>> Any other suggestions?
>>> 
>>> On 4 Sep 2014, at 3:51 am, Thiago H de Paula Figueiredo <
>>> thiagohp@gmail.com> wrote:
>>> 
>>>> On Wed, 03 Sep 2014 13:40:53 -0300, Sumanth <ro...@gmail.com>
>>> wrote:
>>>> 
>>>>> Hello Experts,
>>>> 
>>>> Hi!
>>>> 
>>>>> 
>>>>> I have encountered one more hurdle now regarding zones,
>>>>> 
>>>>> I have a layout
>>>>> component>componentA>componentB>componentC>NotificationComponent>Zone
>>>>> 
>>>>> This zone is a count zone and is updated using a mixin
>>> (periodiczonerefresh
>>>>> mixin).
>>>>> 
>>>>> I have a notification page in which i have a Zone(a table inside a zone
>>>>> containing notifications) and an actionlink to delete the selected
>>>>> notifications.(bulk delete). On delete of these notifications i want the
>>>>> count which is in layout component (mentioned above) to be updated.
>>>>> 
>>>>> How can i do it?
>>>> 
>>>> The easiest way is to define the id of the zone to be updated and use
>>> its addRender(String clientId, Object renderer) to update it.
>>>> 
>>>> --
>>>> Thiago H. de Paula Figueiredo
>>>> Tapestry, Java and Hibernate consultant and developer
>>>> http://machina.com.br
>>>> 
>>>> ---------------------------------------------------------------------
>>>> 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: Different Zone Update's

Posted by Geoff Callender <ge...@gmail.com>.
In an AJAX request the server-side would have no way of knowing how many subscribers there are within the page unless it exactly rebuilds the entire page state. For example some subscribers could be within a loop, and they might be conditional.

However, the client-side has the full page state, so I think that's where the pub-sub has to happen. 

A simple mechanism that might be sufficient:
- give the Zone component a "refreshOnMessage" parameter, and 
- give AjaxResponseRenderer a publishMessage(String s) method, and 
- Tapestry could do the rest, client-side, triggering all the necessary zone refreshes.

What do you think?


On 4 Sep 2014, at 3:01 pm, Sumanth <ro...@gmail.com> wrote:

> Exactly, It's too messy to do it that way, and hence I had to post it here
> to find an alternative for it.
> 
> We also need a decoupled solution. We thought of  pub-sub  but have no idea
> on how to implement it (Cant find much about this topic). So if anyone
> knows of such a way to do it , this would help a lot.
> 
> This is one of our common requirement, cause we have many zones under
> multiple nested components in layout component and on action of some of the
> nested components in pages, those layout component needs to be updated.
> 
> On Thu, Sep 4, 2014 at 12:08 AM, Geoff Callender <
> geoff.callender.jumpstart@gmail.com> wrote:
> 
>> I think the issue here is that he'd like one deeply nested component,
>> let's call it Z, to be refreshed when another deeply nested component,
>> let's call it N, that doesn't know about Z, is refreshed.
>> 
>> One way is to bubble up an event from N until it reaches a common parent,
>> C, which in this example is the parent of the layout. C then calls
>> component.doChangeOfNotifications(), which calls
>> componentA.doChangeOfNotifications(), which calls ... etc. .. which calls
>> Z.doChangeOfNotifications(). Messy, with lots of components needing new
>> method doChangeOfNotifications. You can see something like this in:
>> 
>> 
>> http://jumpstart.doublenegative.com.au/jumpstart7/together/ajaxcomponentscrud/persons
>> 
>> where Persons, which is the page, calls list.doChangeOfSelectedPerson() in
>> response to several bubbled-up events.
>> 
>> Ideally, a synchronous pub-sub server-side could solve it. N would publish
>> and Z would subscribe. Z would use AjaxResponseRenderer to add its zone to
>> the render list. Unfortunately, I don't know of such a mechanism.
>> 
>> Any other suggestions?
>> 
>> On 4 Sep 2014, at 3:51 am, Thiago H de Paula Figueiredo <
>> thiagohp@gmail.com> wrote:
>> 
>>> On Wed, 03 Sep 2014 13:40:53 -0300, Sumanth <ro...@gmail.com>
>> wrote:
>>> 
>>>> Hello Experts,
>>> 
>>> Hi!
>>> 
>>>> 
>>>> I have encountered one more hurdle now regarding zones,
>>>> 
>>>> I have a layout
>>>> component>componentA>componentB>componentC>NotificationComponent>Zone
>>>> 
>>>> This zone is a count zone and is updated using a mixin
>> (periodiczonerefresh
>>>> mixin).
>>>> 
>>>> I have a notification page in which i have a Zone(a table inside a zone
>>>> containing notifications) and an actionlink to delete the selected
>>>> notifications.(bulk delete). On delete of these notifications i want the
>>>> count which is in layout component (mentioned above) to be updated.
>>>> 
>>>> How can i do it?
>>> 
>>> The easiest way is to define the id of the zone to be updated and use
>> its addRender(String clientId, Object renderer) to update it.
>>> 
>>> --
>>> Thiago H. de Paula Figueiredo
>>> Tapestry, Java and Hibernate consultant and developer
>>> http://machina.com.br
>>> 
>>> ---------------------------------------------------------------------
>>> 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: Different Zone Update's

Posted by Sumanth <ro...@gmail.com>.
Exactly, It's too messy to do it that way, and hence I had to post it here
to find an alternative for it.

We also need a decoupled solution. We thought of  pub-sub  but have no idea
on how to implement it (Cant find much about this topic). So if anyone
knows of such a way to do it , this would help a lot.

This is one of our common requirement, cause we have many zones under
multiple nested components in layout component and on action of some of the
nested components in pages, those layout component needs to be updated.

On Thu, Sep 4, 2014 at 12:08 AM, Geoff Callender <
geoff.callender.jumpstart@gmail.com> wrote:

> I think the issue here is that he'd like one deeply nested component,
> let's call it Z, to be refreshed when another deeply nested component,
> let's call it N, that doesn't know about Z, is refreshed.
>
> One way is to bubble up an event from N until it reaches a common parent,
> C, which in this example is the parent of the layout. C then calls
> component.doChangeOfNotifications(), which calls
> componentA.doChangeOfNotifications(), which calls ... etc. .. which calls
> Z.doChangeOfNotifications(). Messy, with lots of components needing new
> method doChangeOfNotifications. You can see something like this in:
>
>
> http://jumpstart.doublenegative.com.au/jumpstart7/together/ajaxcomponentscrud/persons
>
> where Persons, which is the page, calls list.doChangeOfSelectedPerson() in
> response to several bubbled-up events.
>
> Ideally, a synchronous pub-sub server-side could solve it. N would publish
> and Z would subscribe. Z would use AjaxResponseRenderer to add its zone to
> the render list. Unfortunately, I don't know of such a mechanism.
>
> Any other suggestions?
>
> On 4 Sep 2014, at 3:51 am, Thiago H de Paula Figueiredo <
> thiagohp@gmail.com> wrote:
>
> > On Wed, 03 Sep 2014 13:40:53 -0300, Sumanth <ro...@gmail.com>
> wrote:
> >
> >> Hello Experts,
> >
> > Hi!
> >
> >>
> >> I have encountered one more hurdle now regarding zones,
> >>
> >> I have a layout
> >> component>componentA>componentB>componentC>NotificationComponent>Zone
> >>
> >> This zone is a count zone and is updated using a mixin
> (periodiczonerefresh
> >> mixin).
> >>
> >> I have a notification page in which i have a Zone(a table inside a zone
> >> containing notifications) and an actionlink to delete the selected
> >> notifications.(bulk delete). On delete of these notifications i want the
> >> count which is in layout component (mentioned above) to be updated.
> >>
> >> How can i do it?
> >
> > The easiest way is to define the id of the zone to be updated and use
> its addRender(String clientId, Object renderer) to update it.
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Tapestry, Java and Hibernate consultant and developer
> > http://machina.com.br
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Different Zone Update's

Posted by Geoff Callender <ge...@gmail.com>.
I think the issue here is that he'd like one deeply nested component, let's call it Z, to be refreshed when another deeply nested component, let's call it N, that doesn't know about Z, is refreshed.

One way is to bubble up an event from N until it reaches a common parent, C, which in this example is the parent of the layout. C then calls component.doChangeOfNotifications(), which calls componentA.doChangeOfNotifications(), which calls ... etc. .. which calls Z.doChangeOfNotifications(). Messy, with lots of components needing new method doChangeOfNotifications. You can see something like this in:

	http://jumpstart.doublenegative.com.au/jumpstart7/together/ajaxcomponentscrud/persons

where Persons, which is the page, calls list.doChangeOfSelectedPerson() in response to several bubbled-up events.

Ideally, a synchronous pub-sub server-side could solve it. N would publish and Z would subscribe. Z would use AjaxResponseRenderer to add its zone to the render list. Unfortunately, I don't know of such a mechanism.

Any other suggestions?

On 4 Sep 2014, at 3:51 am, Thiago H de Paula Figueiredo <th...@gmail.com> wrote:

> On Wed, 03 Sep 2014 13:40:53 -0300, Sumanth <ro...@gmail.com> wrote:
> 
>> Hello Experts,
> 
> Hi!
> 
>> 
>> I have encountered one more hurdle now regarding zones,
>> 
>> I have a layout
>> component>componentA>componentB>componentC>NotificationComponent>Zone
>> 
>> This zone is a count zone and is updated using a mixin (periodiczonerefresh
>> mixin).
>> 
>> I have a notification page in which i have a Zone(a table inside a zone
>> containing notifications) and an actionlink to delete the selected
>> notifications.(bulk delete). On delete of these notifications i want the
>> count which is in layout component (mentioned above) to be updated.
>> 
>> How can i do it?
> 
> The easiest way is to define the id of the zone to be updated and use its addRender(String clientId, Object renderer) to update it.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


Re: Different Zone Update's

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Wed, 03 Sep 2014 13:40:53 -0300, Sumanth <ro...@gmail.com>  
wrote:

> Hello Experts,

Hi!

>
> I have encountered one more hurdle now regarding zones,
>
> I have a layout
> component>componentA>componentB>componentC>NotificationComponent>Zone
>
> This zone is a count zone and is updated using a mixin  
> (periodiczonerefresh
> mixin).
>
> I have a notification page in which i have a Zone(a table inside a zone
> containing notifications) and an actionlink to delete the selected
> notifications.(bulk delete). On delete of these notifications i want the
> count which is in layout component (mentioned above) to be updated.
>
> How can i do it?

The easiest way is to define the id of the zone to be updated and use its  
addRender(String clientId, Object renderer) to update it.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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