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.google.code.jqwicket.JQContributionRenderer.java

License:Apache License

private CharSequence compressJavaScript(CharSequence script) {

    final IJavaScriptCompressor compressor;

    if (JQContributionConfig.get().isUseYuiJavascriptCompressor())
        compressor = YuiJavascriptCompressor.get();
    else/*from  www  . j a  v a 2  s . c  o m*/
        compressor = Application.get().getResourceSettings().getJavaScriptCompressor();

    return (compressor != null && Utils.isNotBlank(script)) ? compressor.compress(String.valueOf(script))
            : script;
}

From source file:com.google.code.jqwicket.Utils.java

License:Apache License

/**
 * Returns true, if wicket runs in development mode. Otherwise returns false.
 *
 * @return true, if wicket runs in development mode. Otherwise returns false.
 */// w w  w. j a va  2s  .  c  o  m
public static boolean isDevelopmentMode() {
    return RuntimeConfigurationType.DEVELOPMENT.equals(Application.get().getConfigurationType());
}

From source file:com.google.code.jqwicket.Utils.java

License:Apache License

/**
 * Returns true, if wicket runs in deployment mode. Otherwise returns false.
 *
 * @return true, if wicket runs in deployment mode. Otherwise returns false.
 *//*from  ww w.  java2 s  .com*/
public static boolean isDeploymentMode() {
    return RuntimeConfigurationType.DEPLOYMENT.equals(Application.get().getConfigurationType());
}

From source file:com.google.code.jqwicket.Utils.java

License:Apache License

/**
 * Returns localized string resource./* w w  w .  ja va 2 s.c om*/
 *
 * @param key
 * @param component
 * @param args
 * @return
 */
public static CharSequence i18n(CharSequence key, Component component, CharSequence... args) {
    return Application.get().getResourceSettings().getLocalizer().getString(String.valueOf(key), component,
            Model.of(args));
}

From source file:com.googlecode.ounit.OunitApplication.java

License:Open Source License

public static OunitApplication get() {
    Application app = Application.get();

    if (!(app instanceof OunitApplication)) {
        throw new WicketRuntimeException(
                "The application attached to the current " + "thread is not an OunitApplication");
    }//from  w  w  w  .j  a v a2s  . c  om

    return (OunitApplication) app;
}

From source file:com.googlecode.wicket.jquery.core.behavior.AjaxCallbackBehavior.java

License:Apache License

/**
 * Constructor/*from   w ww . j a  va  2 s  . com*/
 * 
 * @param mimetype the content type
 */
public AjaxCallbackBehavior(String mimetype) {
    this(mimetype, Application.get().getRequestCycleSettings().getResponseRequestEncoding());
}

From source file:com.googlecode.wicket.jquery.core.JQueryAbstractBehavior.java

License:Apache License

/**
 * Gets the {@link IJQueryLibrarySettings}
 * @return the {@link IJQueryLibrarySettings}
 *//* w  w w .j a  v a  2s  . com*/
public static IJQueryLibrarySettings getJQueryLibrarySettings() {
    if (Application.exists()
            && (Application.get().getJavaScriptLibrarySettings() instanceof IJQueryLibrarySettings)) {
        return (IJQueryLibrarySettings) Application.get().getJavaScriptLibrarySettings();
    }

    return JQueryLibrarySettings.get();
}

From source file:com.googlecode.wicket.jquery.core.JQueryAbstractBehavior.java

License:Apache License

@Override
public void onConfigure(Component component) {
    super.onConfigure(component);

    if (Application.exists() && Application.get().usesDevelopmentConfig()) {
        if (!Application.get().getMarkupSettings().getStripWicketTags()) {
            LOG.warn(//from w  ww.j  a  v  a2  s. c  o m
                    "Application>MarkupSettings>StripWicketTags setting is currently set to false. It is highly recommended to set it to true to prevent widget misbehaviors.");
        }
    }
}

From source file:com.googlecode.wicket.jquery.core.utils.ConverterUtils.java

License:Apache License

/**
 * Converts the object to its string representation using the appropriate converter, if defined.
 * /* www . j a  v a  2 s  .c  om*/
 * @param object the object
 * @return the string representation using the appropriate converter, if defined. #toString() otherwise.
 */
public static <T> String toString(T object) {
    String value = null;

    @SuppressWarnings("unchecked")
    IConverter<T> converter = (IConverter<T>) Application.get().getConverterLocator()
            .getConverter(object.getClass());

    if (converter != null) {
        value = converter.convertToString(object, Session.get().getLocale());
    } else {
        value = object.toString();
    }

    return value;
}

From source file:com.googlecode.wicket.jquery.ui.calendar.CalendarBehavior.java

License:Apache License

/**
 * Gets the {@link ICalendarLibrarySettings}
 *
 * @return null if Application's {@link IJavaScriptLibrarySettings} is not an instance of {@link ICalendarLibrarySettings}
 *//*from  w  w  w .j  a  v a2 s  . c  o m*/
private static ICalendarLibrarySettings getLibrarySettings() {
    if (Application.exists()
            && (Application.get().getJavaScriptLibrarySettings() instanceof ICalendarLibrarySettings)) {
        return (ICalendarLibrarySettings) Application.get().getJavaScriptLibrarySettings();
    }

    return CalendarLibrarySettings.get();
}