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

versionManager in class Page is null when toggling visibility for a component using ajax

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 2.0 branch (discontinued)
    • 2.0 branch (discontinued)
    • wicket
    • None
    • Both IE and Firefox

    Description

      Here is a simple example that demonstrates the issue:
      public BasePage() {
      final WebMarkupContainer table = new WebMarkupContainer(this, "tableId");
      table.setOutputMarkupId(true);
      final Label label = new Label(table, "labelId", "This is a label");
      label.setOutputMarkupId(true);
      label.setVisible(false);

      new AjaxFallbackLink(this, "linkId") {
      private static final long serialVersionUID = 5523627214368899839L;
      @Override
      public void onClick(AjaxRequestTarget target)

      { final boolean visible = label.isVisible(); label.setVisible(!visible); target.addComponent(table); }

      };
      }

      What happens is that I'd like to show and hide a label by switching between setVisible(true) and setVisible(false) when clicking on a AjaxFallbackLink. I've wrapped the label inside a WebMarkupContainer to make this doable. When I click on the AjaxFallbackLink the first time everything is fine, the label (with wicket id "labelId") gets visible. But when I click the link again to make it invisible, I get a NullPointerException when executing label.setVisible(..). Debugging down into the wicket source code tells me that the NullPointerException occurs on line 327 in class Page, when it tries to execute "versionManager.componentStateChanging(change)". However versionManager is null. I get the same error when I run the AjaxMouseEventPage example from wicket-examples. First time I click or move the mouse over one of the boxes in the example everything is fine, but once I do it again the NullPointerException is thrown at the exact same location as in the "visibility" example above.

      Attachments

        Activity

          People

            jcompagner Johan Compagner
            johanhaleby Johan Haleby
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: