On Mon, Aug 5, 2013 at 12:01 PM, Sven Meier <[email protected]> wrote:

> Hi Martin,
>
> I seen these doubled renderings too, but didn't bother about it - until
> recently with a new component that changes on each render :(.
>
> We could add a new method #remove() to ART, but I'd be fine with 1) too.
>

No one needed #remove in AjaxRequetTarget API so far and I don't see reason
to add it.
Passing the original map to the listeners is good enough, I think.


>
> Note that there might be other components *inside* the enclosure too, that
> might be rendered twice if they were added to the ART already :(.


I see no way how to solve this besides making auto components proper
citizens of the component tree, somehow.
The InlineEnclosure is in the tree but it is a sibling of the controlling
component.
The only way to find which other siblings are actually children of the
enclosure is to use the MarkupStream for traversing, as the rendering does.


>
>
> Sven
>
>
>
>
> On 08/05/2013 11:36 AM, Martin Grigorov wrote:
>
>> Hi,
>>
>> We found that using InlineEnclosure doesn't remove the controlling
>> component from the map with components to be re-rendered.
>> org.apache.wicket.protocol.**http.AjaxEnclosureListener#**onBeforeRespond
>> adds
>> the InlineEnclosure to the ajax target and this leads to Ajax response
>> like:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <ajax-response>
>> <component id="cc7" ><![CDATA[<div wicket:id="cc" id="cc7">New
>> CC</div>]]></component>
>> <component id="wicket__InlineEnclosure_**06" ><![CDATA[<div
>> wicket:enclosure="cc" id="wicket__InlineEnclosure_**06">
>> Before<br/>
>>
>> <div wicket:id="cc" id="cc7">New CC</div>
>>
>> After<br/>
>> </div>]]>
>> </component>
>> </ajax-response>
>>
>> I.e. the controlling component (cc7) is rendered twice in the server and
>> replaced twice in the browser.
>>
>> At org.apache.wicket.ajax.**XmlAjaxResponse#**
>> fireOnBeforeRespondListeners
>> Wicket passes an unmodifiable map to all registered listeners and thus a
>> listener cannot remove entries from the map.
>>
>> Later org.apache.wicket.ajax.**AbstractAjaxResponse#**writeComponents()
>> removes
>> any component which has a parent also added for repainting but as you may
>> know Enclosures are not visible in the hierarchy and the filtering doesn't
>> work in this case.
>>
>>
>> At the moment I see two solutions:
>>
>> 1) pass the original and modifiable map to the listeners so they can
>> manipulate it
>>
>> 2) move the code
>> of org.apache.wicket.protocol.**http.AjaxEnclosureListener#**
>> onBeforeRespond
>> inside AjaxRequestHandler and work with the modifiable map
>>
>> I like the first one better but the listeners were working with
>> non-modifiable map since their day one.
>>
>> Do you have better solutions ?
>>
>> https://issues.apache.org/**jira/browse/WICKET-5302<https://issues.apache.org/jira/browse/WICKET-5302>
>>
>>
>

Reply via email to