Hi, 

I just tried it with the inter-component events, and it's the same problem
as with the abstract functions..

Please try my code:
HomePage:
public class HomePage extends WebPage {

    @Override
    public void onEvent(IEvent<?> event) {
        super.onEvent(event);
        if (event.getPayload() instanceof String){
            String value = (String)event.getPayload();
            System.out.println("setting pagevalue to [" + value + "]");
            ((MyBean)getDefaultModelObject()).setValue1(value);
        }
    }

    public HomePage (){
        MyBean myBean = new MyBean();
        myBean.setValue1("initial value");
        setDefaultModel(new Model<MyBean>(myBean));
        final ModalWindow window = new ModalWindow("window");
        window.setPageCreator(new ModalWindow.PageCreator() {
            public Page createPage() {
                return new ModalWindowPage(getPage());
            }
        });
        window.setWindowClosedCallback(new
ModalWindow.WindowClosedCallback() {
            public void onClose(AjaxRequestTarget target) {
                System.out.println("getting pageValue [" +
((MyBean)getDefaultModelObject()).getValue1() + "]");
            }
        });
        add(window);

        add(new AjaxLink("lnk") {
            @Override
            public void onClick(AjaxRequestTarget target) {
                window.show(target);
            }
        });  
    }

    public class MyBean implements Serializable {
        private String value1;

        /**
         * @return the value1
         */
        public String getValue1() {
            return value1;
        }

        /**
         * @param value1 the value1 to set
         */
        public void setValue1(String value1) {
            this.value1 = value1;
        }
    }
}


ModalWindowPage:
public class ModalWindowPage extends WebPage {
    public ModalWindowPage(final IEventSink eventSink){
        add(new AjaxLink("btn") {
            @Override
            public void onClick(AjaxRequestTarget target) {
                send(eventSink, Broadcast.EXACT, "ModalWindowPage value");
                ModalWindow.closeCurrent(target);
            }
        });
    }
}


Console output:
setting pagevalue 2 to [ModalWindowPage value]
getting pageValue [initial value]


Thanks a lot ! Marieke Vandamme

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-ModalWindow-with-page-abstract-functions-do-not-update-model-correct-tp3596526p3598621.html
Sent from the Users forum mailing list archive at Nabble.com.

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

Reply via email to