Ok here goes. This is my first ever wicket application and I'm trying to integrate icepush using the pushpanel example.
What I'm trying to do is push an update to the panel by calling an 'updatePanel(String content)' method from another class.
Here is the code.
In my extended PushPanel I have:
public AsyncCommsPanel(String id) {
super(id);
this.setOutputMarkupId(true);
ajaxForm = new Form("ajaxForm");
ajaxForm.setOutputMarkupId(true);
ajaxForm.add(textStore = new Label("textStore",""));
ajaxForm.add(new AjaxButton("updateButton") {
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
System.out.println("Update button pressed!");
/* CODE TO PULL NEW DATA FROM ELSEWHERE */
/* UPDATE TAKES TIME SO HAS ITS OWN CALLBACK */
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
System.out.println("Update button error.");
}
});
add(ajaxForm);
}
@Override
protected void pushCallback(AjaxRequestTarget target) {
target.add(ajaxForm);
}
public void updatePanel(String updateString) {
/* THIS METHOD SHOULD ALLOW THE PANEL TO BE UPDATED FROM ELSEWHERE */
if (textStore != null) ajaxForm.remove(textStore);
ajaxForm.add(textStore = new Label("textStore", updateString));
push();
}
When I try to call the 'updatePanel' method from the data gatherer's callback method, I get this exception:
ERROR (SelectorManager.run): org.apache.wicket.WicketRuntimeException: No RequestCycle is currently set!
at org.apache.wicket.Component.getRequest(Component.java:1831)
at org.apache.wicket.markup.html.WebPage.dirty(WebPage.java:315)
at org.apache.wicket.Page.dirty(Page.java:288)
at org.apache.wicket.Page.componentRemoved(Page.java:948)
at org.apache.wicket.MarkupContainer.removedComponent(MarkupContainer.java:1422)
at org.apache.wicket.MarkupContainer.remove(MarkupContainer.java:612)
at uk.ac.warwick.collabtex.AsyncCommsPanel.updatePanel(AsyncCommsPanel.java:107)
at uk.ac.warwick.collabtex.Editor$1.updateSuccess(Editor.java:98)