MarkupFragmentFinder fails on transparent resolvers within Repeaters
--------------------------------------------------------------------

                 Key: WICKET-1560
                 URL: https://issues.apache.org/jira/browse/WICKET-1560
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.3
         Environment: Any
            Reporter: Jan Kriesten
            Priority: Critical
             Fix For: 1.3.4


I extended the AjaxDataTable to be able to add Rows to certain states of the 
rows. However, MarkupFragmentFinder fails to resolve the code under this 
condition since it compares with the wrong components in this case:

Markup:

<wicket:container wicket:id="rows">
  <tr wicket:id="row"><td wicket:id="cells"><span 
wicket:id="cell">[cell]</span></td></tr>
  <tr wicket:id="action-row" class="actionRow"></tr>
</wicket:container>

'row' is the transparent resolver in this case to maintain the hierarchy needed 
by the DataTable. MarkupFragmentFinder fails in the case of adding a cell to an 
AjaxRequestTarget. 

Fix:

Everything works as expected, when MarkupFragmentFinder checks for the parent 
being an AbstractRepeater and in the case compares the parent.id with the 
supplied id (code provided by Gerolf):

if (elem instanceof ComponentTag)
{
  ComponentTag tag = (ComponentTag)elem;
  String id = tag.getId();
  if ((id != null) && id.equals(component.getId()))
  {
    // Ok, found it
    return markupStream;
  }
  else   
  {   
    Component parent = component.getParent();   
    if (parent instanceof AbstractRepeater && id != null && 
id.equals(parent.getId()))   
    {   
      return markupStream;   
    }   
  }
}



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

Reply via email to