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:net.databinder.jpa.Databinder.java

License:Open Source License

/**
 * @param context object, or null for the default factory
 * @return session factory, as returned by the application
 * @throws WicketRuntimeException if session factory can not be found
 * @see JPAApplication/*from w  w w.  jav a  2 s.  co  m*/
 */
public static EntityManager getEntityManager(final String context) {
    final Application app = Application.get();
    if (app instanceof JPAApplication) {
        return ((JPAApplication) app).getEntityManager(context);
    }
    throw new WicketRuntimeException("Please implement JPAApplication in your Application subclass.");
}

From source file:net.databinder.models.hib.CriteriaFilterAndSort.java

License:Open Source License

protected Number convertToNumber(String value, Class clazz) {
    return (Number) new PropertyResolverConverter(Application.get().getConverterLocator(),
            Session.get().getLocale()).convert(value, clazz);
}

From source file:net.dontdrinkandroot.extensions.wicket.headeritem.ExternalJQueryUiJsHeaderItem.java

License:Apache License

@Override
public List<HeaderItem> getDependencies() {
    final ResourceReference backingLibraryReference;
    if (Application.exists()) {
        backingLibraryReference = Application.get().getJavaScriptLibrarySettings().getJQueryReference();
    } else {/*  w ww  .  j  a v  a2s. c om*/
        backingLibraryReference = JQueryResourceReference.getV3();
    }

    return Collections.singletonList(JavaScriptHeaderItem.forReference(backingLibraryReference));
}

From source file:net.dontdrinkandroot.extensions.wicket.resource.FileResourceResponse.java

License:Apache License

public FileResourceResponse(final File file) {
    this.file = file;
    final String contentType = Application.get().getMimeType(this.file.getAbsolutePath());
    this.setContentType(contentType);
    this.setLastModified(Time.millis(this.file.lastModified()));
    this.setContentLength(this.file.length());
}

From source file:net.dontdrinkandroot.wicket.bootstrap.headeritem.BootstrapJsHeaderItem.java

License:Apache License

@Override
public Iterable<? extends HeaderItem> getDependencies() {

    final ResourceReference backingLibraryReference;
    if (Application.exists()) {
        backingLibraryReference = Application.get().getJavaScriptLibrarySettings().getJQueryReference();
    } else {/*ww w .  ja v a2  s . co m*/
        backingLibraryReference = JQueryResourceReference.get();
    }

    return Arrays.asList(JavaScriptHeaderItem.forReference(backingLibraryReference));
}

From source file:net.dontdrinkandroot.wicket.resource.FileResourceResponse.java

License:Apache License

public FileResourceResponse(final File file) {

    this.file = file;
    final String contentType = Application.get().getMimeType(this.file.getAbsolutePath());
    this.setContentType(contentType);
    this.setLastModified(Time.millis(this.file.lastModified()));
    this.setContentLength(this.file.length());
}

From source file:net.ftlines.wicket.validation.bean.ClassReference.java

License:Apache License

/**
 * Gets the {@link Class} stored in this reference
 * //from   w  w w  .j  av  a  2 s.co  m
 * @return
 */
@SuppressWarnings("unchecked")
public Class<? extends T> get() {
    Class<? extends T> clazz = cache != null ? cache.get() : null;
    if (clazz == null) {
        try {
            clazz = (Class<? extends T>) Application.get().getApplicationSettings().getClassResolver()
                    .resolveClass(name);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException("Could not resolve class: " + name, e);
        }
        cache(clazz);
    }
    return clazz;
}

From source file:net.ftlines.wicket.validation.bean.ValidationContext.java

License:Apache License

/**
 * Gets the {@link ValidationContext} associated with the thread's current {@link Application}
 * instance//  w  w w.  j av  a  2s.c om
 * 
 * @return
 */
public static ValidationContext get() {
    return get(Application.get());
}

From source file:net.java.ao.blog.BlogApplication.java

License:Apache License

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

From source file:net.rrm.ehour.ui.common.renderers.LocalizedResourceRenderer.java

License:Open Source License

public Object getDisplayValue(T obj) {
    String key = getResourceKey(obj);

    Localizer localizer = Application.get().getResourceSettings().getLocalizer();

    return localizer.getString(key, null);
}