You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by bhorvat <ho...@gmail.com> on 2012/01/20 22:17:29 UTC

Zone and Eventlink refresh problem

Hi all,

I have a bit complicated zones and events links so bare with me for a bit.
So to begin.

I have one zone and inside of it I have a zone and a eventlink that triggers
the changes in the inner zone. Once the outer zone refreshes everything
inside the eventlink and inner zone stop working. 

Is this the expected behavior? I am using tapestry-jquery and tapestry 5.3.1
(tried previous version 5.2.6 same thing)

Cheers all

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-and-Eventlink-refresh-problem-tp5161722p5161722.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Zone and Eventlink refresh problem

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 20 Jan 2012 20:43:09 -0200, bhorvat <ho...@gmail.com>  
wrote:

> Hope this is bit better. Thanks
>
> --------------------------------
>    <t:zone t:id="zoneMediaPreview" t:update="show">

t:id is the Tapestry component id. id is the HTML id attribute. You should  
add id attributes to solve your problem:

<t:zone t:id="zoneMediaPreview" id="zoneMediaPreview" t:update="show">

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Zone and Eventlink refresh problem

Posted by Dragan Sahpaski <dr...@gmail.com>.
Hi,

On Sat, Jan 21, 2012 at 8:37 PM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Sat, 21 Jan 2012 16:56:59 -0200, Dragan Sahpaski <
> dragan.sahpaski@gmail.com> wrote:
>
>  Hi,
>>
>
> Hi, Dragan!
>
>
>  This is expected behavior.
>> Once you update the outer zone the inner zone id is generated again if
>> you don't specify it explicitly.
>>
>
> Exactly!
>
>
>  Solution 2:
>> - Generate the zone's client id yourself, with a binding expression.
>>
>>  <t:zone t:id="zoneMediaPreview" id="${zoneMediaPreviewId}"
>> t:update="show">
>> . . .
>> </t:zone>
>>
>>  <t:eventlink t:event="changePreview" context="assetMedia.id"
>> zone="${zoneMediaPreviewId}" class="hideLink">
>>
>> public String getZoneMediaPreviewId(){
>>        return "zone-media-perview";
>> }
>>
>
> Why a binding expression instead of just adding id="zone-media-previews"?
> If the id needs to be static, as it seems to be the case here, I can't see
> why using a binding expression.


Yes you're right, the id needs to be static. No need for a binding
expression.

Cheers,
Dragan Sahpaski



>
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>

Re: Zone and Eventlink refresh problem

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sat, 21 Jan 2012 16:56:59 -0200, Dragan Sahpaski  
<dr...@gmail.com> wrote:

> Hi,

Hi, Dragan!

> This is expected behavior.
> Once you update the outer zone the inner zone id is generated again if  
> you don't specify it explicitly.

Exactly!

> Solution 2:
> - Generate the zone's client id yourself, with a binding expression.
>
>  <t:zone t:id="zoneMediaPreview" id="${zoneMediaPreviewId}"  
> t:update="show">
> . . .
> </t:zone>
>
>  <t:eventlink t:event="changePreview" context="assetMedia.id"
> zone="${zoneMediaPreviewId}" class="hideLink">
>
> public String getZoneMediaPreviewId(){
>         return "zone-media-perview";
> }

Why a binding expression instead of just adding id="zone-media-previews"?  
If the id needs to be static, as it seems to be the case here, I can't see  
why using a binding expression.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Zone and Eventlink refresh problem

Posted by Dragan Sahpaski <dr...@gmail.com>.
Hi,
This is expected behavior.
Once you update the outer zone the inner zone id is generated again if you
don't specify it explicitly.

Solution 1:
 -  Take the zone's generated clientId

 <t:eventlink t:event="changePreview" context="assetMedia.id"
zone="${zoneMediaPreviewId}" class="hideLink">

@InjectComponent
private Zone zoneMediaPreview;
// the zoneMediaPreview component is located before the  eventLink so it's
Id is already generated.
public String getZoneMediaPreviewId(){
        return zoneMediaPreview.getClientId();
}

Solution 2:
- Generate the zone's client id yourself, with a binding expression.

 <t:zone t:id="zoneMediaPreview" id="${zoneMediaPreviewId}" t:update="show">
. . .
</t:zone>

 <t:eventlink t:event="changePreview" context="assetMedia.id"
zone="${zoneMediaPreviewId}" class="hideLink">

public String getZoneMediaPreviewId(){
        return "zone-media-perview";
}

Hope it helps.
Cheers,
Dragan Sahpaski

On Fri, Jan 20, 2012 at 11:43 PM, bhorvat <ho...@gmail.com> wrote:

>
> Hope this is bit better. Thanks
>
> --------------------------------
> <t:zone t:id="zoneAsset" t:update="show">
>
>   <t:zone t:id="zoneMediaPreview" t:update="show">
>     <t:delegate to="mediaLayout" />
>
>     <t:block t:id="blockMediaImage">
>          ${context:images/}${selectedAssetImage.imagePath}
>     </t:block>
>   </t:zone>
>
>
>  <t:eventlink t:event="changePreview" context="assetMedia.id"
> zone="zoneMediaPreview" class="hideLink">
>            <div class="csgImg">
>              <div class="csgiTittle">${assetImage.caption}</div>
>              <div class="csgiType">
>                    ${context:images/models/thumbnailTypeImage.png}
>             </div>
>              ${context:images/}${assetImage.imageThumbnailPath}
>        </div>
>   </t:eventlink>
>
> </t:zone>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Zone-and-Eventlink-refresh-problem-tp5161722p5161885.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Zone and Eventlink refresh problem

Posted by bhorvat <ho...@gmail.com>.
Hope this is bit better. Thanks 

--------------------------------
<t:zone t:id="zoneAsset" t:update="show">

   <t:zone t:id="zoneMediaPreview" t:update="show">
     <t:delegate to="mediaLayout" />
                                         
     <t:block t:id="blockMediaImage">
          ${context:images/}${selectedAssetImage.imagePath} 
     </t:block>
   </t:zone>


  <t:eventlink t:event="changePreview" context="assetMedia.id"
zone="zoneMediaPreview" class="hideLink">
            <div class="csgImg">                                                        
              <div class="csgiTittle">${assetImage.caption}</div>
              <div class="csgiType">
                    ${context:images/models/thumbnailTypeImage.png} 
             </div>                                                    
              ${context:images/}${assetImage.imageThumbnailPath} 
        </div>
   </t:eventlink>

</t:zone>

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-and-Eventlink-refresh-problem-tp5161722p5161885.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Zone and Eventlink refresh problem

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 20 Jan 2012 19:17:29 -0200, bhorvat <ho...@gmail.com>  
wrote:

> Hi all,

Hi!

> I have one zone and inside of it I have a zone and a eventlink that  
> triggers the changes in the inner zone. Once the outer zone refreshes  
> everything
> inside the eventlink and inner zone stop working.

Please try giving an explicit id attribute for all zones.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Zone and Eventlink refresh problem

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 27 Jan 2012 03:22:58 -0200, Paul Stanton <pa...@mapshed.com.au>  
wrote:

> Just a side note, this has caught a few users over time (since t5.1).
>
> Boris' expected behaviour does not seem to me to be too unrealistic an  
> expectation! Depending on your personality type ;) you may even consider  
> this a bug.
>
> Maybe the zone re-rendering process should handle this client id  
> changeover gracefully?

The non-developer-provided ids change because otherwise the page could  
have different elements with the same id after a zone update. Automating  
the EventLinks (and ActionLinks) to point at new ids is quite hard:  
Tapestry would need to keep a server-side map of which link points to each  
zone, figure out which ids changed and then send a (EventLink, new target  
id) change them after a zone update. This would probably need to rewrite  
all JavaScript code related to zones. You can avoid this by providing  
client-side ids to Zones, so I don't think this whole change is worth.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Zone and Eventlink refresh problem

Posted by Denis Stepanov <de...@gmail.com>.
I've created a new issue "Warn user or disallow zone with randomly generated id" https://issues.apache.org/jira/browse/TAP5-1834

Denis


On 27.1.2012, at 6:22, Paul Stanton wrote:

> Just a side note, this has caught a few users over time (since t5.1).
> 
> Boris' expected behaviour does not seem to me to be too unrealistic an expectation! Depending on your personality type ;) you may even consider this a bug.
> 
> Maybe the zone re-rendering process should handle this client id changeover gracefully?
> 
> p.
> 
> On 22/01/2012 8:38 AM, bhorvat wrote:
>> Hm... Yea this worked perfectly.
>> 
>> I know that the new id is generated but I was under the impression that
>> tapestry eventlink will adapt to that since I did set which zone to target I
>> thought that once everything is refresh that will also refresh...
>> 
>> Thank you both for assistance :)
>> 
>> --
>> View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-and-Eventlink-refresh-problem-tp5161722p5163366.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>> 
>> ---------------------------------------------------------------------
>> 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: Zone and Eventlink refresh problem

Posted by Paul Stanton <pa...@mapshed.com.au>.
Just a side note, this has caught a few users over time (since t5.1).

Boris' expected behaviour does not seem to me to be too unrealistic an 
expectation! Depending on your personality type ;) you may even consider 
this a bug.

Maybe the zone re-rendering process should handle this client id 
changeover gracefully?

p.

On 22/01/2012 8:38 AM, bhorvat wrote:
> Hm... Yea this worked perfectly.
>
> I know that the new id is generated but I was under the impression that
> tapestry eventlink will adapt to that since I did set which zone to target I
> thought that once everything is refresh that will also refresh...
>
> Thank you both for assistance :)
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-and-Eventlink-refresh-problem-tp5161722p5163366.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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: Zone and Eventlink refresh problem

Posted by bhorvat <ho...@gmail.com>.
Hm... Yea this worked perfectly.

I know that the new id is generated but I was under the impression that
tapestry eventlink will adapt to that since I did set which zone to target I
thought that once everything is refresh that will also refresh...

Thank you both for assistance :)

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-and-Eventlink-refresh-problem-tp5161722p5163366.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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