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

Allow markup to find child fragments when wicket:child is inside a component tag

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 6.15.0
    • 6.16.0, 7.0.0-M2
    • wicket
    • None

    Description

      Sometimes we put <wicket:child/> inside the body of a component tag. This when we must surround the body of the subclass (ie. between <wicket:extend>) with some component or attribute modifier.

      In the interests of separation of concerns, we must allow the subclass to continue working as though there were no Component surrounding its body. We should not require the subclass to start worrying about the exact implementation of the super class.

      We achieve this by making the component surrounding the subclass body transparent, allowing the subclass to use add() directly as per usual.

      However, sometimes this causes problems. When rendering a component inside the transparent component surrounding the subclass body during an Ajax response, the markup for the component being rendered cannot be found, as described in WICKET-5569.

      Also, fragments inside the <wicket:extend> of the subclass cannot be found for similar reasons, with no work around.

      These problems arise from the implementation of Markup#find() and MarkupFragment#find(). Both, when they encounter a component tag, skip to the closing tag for the component tag. This is because we do not want to find grandchildren in the markup hierarchy, only direct children.

      However, this is not always the correct behavior, because children can be top level component tags, as well as component tags which are direct children of <wicket:extend>, however deep in the hierarchy <wicket:extend> happens to be.

      We should therefore change Markup#find() and MarkupFragment#find() to also find component tags which are the direct children of <wicket:extend>.

      Attachments

        1. WICKET-5580.patch
          21 kB
          Jesse Long
        2. WICKET-5580-2.patch
          21 kB
          Jesse Long

        Issue Links

          Activity

            People

              mgrigorov Martin Tzvetanov Grigorov
              jesselong Jesse Long
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: