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

                 Key: TAPESTRY-2125
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2125
             Project: Tapestry
          Issue Type: Bug
          Components: Framework
    Affects Versions: 4.1.3
         Environment: Using Tapestry framework 4.1.4, nightly build from 
2008/02/01
            Reporter: Ehren Jarosek


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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to