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

Create Fragment.getAssociatedMarkupId

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4.17
    • 1.4.19, 1.5-RC6
    • wicket

    Description

      Class org.apache.wicket.markup.html.panel.Fragment has two attributes: "associated markupId" and "markupProvider". One can reach "markupProvider" with "getMarkupProvider", but there's no way to reach "markupId" (not even extending Fragment, since the attribute is private). IMHO, two actions must be taken:

      1. rename this attribute to "associatedMarkupId", to prevent name clash from parent's "getMarkupId";
      2. create a "getAssociatedMarkupId"

      This is a must have for unit testing. Consider a classic "view/edit" pair of fragments (where "view" appears for guests and "edit" for admins). I could test if "view" is activated as simple as:

      tester.assertComponent("panel:grid", Fragment.class);
      assertEquals("view", ((Fragment) tester.getComponentFromLastRenderedPage("panel:grid")).getAssociatedMarkupId());

      Unfortunatelly, there's no way to get the associated markup id. This means this behavior is untestable!

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            m4c0 Eduardo Costa
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: