com.databasesandlife.util.wicket.OverlayIframeCloser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-common Show documentation
Show all versions of java-common Show documentation
Utility classes developed at Adrian Smith Software (A.S.S.)
package com.databasesandlife.util.wicket;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.link.Link;
/**
* Breaks out of an iframe JQuery overlay ("colorbox" or "fancybox"), and redirects the main browser window to a destination page.
*
* If the iframe is on the same domain as the parent then specify {@link DomainSimilarity#SameDomain} and the overlay is closed first (it looks nice),
* otherwise specify {@link DomainSimilarity#DifferentDomain} and it isn't (as the browser won't allow it due to cross-domain concerns.)
*
* Usage:
*
* Link<?> linkToResult = new BookmarkablePageLink("link", ...);
* setResponsePage(new OverlayIframeCloser(
* DomainSimilarity.SameDomain, linkToResult));
*
*
* @author This source is copyright Adrian Smith and licensed under the LGPL 3.
* @see Project on GitHub
*/
@SuppressWarnings("serial")
public class OverlayIframeCloser extends WebPage {
public enum DomainSimilarity { SameDomain, DifferentDomain }
/** @param destinationPage wicket id of this link should be "link" */
public OverlayIframeCloser(DomainSimilarity domainSimilarity, Link> destinationPage) {
add(destinationPage);
add(new WebMarkupContainer("closeOverlayScript").setVisible(domainSimilarity == DomainSimilarity.SameDomain));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy