Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1560

MarkupFragmentFinder fails on transparent resolvers within Repeaters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 1.3.3, 1.4-M1
    • 1.3.4, 1.4-M2
    • wicket
    • None
    • Any

    Description

      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; }

      }
      }

      Attachments

        Activity

          People

            knopp Matej Knopp
            jkriesten Jan Kriesten
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: