You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Jacob Brookover (JIRA)" <ji...@apache.org> on 2010/12/04 15:04:11 UTC
[jira] Created: (WICKET-3229) Removing Child in IVisitor affects
traversal
Removing Child in IVisitor affects traversal
--------------------------------------------
Key: WICKET-3229
URL: https://issues.apache.org/jira/browse/WICKET-3229
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 1.4.12
Reporter: Jacob Brookover
Priority: Minor
Created a Panel that provides it's own dynamically created markup stream, scans that stream for wicket:ids, and adds different components based on the id. Recently, I've been wanting to redraw this panel via AJAX, changing the markup and adding and removing child components accordingly.
I tried to remove multiple stale components (e.g. a component that was generated from the previous markup but doesn't exist in the new markup) using an IVisitor..
visitChildren(new IVisitor<Component>() {
public Object component(Component component) {
if (/* component is stale */)
component.remove();
return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
}
The IVisitor just does a simple run through an array and removing the component adjusted the size/count of the array, messing up the traversal and preventing other components from being removed.
Potential Solutions:
1. Throw an exception if the hierarchy is modified in an IVisitor.
2. Use another means of traversing the children that allows addition/removal and still ensures visiting all the children.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (WICKET-3229) Removing Child in IVisitor affects
traversal
Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Juergen Donnerstag resolved WICKET-3229.
----------------------------------------
Resolution: Fixed
Fix Version/s: 1.5-M4
1.4.15
> Removing Child in IVisitor affects traversal
> --------------------------------------------
>
> Key: WICKET-3229
> URL: https://issues.apache.org/jira/browse/WICKET-3229
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4.12
> Reporter: Jacob Brookover
> Priority: Minor
> Fix For: 1.4.15, 1.5-M4
>
> Attachments: WICKET-3229.patch
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> Created a Panel that provides it's own dynamically created markup stream, scans that stream for wicket:ids, and adds different components based on the id. Recently, I've been wanting to redraw this panel via AJAX, changing the markup and adding and removing child components accordingly.
> I tried to remove multiple stale components (e.g. a component that was generated from the previous markup but doesn't exist in the new markup) using an IVisitor..
> visitChildren(new IVisitor<Component>() {
> public Object component(Component component) {
> if (/* component is stale */)
> component.remove();
> return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
> }
> The IVisitor just does a simple run through an array and removing the component adjusted the size/count of the array, messing up the traversal and preventing other components from being removed.
> Potential Solutions:
> 1. Throw an exception if the hierarchy is modified in an IVisitor.
> 2. Use another means of traversing the children that allows addition/removal and still ensures visiting all the children.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-3229) Removing Child in IVisitor affects
traversal
Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12970589#action_12970589 ]
Juergen Donnerstag commented on WICKET-3229:
--------------------------------------------
added a comment to the javadoc (1.5)
> Removing Child in IVisitor affects traversal
> --------------------------------------------
>
> Key: WICKET-3229
> URL: https://issues.apache.org/jira/browse/WICKET-3229
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4.12
> Reporter: Jacob Brookover
> Priority: Minor
> Attachments: WICKET-3229.patch
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> Created a Panel that provides it's own dynamically created markup stream, scans that stream for wicket:ids, and adds different components based on the id. Recently, I've been wanting to redraw this panel via AJAX, changing the markup and adding and removing child components accordingly.
> I tried to remove multiple stale components (e.g. a component that was generated from the previous markup but doesn't exist in the new markup) using an IVisitor..
> visitChildren(new IVisitor<Component>() {
> public Object component(Component component) {
> if (/* component is stale */)
> component.remove();
> return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
> }
> The IVisitor just does a simple run through an array and removing the component adjusted the size/count of the array, messing up the traversal and preventing other components from being removed.
> Potential Solutions:
> 1. Throw an exception if the hierarchy is modified in an IVisitor.
> 2. Use another means of traversing the children that allows addition/removal and still ensures visiting all the children.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-3229) Removing Child in IVisitor affects
traversal
Posted by "Hudson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12970673#action_12970673 ]
Hudson commented on WICKET-3229:
--------------------------------
Integrated in Apache Wicket 1.4.x #322 (See [https://hudson.apache.org/hudson/job/Apache%20Wicket%201.4.x/322/])
> Removing Child in IVisitor affects traversal
> --------------------------------------------
>
> Key: WICKET-3229
> URL: https://issues.apache.org/jira/browse/WICKET-3229
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4.12
> Reporter: Jacob Brookover
> Priority: Minor
> Fix For: 1.4.15, 1.5-M4
>
> Attachments: WICKET-3229.patch
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> Created a Panel that provides it's own dynamically created markup stream, scans that stream for wicket:ids, and adds different components based on the id. Recently, I've been wanting to redraw this panel via AJAX, changing the markup and adding and removing child components accordingly.
> I tried to remove multiple stale components (e.g. a component that was generated from the previous markup but doesn't exist in the new markup) using an IVisitor..
> visitChildren(new IVisitor<Component>() {
> public Object component(Component component) {
> if (/* component is stale */)
> component.remove();
> return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
> }
> The IVisitor just does a simple run through an array and removing the component adjusted the size/count of the array, messing up the traversal and preventing other components from being removed.
> Potential Solutions:
> 1. Throw an exception if the hierarchy is modified in an IVisitor.
> 2. Use another means of traversing the children that allows addition/removal and still ensures visiting all the children.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WICKET-3229) Removing Child in IVisitor affects
traversal
Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Grigorov updated WICKET-3229:
------------------------------------
Attachment: WICKET-3229.patch
Here is an idea for Wicket 1.5.
RemovingVisit code can be merged in Visit, but adding #remove() in IVisit doesn't look nice...
> Removing Child in IVisitor affects traversal
> --------------------------------------------
>
> Key: WICKET-3229
> URL: https://issues.apache.org/jira/browse/WICKET-3229
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4.12
> Reporter: Jacob Brookover
> Priority: Minor
> Attachments: WICKET-3229.patch
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> Created a Panel that provides it's own dynamically created markup stream, scans that stream for wicket:ids, and adds different components based on the id. Recently, I've been wanting to redraw this panel via AJAX, changing the markup and adding and removing child components accordingly.
> I tried to remove multiple stale components (e.g. a component that was generated from the previous markup but doesn't exist in the new markup) using an IVisitor..
> visitChildren(new IVisitor<Component>() {
> public Object component(Component component) {
> if (/* component is stale */)
> component.remove();
> return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
> }
> The IVisitor just does a simple run through an array and removing the component adjusted the size/count of the array, messing up the traversal and preventing other components from being removed.
> Potential Solutions:
> 1. Throw an exception if the hierarchy is modified in an IVisitor.
> 2. Use another means of traversing the children that allows addition/removal and still ensures visiting all the children.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-3229) Removing Child in IVisitor affects
traversal
Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966951#action_12966951 ]
Igor Vaynberg commented on WICKET-3229:
---------------------------------------
i think i would rather throw concurrentmodificationexception on add/remove. but honestly, this comes up so rarely that i think a javadoc note is enough.
> Removing Child in IVisitor affects traversal
> --------------------------------------------
>
> Key: WICKET-3229
> URL: https://issues.apache.org/jira/browse/WICKET-3229
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4.12
> Reporter: Jacob Brookover
> Priority: Minor
> Attachments: WICKET-3229.patch
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> Created a Panel that provides it's own dynamically created markup stream, scans that stream for wicket:ids, and adds different components based on the id. Recently, I've been wanting to redraw this panel via AJAX, changing the markup and adding and removing child components accordingly.
> I tried to remove multiple stale components (e.g. a component that was generated from the previous markup but doesn't exist in the new markup) using an IVisitor..
> visitChildren(new IVisitor<Component>() {
> public Object component(Component component) {
> if (/* component is stale */)
> component.remove();
> return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
> }
> The IVisitor just does a simple run through an array and removing the component adjusted the size/count of the array, messing up the traversal and preventing other components from being removed.
> Potential Solutions:
> 1. Throw an exception if the hierarchy is modified in an IVisitor.
> 2. Use another means of traversing the children that allows addition/removal and still ensures visiting all the children.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.