I am trying to create a modal window for my application, but unfortunately I am unable to do so.
I have a page that extends WebPage and I have added a panel that extends Panel to it. The page and panel are written separately; that is, in panel.java and page.java. Now, I have added a modal window to the panel with the help of this Wicket Examples example (source). But when the page renders, I am seeing — by inspecting element of that page — that the div with wicket:id of “modal1” has attribute script="display: none". I don’t know what to do. Any information will be very helpful to me.
One more thing: are
return new ModalContent1Page(ModalWindowPage.this.getPageReference(), modal1);
and
return new ModalContent1Page(ModalWindowPage.this, modal1);
the same?
Edit:
The problem is solved. Actually when I asked the question I did not have the code then. I was following the tutorial of RoseIndia, but I was unsuccessful and as I am using wicket 1.3.1 the PageReference class is not available there. So I solve it as:
final ModalWindow modalWindow;
add(modalWindow = new ModalWindow("modalVideo"));
modalWindow.setCookieName("modal-video");
modalWindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
modalWindow.setResizable(false);
modalWindow.setInitialHeight(215);
modalWindow.setInitialWidth(215);
modalWindow.setHeightUnit("px");
modalWindow.setPageCreator(new ModalWindow.PageCreator() {
public Page createPage() {
return new PlayVideo(ItemViewPanel.this.getPage(), modalWindow, itemId);
}
});
AjaxLink showModalLink;
add(showModalLink = new AjaxLink("showModal") {
@Override
public void onClick(AjaxRequestTarget target) {
modalWindow.show(target);
}
});
Thank you.
To answer your second question: no, those two lines of code are not the same.
ModalWindowPage.thisis the page itself, so its type isModalWindowPage.getPageReference(), on the other hand, returns aPageReference, which is not in the same hierarchy.