Wicket
  1. Wicket
  2. WICKET-3947

Inline Enclosure does not work properly when using wicket:extend and wicket:child

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.5-RC5.1
    • Fix Version/s: None
    • Component/s: wicket
    • Labels:

      Description

      When using Inline Enclosures describes in https://issues.apache.org/jira/browse/WICKET-3422 the functionality is broken in a page that uses wicket:extend and wicket:child.

      1. variation.zip
        29 kB
        Krys Malak
      2. karsinta.zip
        15 kB
        Tapio Grönfors
      3. Wicket-3947-1.4.x.patch
        2 kB
        Arni Kekoni
      4. Patch for WICKET-3947.patch
        932 kB
        Veikko Törmänen

        Issue Links

          Activity

          Martin Grigorov made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Duplicate [ 3 ]
          Martin Grigorov made changes -
          Link This issue duplicates WICKET-4874 [ WICKET-4874 ]
          Martin Grigorov made changes -
          Link This issue is related to WICKET-4874 [ WICKET-4874 ]
          Show
          Martin Grigorov added a comment - See a good (imo) workaround explained at: https://issues.apache.org/jira/browse/WICKET-4874?focusedCommentId=13506458&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13506458 .
          Veikko Törmänen made changes -
          Attachment Patch for WICKET-3947.patch [ 12543475 ]
          Veikko Törmänen made changes -
          Attachment Patch for WICKET-3947.patch [ 12543470 ]
          Veikko Törmänen made changes -
          Attachment Patch for WICKET-3947.patch [ 12543470 ]
          Hide
          Veikko Törmänen added a comment -

          Improved patch for WICKET-3947 and WICKET-4700

          Show
          Veikko Törmänen added a comment - Improved patch for WICKET-3947 and WICKET-4700
          Veikko Törmänen made changes -
          Attachment Improved patch for Wicket-1.4.x.zip [ 12541720 ]
          Veikko Törmänen made changes -
          Attachment Improved patch for Wicket-1.4.x.zip [ 12541720 ]
          Hide
          Veikko Törmänen added a comment -

          Improved patch for 1.4.x

          I have an improved patch for this bug.
          This patch also fixes https://issues.apache.org/jira/browse/WICKET-4700.

          This patch causes three of the junit tests fail but I'm working on them.

          Show
          Veikko Törmänen added a comment - Improved patch for 1.4.x I have an improved patch for this bug. This patch also fixes https://issues.apache.org/jira/browse/WICKET-4700 . This patch causes three of the junit tests fail but I'm working on them.
          Arni Kekoni made changes -
          Attachment Wicket-3947-1.4.x.patch [ 12515580 ]
          Hide
          Arni Kekoni added a comment -

          Patch for 1.4.x

          JUnit tests attached to this issue are all green with this patch. Fix is not the most elegant one, but should give some insight on to the actual problem.

          As stated before there is no easy (and good) solution for this issue. InlineEnclosure is an auto component and can therefore reside under other auto components in markup tree. These auto components are removed during detach and while InlineEnclosure is not (as a special case) it is left without a parent.

          This patch simply reparents the inline enclosure to the first non transparent resolver it can find in the component tree. Algorithm is exactly the same as can be found in Enclosure class.

          Comments?

          Show
          Arni Kekoni added a comment - Patch for 1.4.x JUnit tests attached to this issue are all green with this patch. Fix is not the most elegant one, but should give some insight on to the actual problem. As stated before there is no easy (and good) solution for this issue. InlineEnclosure is an auto component and can therefore reside under other auto components in markup tree. These auto components are removed during detach and while InlineEnclosure is not (as a special case) it is left without a parent. This patch simply reparents the inline enclosure to the first non transparent resolver it can find in the component tree. Algorithm is exactly the same as can be found in Enclosure class. Comments?
          Tapio Grönfors made changes -
          Attachment karsinta.zip [ 12513605 ]
          Hide
          Tapio Grönfors added a comment -

          Like 'variation.zip' but for wicket 1.4.19 (instead of 1.5.x) and added example how below mentioned workaround is used. Also some junit test added.

          Show
          Tapio Grönfors added a comment - Like 'variation.zip' but for wicket 1.4.19 (instead of 1.5.x) and added example how below mentioned workaround is used. Also some junit test added.
          Martin Grigorov made changes -
          Link This issue relates to WICKET-4172 [ WICKET-4172 ]
          Martin Grigorov made changes -
          Link This issue relates to WICKET-4172 [ WICKET-4172 ]
          Hide
          Martin Grigorov added a comment -

          @Juergen & Igor: I see no good fix for this at the moment. Maybe the workaround should be used until we rework the auto components in 1.6/2.0 ?

          Show
          Martin Grigorov added a comment - @Juergen & Igor: I see no good fix for this at the moment. Maybe the workaround should be used until we rework the auto components in 1.6/2.0 ?
          Hide
          Martin Grigorov added a comment - - edited

          The problem is that InlineEnclosure is direct child of the auto-component for <wicket:extend> and thus later org.apache.wicket.protocol.http.AjaxEnclosureListener.onBeforeRespond(Map<String, Component>, AjaxRequestTarget) cannot find the InlineEnclosure to update its visibility.

          A workaround until this is fixed is to wrap the enclosure in a dummy (non-auto) component.
          in .java:
          WebMarkupContainer dummy = new WebMarkupContainer("wrapper");
          add(dummy);
          dummy.add(label1);

          in .html:
          <div wicket:id="wrapper">
          <div wicket:enclosure="controllingChild">
          The visibility of this text is also toggled.
          <div wicket:id="controllingChild">Test</div>
          </div>
          </div>

          Show
          Martin Grigorov added a comment - - edited The problem is that InlineEnclosure is direct child of the auto-component for <wicket:extend> and thus later org.apache.wicket.protocol.http.AjaxEnclosureListener.onBeforeRespond(Map<String, Component>, AjaxRequestTarget) cannot find the InlineEnclosure to update its visibility. A workaround until this is fixed is to wrap the enclosure in a dummy (non-auto) component. in .java: WebMarkupContainer dummy = new WebMarkupContainer("wrapper"); add(dummy); dummy.add(label1); in .html: <div wicket:id="wrapper"> <div wicket:enclosure="controllingChild"> The visibility of this text is also toggled. <div wicket:id="controllingChild">Test</div> </div> </div>
          Krys Malak made changes -
          Attachment variation.zip [ 12489324 ]
          Hide
          Krys Malak added a comment -

          A quickstart containing both a working (without extension) and non-working version.

          Show
          Krys Malak added a comment - A quickstart containing both a working (without extension) and non-working version.
          Krys Malak made changes -
          Field Original Value New Value
          Link This issue relates to WICKET-3422 [ WICKET-3422 ]
          Krys Malak created issue -

            People

            • Assignee:
              Unassigned
              Reporter:
              Krys Malak
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development