All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.databasesandlife.util.wicket.OverlayIframeCloser Maven / Gradle / Ivy

There is a newer version: 21.0.1
Show newest version
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