THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
/** * @author Ernesto Reinaldo Barreiro */ public class OpenOnLoadModalWindow extends ModalWindow implements IHeaderContributor { private static final long serialVersionUID = 1L; /** * @param id */ public OpenOnLoadModalWindow(String id) { super(id); } /** * @param id * @param model */ public OpenOnLoadModalWindow(String id, IModel<?> model) { super(id, model); } /** * Adds the JavaScript to initially open modal window. */ public void renderHead(IHeaderResponse response) { response.renderOnDomReadyJavascript(getWindowOpenJavascript()); } /* * (non-Javadoc) * @see org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow#makeContentVisible() */ @Override protected boolean makeContentVisible() { return true; } } |
The trick boils down to doing do two things:
-Making sure the contents of the modal window are visible on initial rendering (makeContentVisible())
-Making sure the JavaScript opening the modal window is executed when page is loaded.
...