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 <roasteddra...@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.jumpst...@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 <
>> thiag...@gmail.com> wrote:
>> 
>>> On Wed, 03 Sep 2014 13:40:53 -0300, Sumanth <roasteddra...@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-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
>> 


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

Reply via email to