Example usage for org.apache.wicket Application get

List of usage examples for org.apache.wicket Application get

Introduction

In this page you can find the example usage for org.apache.wicket Application get.

Prototype

public static Application get() 

Source Link

Document

Get Application for current thread.

Usage

From source file:com.servoy.j2db.server.headlessclient.SessionClient.java

License:Open Source License

protected void unsetThreadLocals(IServiceProvider prev) {
    if (J2DBGlobals.getServiceProvider() != prev) {
        if (Application.exists() && Application.get() == wicket_app) {
            Application.unset();/*from   www.j a  v a  2  s. com*/
        }
        if (Session.exists() && Session.get() == wicket_session) {
            // make sure the 2 thread locals are just empty lists.
            Session.get().getDirtyObjectsList().clear();
            Session.get().getTouchedPages().clear();
            Session.unset();
        }
        J2DBGlobals.setServiceProvider(prev);
    }
}

From source file:com.servoy.j2db.server.headlessclient.WebClient.java

License:Open Source License

public void onBeginRequest(WebClientSession webClientSession) {
    Solution solution = getSolution();/*from   w  ww  .  j  a va 2s.c  o m*/
    if (solution != null) {
        synchronized (onBeginRequestLock) {
            long solutionLastModifiedTime = webClientSession.getSolutionLastModifiedTime(solution);
            if (solutionLastModifiedTime != -1 && solutionLastModifiedTime != solution.getLastModifiedTime()) {
                if (isClosing() || isShutDown()) {
                    if (((WebRequest) RequestCycle.get().getRequest()).isAjax())
                        throw new AbortException();
                    else
                        throw new RestartResponseException(Application.get().getHomePage());
                }
                refreshI18NMessages();
                ((IScriptSupport) getScriptEngine()).reload();
                ((WebFormManager) getFormManager()).reload();
                MainPage page = (MainPage) ((WebFormManager) getFormManager()).getMainContainer(null);
                throw new RestartResponseException(page);
            }
            executeEvents();
        }
    }
}

From source file:com.servoy.j2db.server.headlessclient.WebRuntimeWindow.java

License:Open Source License

@Override
protected void doOldShow(String formName, boolean closeAll, boolean legacyV3Behavior) {
    FormManager fm = (FormManager) getApplication().getFormManager();
    IMainContainer parentContainer = getParentContainerForShow(fm);
    IMainContainer dialogContainer = fm.getOrCreateMainContainer(windowName);

    //calling container can be set just after the creation of the container (needed for browser back button (wicket undo))
    ((MainPage) dialogContainer).setCallingContainerIfNull((MainPage) parentContainer);
    if (formName != null) {
        final FormController fp = fm.showFormInMainPanel(formName, dialogContainer, title,
                closeAll || !legacyV3Behavior, windowName);
        if (fp != null && fp.getName().equals(formName) && dialogContainer != parentContainer) {
            Rectangle r2;/*from  ww  w  .j  a v a 2s  .  c  om*/
            if (FormManager.FULL_SCREEN.equals(initialBounds)) {
                r2 = initialBounds;
            } else {
                r2 = getSizeAndLocation(initialBounds, dialogContainer, fp);
                if (Application.get().getDebugSettings().isAjaxDebugModeEnabled()) {
                    r2.height += 40;
                }
            }

            if (windowType == JSWindow.WINDOW) {
                ((MainPage) parentContainer).showPopupWindow((MainPage) dialogContainer, title, r2, resizable,
                        closeAll || !legacyV3Behavior);
            } else {
                ((MainPage) parentContainer).showPopupDiv((MainPage) dialogContainer, title, r2,
                        isUndecorated() ? false : resizable, closeAll || !legacyV3Behavior,
                        (windowType == JSWindow.MODAL_DIALOG), isUndecorated(), storeBounds, getOpacity(),
                        getTransparent());
            }
        }
    }
    if (getTitle() != null)
        setTitle(getTitle());

    if (windowType == JSWindow.MODAL_DIALOG && ((WebClient) getApplication()).getEventDispatcher() != null) {
        ((WebClient) getApplication()).getEventDispatcher().suspend(this);
    }
}

From source file:com.servoy.j2db.server.headlessclient.yui.YUILoader.java

License:Open Source License

public static void renderYUI(IHeaderResponse response) {
    if (Application.exists() && Application.get().getDebugSettings().isAjaxDebugModeEnabled()) {
        response.renderJavascriptReference(YUILoader.JS_YAHOO_DEBUG);
        response.renderJavascriptReference(YUILoader.JS_DOM_DEBUG);
        response.renderJavascriptReference(YUILoader.JS_EVENT_DEBUG);
    } else {//from  w  w w .j av  a 2 s  . c  o  m
        response.renderJavascriptReference(YUILoader.JS_YAHOO_DOM_EVENT);
    }
}

From source file:com.servoy.j2db.server.headlessclient.yui.YUILoader.java

License:Open Source License

public static void renderDragNDrop(IHeaderResponse response) {
    if (Application.exists() && Application.get().getDebugSettings().isAjaxDebugModeEnabled()) {
        response.renderJavascriptReference(YUILoader.JS_YAHOO_DEBUG);
        response.renderJavascriptReference(YUILoader.JS_DOM_DEBUG);
        response.renderJavascriptReference(YUILoader.JS_EVENT_DEBUG);
        response.renderJavascriptReference(YUILoader.JS_DRAGDROP_DEBUG);
    } else {//  ww  w. j av  a 2  s.  c o m
        response.renderJavascriptReference(YUILoader.JS_YAHOO_DOM_EVENT);
        response.renderJavascriptReference(YUILoader.JS_DRAGDROP);
    }
}

From source file:com.servoy.j2db.server.headlessclient.yui.YUILoader.java

License:Open Source License

public static void renderResize(IHeaderResponse response) {
    response.renderCSSReference(CSS_RESIZE);

    if (Application.exists() && Application.get().getDebugSettings().isAjaxDebugModeEnabled()) {
        response.renderJavascriptReference(YUILoader.JS_YAHOO_DEBUG);
        response.renderJavascriptReference(YUILoader.JS_DOM_DEBUG);
        response.renderJavascriptReference(YUILoader.JS_EVENT_DEBUG);
        response.renderJavascriptReference(YUILoader.JS_ELEMENT);
        response.renderJavascriptReference(YUILoader.JS_DRAGDROP_DEBUG);
        response.renderJavascriptReference(YUILoader.JS_RESIZE_DEBUG);
    } else {//from w ww  . j  a va  2s  . c o  m
        response.renderJavascriptReference(YUILoader.JS_YAHOO_DOM_EVENT);
        response.renderJavascriptReference(YUILoader.JS_ELEMENT);
        response.renderJavascriptReference(YUILoader.JS_DRAGDROP);
        response.renderJavascriptReference(YUILoader.JS_RESIZE);
    }
}

From source file:com.socialsite.SocialSiteApplication.java

License:Open Source License

public static SocialSiteApplication get() {
    return (SocialSiteApplication) Application.get();
}

From source file:com.swordlord.gozer.renderer.fop.FopTemplateManager.java

License:Open Source License

private void loadTemplate(String strKey, String strFilePath) {
    InputStream isFrame = GozerFileLoader.getGozerLayout(Application.get(), strFilePath);
    if (isFrame != null) {
        String strFileContent = GozerFileLoader.convertInputStreamToString(isFrame);

        try {/*from  w w w  .ja va  2 s . c  o  m*/
            isFrame.close();
        } catch (IOException e) {
            LOG.error("TransMeta read, inputStream close threw an exception: " + e.getMessage());
            e.printStackTrace();
        }

        if (strFileContent != null) {
            putTemplate(strKey, strFileContent);
        }
    } else {
        LOG.error("FOP template is empty: " + strFilePath);
    }
}

From source file:com.tysanclan.site.projectewok.TysanApplication.java

License:Open Source License

public static ApplicationContext getApplicationContext() {
    if (testContext != null)
        return testContext;

    TysanApplication ta = (TysanApplication) Application.get();
    return WebApplicationContextUtils.getWebApplicationContext(ta.getServletContext());
}

From source file:com.tysanclan.site.projectewok.TysanApplication.java

License:Open Source License

/**
 * @return The current TysanApplication
 */
public static TysanApplication get() {
    return (TysanApplication) Application.get();
}