Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-893

Nested zone elements problem : changes the HTML DOM and due that the tag cannot be find

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.1.0.5
    • 5.1.0.5
    • None
    • None

    Description

      Hi guys,

      Here is a problem I stumbled upon today. I have to create a page with two nested tabsets.
      I put together a quick tabset component.

      I found out that I cannot put two nested zones since the id parameter of the zone must me string and that string cannot be fed from ${var} ??!
      We must change that or perhaps one of those magical prefixes can do the job?

      Anyways the ui of the two tabsets had to be different so created a second tabset component with a different zone id.
      However, when I play a bit with the tabsets it happens that the second(the nested) tabset stops working and FF reports an error in Tapestry.js

      function $T(element) {
      var e = $(element);
      var t = e._tapestry; <=== e is null

      It is obvious that once the Ajax response returns a new block the ids are changed and the ${} function doesn't work already. However document.getElementByID() still ugly and still works and perhaps we can change the Tapestry.js to accommodate those cases?

      And in general how do we change that file? I'd go one step further to find and suggest a solution but how do we access that file?

      Cheers,
      Deian

      Here is the simple code:

      NestedZones.tml

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

      ${Name}<br/>
      <hr/>
      <a t:type="EventLink" event="click" zone="zz1" t:context="literal:pp1" >#1->1</a>
      <br/>
      <a t:type="EventLink" event="click" zone="zz1" t:context="literal:pp2" >#2->1</a>
      <br/>
      <a t:type="EventLink" event="click" zone="zz2" t:context="literal:pp1" >#1->2</a>
      <br/>
      <a t:type="EventLink" event="click" zone="zz2" t:context="literal:pp2" >#2->2</a>
      <br/>
      <hr/>

      <t:zone t:id="zz1" style="border: 2px solid red; width: 300px; height: 300px;">
      <t:slot id="pp1"/>
      </t:zone>

      <t:block id="pp1">
      This is block #1;
      <a t:type="EventLink" event="click" zone="zz1" t:context="literal:pp1" >#1->1</a>
      <br/>
      <a t:type="EventLink" event="click" zone="zz1" t:context="literal:pp2" >#2->1</a>
      <br/>
      <a t:type="EventLink" event="click" zone="zz2" t:context="literal:pp1" >#1->2</a>
      <br/>
      <a t:type="EventLink" event="click" zone="zz2" t:context="literal:pp2" >#2->2</a>
      <br/>
      <t:zone t:id="zz2" style="border: 2px solid green; width: 100px; height: 100px;">
      <t:slot id="pp2"/>
      </t:zone>
      </t:block>

      <t:block id="pp2">
      This is block #2;
      <a t:type="EventLink" event="click" zone="zz1" t:context="literal:pp1" >#1->1</a>
      <br/>
      <a t:type="EventLink" event="click" zone="zz1" t:context="literal:pp2" >#2->1</a>
      <br/>
      <a t:type="EventLink" event="click" zone="zz2" t:context="literal:pp1" >#1->2</a>
      <br/>
      <a t:type="EventLink" event="click" zone="zz2" t:context="literal:pp2" >#2->2</a>
      <br/>
      </t:block>

      </html>

      and the NestedZones.java

      import org.apache.tapestry5.Block;
      import org.apache.tapestry5.ComponentResources;
      import org.apache.tapestry5.MarkupWriter;
      import org.apache.tapestry5.annotations.BeforeRenderBody;
      import org.apache.tapestry5.annotations.Component;
      import org.apache.tapestry5.annotations.Property;
      import org.apache.tapestry5.corelib.components.EventLink;
      import org.apache.tapestry5.ioc.annotations.Inject;

      public class NestedZones {

      @Inject
      private ComponentResources resources;

      //@Component(parameters =

      {"event=click"}

      )
      //private EventLink click1, click2, click3;

      Object onClick(String s) {
      Block toRender = null;
      ComponentResources scanResources = resources;
      while(scanResources != null)

      { toRender = scanResources.findBlock(s); scanResources = scanResources.getContainerResources(); // try to scan upper level }

      return toRender;
      }

      public String getName()

      { return "Zones Test"; }

      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            deian Deian Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: