Hey all, 

Interesting thing I encountered today.  I have a Panel that provides it's
own markupstream that is dynamically created from XML/XSLT.  Essentially, it
scans the markup stream for wicket:ids and then calls a
getWicketComponent(String wicketId) that generates different components
based on the id prefix (e.g. wicket:id="addContentBar_3").  Recently, I've
been wanting to redraw this panel via AJAX, changing the markup and adding
and removing child components accordingly.

Haven't had much trouble up to this point until 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).  I tried to use an IVisitor..

visitChildren(new IVisitor<Component>() {
  public Object component(Component component) {
    if (/* component is stale */)

I discovered that 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.

I've solved this by just keeping a list of stale components and removing
them after the traversal, but it seems like their should either be
documentation/warnings about modifying the child list in a Visitor and/or a
change in the implementation to support this?  An iterator?  It's probably
rare enough that documentation would suffice :)

I'm just happy that Wicket has allowed me to do the niftiness I described
above :)

View this message in context: 
Sent from the Users forum mailing list archive at Nabble.com.

To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to