core icon indicating copy to clipboard operation
core copied to clipboard

ModalX autoSize doesn't work the first time. Only the second time.

Open ghost opened this issue 8 years ago • 3 comments

I want to display a picture using a ModalX ModalContentPanel class. I added the setting "setAutoSize(true)" and "setUseInitialHeight(false)" to the ModalContentWindow class. When I click on the thumb of the photo it always shows up in a 200x200 window with scrollbars. When I close it and click on it again it appears in full size.

ghost avatar Oct 04 '15 10:10 ghost

@chrisco484 Ping!

martin-g avatar Oct 04 '15 10:10 martin-g

What version of Wicket are you using it with?


From: tpijl [mailto:[email protected]] Sent: Sunday, 4 October 2015 9:10 PM To: wicketstuff/core Subject: [core] ModalX autoSize doesn't work the first time. Only the second time. (#422)

I want to display a picture using a ModalX ModalContentPanel class. I added the setting "setAutoSize(true)" and "setUseInitialHeight(false)" to the ModalContentWindow class. When I click on the thumb of the photo it always shows up in a 200x200 window with scrollbars. When I close it and click on it again it appears

in full size.

Reply to this email directly or view it on GitHub https://github.com/wicketstuff/core/issues/422 . <https://github.com/notifications/beacon/AA6iP_2h4-rkN42ysvwJ0wO1nNAOH17 Oks5o4PJ0gaJpZM4GIkP3.gif>

chrisco484 avatar Oct 05 '15 19:10 chrisco484

I am using Wicket 7.1.0-SNAPSHOT with ModalX version 7.0.0, but it also act the same in 7.0.0. Here is the fragment where I activate the modal:

        AjaxLink thumbLink = new AjaxLink("thumblink") {
            /** The serialVersionUID. */
            private static final long serialVersionUID = 3196029341454979704L;

            @Override
            public void onClick(final AjaxRequestTarget target) {
                // popup content
                ModalContentWindow mcw = ((HomePage) getPage()).allocateContentWindow();
                PhotoPopupPanel popup = new PhotoPopupPanel(mcw, path + "_web.jpg");
                popup.setTitle(photoTitle);
                popup.show(target);
            }
        };

And here I create the ModalContentWindow:

    public ModalContentWindow allocateContentWindow() {
        ModalContentWindow mcw = this.allocateModalWindow();
        mcw.setUseInitialHeight(false);
        mcw.setAutoSize(true);
        mcw.setResizable(false);
        return mcw;
    }

The PhotoPopupPanel:

public class PhotoPopupPanel extends ModalContentPanel {

    /** The serialVersionUID. */
    private static final long serialVersionUID = -3900566859100449028L;

    public PhotoPopupPanel(final ModalContentWindow mcw, final String path) {
        super(mcw, null);
        this.setOutputMarkupId(true);
        Photo photo = new Photo("photo", path);
        add(photo);
    }
}

ghost avatar Oct 10 '15 09:10 ghost