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:org.webical.web.components.ajax.YUIAjaxHandler.java

License:Open Source License

@Override
public void renderHead(IHeaderResponse response) {
    super.renderHead(response);
    response.renderJavascriptReference(YUI_YAHOO_JS);
    response.renderJavascriptReference(YUI_DOM_JS);
    response.renderJavascriptReference(YUI_EVENT_JS);
    response.renderJavascriptReference(YUI_DRAGDROP_JS);
    response.renderJavascriptReference(YUI_ANIMATION_JS);
    response.renderJavascriptReference(YUI_DDCONTAINER_JS);
    response.renderJavascriptReference(YUI_DDPLAYER_JS);
    response.renderJavascriptReference(YUI_DDRESIZE_JS);
    response.renderJavascriptReference(WICKET_JAVASCRIPT);

    //Enable debug?
    final IDebugSettings settings = Application.get().getDebugSettings();
    if (settings.isAjaxDebugModeEnabled()) {
        response.renderJavascript(//  w  w w. j a v  a  2s . c  o  m
                "\n<script type=\"text/javascript\" >" + "\n wicketAjaxDebugEnable=true; \n " + "</script>\n",
                "debug scripts");
        response.renderJavascriptReference(WICKET_JAVASCRIPT_DEBUG_DRAG);
        response.renderJavascriptReference(WICKET_JAVASCRIPT_DEBUG);
    }
}

From source file:org.wicketeer.modelfactory.Reference.java

License:Apache License

/**
 * @param objectToReference/*w ww . j  av a 2 s  . c  om*/
 *            the object this Reference should point to.
 * @throws NullPointerException
 *             if the object to reference if null
 */
Reference(final Object objectToReference) throws NullPointerException {
    object = checkNotNull(objectToReference);

    if (Reference.createExceptionForDebug == null) {
        Reference.createExceptionForDebug = RuntimeConfigurationType.DEVELOPMENT
                .equals(Application.get().getConfigurationType());
    }

    if (Reference.createExceptionForDebug) {
        invokationPath = new Exception();
    } else {
        invokationPath = null;
    }
}

From source file:org.wicketface.application.FacebookApplication.java

License:Apache License

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

From source file:org.wicketface.samples.wfsampleapp.web.application.WicketFaceSampleApplication.java

License:Apache License

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

From source file:org.wicketstuff.chat.channel.TimerChannelBehavior.java

License:Apache License

/**
 * Creates a new push target to which triggers can be sent
 * /*from ww w .java2 s . c o  m*/
 * @return an IPushTarget to which triggers can be sent in any thread.
 */
public IPushTarget newPushTarget() {
    return new TimerPushTarget(Application.get(), id, timeout);
}

From source file:org.wicketstuff.console.ScriptEnginePanel.java

License:Apache License

protected Map<String, Object> newBindings() {
    final Map<String, Object> bindings = new HashMap<String, Object>();
    bindings.put("application", Application.get());
    bindings.put("page", getPage());
    bindings.put("component", this);
    return bindings;
}

From source file:org.wicketstuff.dashboard.web.DashboardSettings.java

License:Apache License

/**
 * Retrieves the instance of settings object.
 *
 * @return settings instance//from ww  w .  j a  v  a2  s  . c om
 */
public static DashboardSettings get() {
    Application application = Application.get();
    DashboardSettings settings = application.getMetaData(KEY);
    if (settings == null) {
        synchronized (application) {
            settings = application.getMetaData(KEY);
            if (settings == null) {
                settings = new DashboardSettings();
                application.setMetaData(KEY, settings);
            }
        }
    }

    return application.getMetaData(KEY);
}

From source file:org.wicketstuff.dashboard.widgets.ofchart.DataResourceReference.java

License:Apache License

private Dashboard getDashboard() {
    DashboardContext dashboardContext = Application.get()
            .getMetaData(DashboardContextInitializer.DASHBOARD_CONTEXT_KEY);
    Dashboard dashboard = dashboardContext.getDashboardPersister().load();

    return dashboard;
}

From source file:org.wicketstuff.datetime.extensions.yui.calendar.DatePicker.java

License:Apache License

/**
 * Renders yui & wicket calendar js module loading. It is done only once per page.
 * // ww w  . j av a2  s .  c om
 * @param response
 *            header response
 */
protected void renderHeadInit(IHeaderResponse response) {
    String key = "DatePickerInit.js";
    if (response.wasRendered(key)) {
        return;
    }

    // variables for YUILoader
    Map<String, Object> variables = new HashMap<>();
    variables.put("basePath", Strings.stripJSessionId(RequestCycle.get().urlFor(YUI, null).toString()) + "/");
    variables.put("Wicket.DateTimeInit.DatePath", RequestCycle.get().urlFor(WICKET_DATE, null));

    if (Application.get().usesDevelopmentConfig()) {
        variables.put("filter", "filter: \"RAW\",");
        variables.put("allowRollup", false);
    } else {
        variables.put("filter", "");
        variables.put("allowRollup", true);
    }

    TextTemplate template = new PackageTextTemplate(DatePicker.class, key);
    response.render(OnDomReadyHeaderItem.forScript(template.asString(variables)));

    response.markRendered(key);
}

From source file:org.wicketstuff.datetime.extensions.yui.YuiLib.java

License:Apache License

private static ResourceReference getYuiLoader() {
    if (YUILOADER == null) {
        StringBuilder sb = new StringBuilder("yuiloader/yuiloader");
        if (Application.get().usesDeploymentConfig()) {
            sb.append("-min");
        }//w w  w .  j a v  a2s.c  om
        sb.append(".js");
        YUILOADER = new PackageResourceReference(YuiLib.class, sb.toString());
    }
    return YUILOADER;
}