Search in sources :

Example 1 with OpenLayersJavascript

use of au.org.emii.portal.javascript.OpenLayersJavascript in project spatial-portal by AtlasOfLivingAustralia.

the class SessionInitImpl method init.

@Override
public void init(Desktop desktop, Object request) throws Exception {
    LOGGER.debug("* INIT Desktop");
    Session session = desktop.getSession();
    if (session == null) {
        LOGGER.debug("user has a null session - no idea why (system coming up/going down - " + "concurrency ?) will redirect to error page");
        redirectAndInvalidateSession(desktop.getSession(), ERROR_PAGE);
    } else {
        // user has a session...
        // Sesssion is OK - do things we want to do before we start
        // composing the page
        PortalSession portalSession = (PortalSession) session.getAttribute(PORTAL_SESSION_ATTRIBUTE);
        if (portalSession == null) {
            init(session, null);
            portalSession = (PortalSession) session.getAttribute(PORTAL_SESSION_ATTRIBUTE);
        }
        PortalSessionUtilities portalSessionUtilities = getPortalSessionUtilities(session);
        OpenLayersJavascript openLayersJavascript = getApplicationContext(session).getBean(OpenLayersJavascript.class);
        String script = openLayersJavascript.initialiseMap(portalSessionUtilities.getCurrentBoundingBox(portalSession)) + openLayersJavascript.getIFrameReferences() + openLayersJavascript.setBaseLayer(portalSession.getBaseLayer()) + openLayersJavascript.activateMapLayers(portalSession.getActiveLayers());
        // remove all whitespace
        script = openLayersJavascript.minify(script);
        portalSession.setOnIframeMapFullyLoaded(script);
        LOGGER.debug("onIframeMapFullyLoaded set to: " + script);
    }
    LOGGER.debug("...session init complete");
}
Also used : OpenLayersJavascript(au.org.emii.portal.javascript.OpenLayersJavascript) PortalSession(au.org.emii.portal.session.PortalSession) PortalSessionUtilities(au.org.emii.portal.util.PortalSessionUtilities) HttpSession(javax.servlet.http.HttpSession) PortalSession(au.org.emii.portal.session.PortalSession) Session(org.zkoss.zk.ui.Session)

Aggregations

OpenLayersJavascript (au.org.emii.portal.javascript.OpenLayersJavascript)1 PortalSession (au.org.emii.portal.session.PortalSession)1 PortalSessionUtilities (au.org.emii.portal.util.PortalSessionUtilities)1 HttpSession (javax.servlet.http.HttpSession)1 Session (org.zkoss.zk.ui.Session)1