Wicket
  1. Wicket
  2. WICKET-1134

Multiple abstract/implement tags instead of child/extend

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.3.0-rc1
    • Fix Version/s: 1.5-M2.1
    • Component/s: wicket
    • Labels:
      None

      Description

      The current implementation of wicket:child and wicket:extend only allows for a single extension per subpage. However, this restriction is neither mandated by java class hierarchy nor by any other reason. Therefore, it should be possible to extend the current implementation to support multiple 'abstract' sections, just like abstract methods in java classes. This could be done by replacing

      <wicket:child>
      <wicket:extend>
      some content
      </wicket:extend>
      </wicket:child>

      with

      <wicket:abstract id="foo">
      <wicket:implement id="foo">
      some content
      </wicket:extend>
      </wicket:child>

      (new names have been suggested in http://www.nabble.com/Multiple-%3Cwicket%3Achild--%3E-tags-on-a-single-base-page--tf4738673.html)

      A possible application is a layout with two columns, e.g. a header with navigation, a left column with sub-navigation and a right column with content (where the sub-navigation may change depending on the section. In deed, this is already possible using panels or similar means. However, it would allow to take advantage of markup inheritance only:

      BasePage extens WebPage:
      <div wicket:id="links>[some nav links here]</div>
      <div><wicket:abstract id="subNavigation">[left navigation goes here]</wicket:abstract></div>
      <div><wicket:abstract id="content">[content goes here]</wicket:abstract</div>

      SectionPage extends BasePage:
      <wicket:implement id="subNavigation">[sub navigation links here]</wicket:implement>

      FooPage extends SectionPage:
      <wicket:implement id="content">[content goes here]</wicket:implement>

      1. wicket-1134.patch
        21 kB
        Juergen Donnerstag
      2. wicket-abstract-implement.patch
        29 kB
        Stefan Fussenegger

        Activity

        Igor Vaynberg made changes -
        Fix Version/s 1.5-M2.1 [ 12315331 ]
        Fix Version/s 1.5-M2 [ 12315237 ]
        Igor Vaynberg made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Won't Fix [ 2 ]
        Igor Vaynberg made changes -
        Status In Progress [ 3 ] Open [ 1 ]
        Igor Vaynberg made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Igor Vaynberg made changes -
        Assignee Johan Compagner [ jcompagner ] Igor Vaynberg [ ivaynberg ]
        Igor Vaynberg made changes -
        Fix Version/s 1.5-M2 [ 12315237 ]
        Fix Version/s 1.5-M1 [ 12313078 ]
        Juergen Donnerstag made changes -
        Attachment wicket-1134.patch [ 12397074 ]
        Johan Compagner made changes -
        Fix Version/s 1.5-M1 [ 12313078 ]
        Fix Version/s 1.4-M1 [ 12312523 ]
        Johan Compagner made changes -
        Assignee Johan Compagner [ jcompagner ]
        Johan Compagner made changes -
        Fix Version/s 1.4.0-alpha [ 12312523 ]
        Affects Version/s 1.3.0-rc1 [ 12312818 ]
        Stefan Fussenegger made changes -
        Description The current implementation of wicket:child and wicket:extend only allows for a single extension per subpage. However, this restriction is neither mandated by java class hierarchy nor by any other reason. Therefore, it should be possible to extend the current implementation to support multiple 'abstract' sections, just like abstract methods in java classes. This could be done by replacing

        <wicket:child>
          <wicket:extend>
            some content
          </wicket:extend>
        </wicket:child>

        with

        <wicket:abstract id="foo">
          <wicket:implement id="foo">
            some content
          </wicket:extend>
        </wicket:child>

        (new names have been suggested in http://www.nabble.com/Multiple-%3Cwicket%3Achild--%3E-tags-on-a-single-base-page--tf4738673.html)

        A possible application is a layout with two columns, e.g. a header with navigation, a left column with sub-navigation and a right column with content (where the sub-navigation may change depending on the section. In deed, this is already possible using panels or similar means. However, it would allow to take advantage of markup inheritance only:

        BasePage extens WebPage:
        <div wicket:id="links>[some nav links here]</div>
        <div><wicket:abstract id="subNavigation">[left navigation goes here]</wicket:abstract></div>
        <div><wicket:abstract id="content">[content goes here]</wicket:abstract</div>

        SectionPage extends BasePage:
        <wicket:implement id="subNavigation">[sub navigation links here]</wicket:implement>

        FooPage extends SectionPage:
        <wicket:implement id="content">[content goes here]</wicket:implement>

        -- stefan
        The current implementation of wicket:child and wicket:extend only allows for a single extension per subpage. However, this restriction is neither mandated by java class hierarchy nor by any other reason. Therefore, it should be possible to extend the current implementation to support multiple 'abstract' sections, just like abstract methods in java classes. This could be done by replacing

        <wicket:child>
          <wicket:extend>
            some content
          </wicket:extend>
        </wicket:child>

        with

        <wicket:abstract id="foo">
          <wicket:implement id="foo">
            some content
          </wicket:extend>
        </wicket:child>

        (new names have been suggested in http://www.nabble.com/Multiple-%3Cwicket%3Achild--%3E-tags-on-a-single-base-page--tf4738673.html)

        A possible application is a layout with two columns, e.g. a header with navigation, a left column with sub-navigation and a right column with content (where the sub-navigation may change depending on the section. In deed, this is already possible using panels or similar means. However, it would allow to take advantage of markup inheritance only:

        BasePage extens WebPage:
        <div wicket:id="links>[some nav links here]</div>
        <div><wicket:abstract id="subNavigation">[left navigation goes here]</wicket:abstract></div>
        <div><wicket:abstract id="content">[content goes here]</wicket:abstract</div>

        SectionPage extends BasePage:
        <wicket:implement id="subNavigation">[sub navigation links here]</wicket:implement>

        FooPage extends SectionPage:
        <wicket:implement id="content">[content goes here]</wicket:implement>
        Stefan Fussenegger made changes -
        Field Original Value New Value
        Attachment wicket-abstract-implement.patch [ 12369036 ]
        Stefan Fussenegger created issue -

          People

          • Assignee:
            Igor Vaynberg
            Reporter:
            Stefan Fussenegger
          • Votes:
            7 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development