Hi. Im having a problem with the modalwindow again. It's probably my code so
I'll try to explain what I doing.

I have a Panel that I want to reuse. It's a panel with a form where you can
update som data. Because it will be used by different pages with Ajax
Behavior I want a to add 
a callback when the Panel form is commited.  

So the Panels form contains a AjaxButton where I can handle the onSubmit
method. The Panel is abstract with the abstract method
onFinished(AjaxRequestTarget target). 
Looks something like this:

public abstract class CallBackPanel extends Panel {
  public CallBackPanel(String id) {
    ...
    add(form);
    AjaxButton saveButton = new AjaxButton("savebutton", form) {
      //Also override onError
                        
                        @Override
                        protected void onSubmit(AjaxRequestTarget pTarget,
org.apache.wicket.markup.html.form.Form<?> pForm) {
                           ... 
                           onFinished(pTarget);
                        }
                        
    }
    form.add(saveButton);
    //also adds a cancel button 
    ...
  }

  protected abstract void onFinished(AjaxRequestTarget pTarget);
}

I got some problems with this Panel. If I add it as a Panel in a ModalWindow
with the setContent method the callback method 'onFinished' is able to
update the 
components in the page that use the it. 
But if I add the panel to a Page and then use the ModelWindow.setPageCreator
method the callback method 'onFinished' wont update the components. 
Ex (in my page that uses the CallBackPanel):

        ...
        public Page createPage() {
                                        ModalContentPage mcp = new 
ModalContentPage();
                                        mcp.add(new CallBackPanel("thepanel"){
                                            @Override
              protected void onFinished(AjaxRequestTarget pTarget){
                modalWindow.close(pTarget);
                pTarget.addComponent(myPageComponentThatNeedsUpdating);
//myPageComponentThatNeedsUpdating is set to final
              }
          );
                                        return mcp;
                                }
                                ...

The method inFinished is running but myPageComponentThatNeedsUpdating is not
updated. 

Should I avoid doing solution like abstract CallBackPanel when morking with
modalwindows?

Or is it something with the AjaxRequestTarget that I missed? 

Jens Alenius
-- 
View this message in context: 
http://www.nabble.com/Callbacks-with-abstract-method-in-ModalWindow-tp22349647p22349647.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to