Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-2125

cycle.getResponseBuilder().updateComponent() issue when called from component.

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.1.3
    • Fix Version/s: None
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Using Tapestry framework 4.1.4, nightly build from 2008/02/01

      Description

      It was recently updated so that EventListener could listen to event on events for components that nested in other components (TAPESTRY-2092). This bug is somewhat related.

      I have created a component that includes a @Dialog component. Inside my component I have an EventListener() that is triggered when a user checks a checkbox inside the component.

      Code:

      @EventListener(targets="checkbox", events="onchange", async=false)
      public void onCheckboxChange(IRequestCycle cycle)
      {
      LOG.debug("OverridesCheckbox:onCheckboxChange");

      if (getValue() == true)

      { LOG.debug("OverridesCheckbox:Show Dialog"); // User selected to override, show dialog setHidden(false); }

      cycle.getResponseBuilder().updateComponent("overridesDialog");
      }

      Until TAPESTRY-2092 was fixed the above did not work when multiple copies of the component were included on the page. Now that works but:

      cycle.getResponseBuilder().updateComponent("overridesDialog")

      does not. From debugging it looks like the updateComponent() call does not make reference to the component instance included in my component but instead to the first instance on the page.

      My quick and dirty fix was to change:

      cycle.getResponseBuilder().updateComponent("overridesDialog");

      to:

      cycle.getResponseBuilder().updateComponent(getComponent("overridesDialog").getClientId());

      and in org.apache.tapestry.services.impl.DojoAjaxResponseBuilder to change:

      public boolean explicitlyContains(IComponent target)

      { if (target == null) return false; return _parts.contains(target.getId()); }

      to:

      public boolean explicitlyContains(IComponent target)

      { if (target == null) return false; if (_parts.contains(target.getId())) return true; return _parts.contains(target.getClientId()); }

      However, I have not checked into the implications of doing this to other parts of tapestry so I thought I would let you take a look at it.

      Thank you,
      Ehren

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ejarosek Ehren Jarosek
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: