Well I was adding this behaviour in the constructor of the Panel, i.e. 

this.add(new AjaxSelfUpdatingBehaviour(...));

which I assumed resulted in the same effect.

I have just changed it to the following (see below) and now get a null
pointer when the behaviour tries to update the panel after I switch to
another one, i.e. when the panel is no longer visible.

Note, I am storing the panels in a List (tabsList) to prevent them being
recreated every time a user switches tabs.  I did this to preserve the
state.  Perhaps this is causing some problems.

So to recap, this now throws a null pointer (at
org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:96)
presumably because the panel isn't in the markup to update.

tabs.add(new AbstractTab(new Model("Administration")) {
  public Panel getPanel(String panelId) {
    if (tabsList.containsKey("Administration")) {
      return tabsList.get("Administration");
    }
    else {
      AdminPanel adminPanel = new AdminPanel(panelId);
      adminPanel.setOutputMarkupPlaceholderTag(true);
      adminPanel.add(new
AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));
      tabsList.put("Administration", adminPanel);
      return adminPanel;
    }
  }
});



igor.vaynberg wrote:
> 
> cant you add the behavior directly to the panel?
> 
> -igor
> 

-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-restart-an-AjaxSelfUpdatingBehaviour-after-it-has-been-stopped--tp24626909p24627960.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to