List of usage examples for org.apache.wicket Application get
public static Application get()
From source file:de.alpharogroup.wicket.base.application.plugins.ApplicationDebugSettingsPlugin.java
License:Apache License
/** * Returns the {@link ApplicationDebugSettingsPlugin} instance that has been installed in the * current Wicket application. This is a convenience method that only works within a Wicket * thread, and it assumes that {@link #install install()} has already been called. * * @return the {@link ApplicationDebugSettingsPlugin} instance that has been installed in the * current Wicket application./*from ww w. ja va 2 s . c o m*/ * @throws IllegalStateException * is thrown if no Wicket application bound to the current thread, or if a * {@code DebugSettingsPlugin} has not been installed. */ public static ApplicationDebugSettingsPlugin get() { final Application app = Application.get(); if (null == app) { throw new IllegalStateException("No wicket application is bound to the current thread."); } final ApplicationDebugSettingsPlugin plugin = app.getMetaData(DEBUG_SETTINGS_PLUGIN_KEY); if (null == plugin) { final String pluginClassName = ApplicationDebugSettingsPlugin.class.getSimpleName(); throw new IllegalStateException("A " + pluginClassName + " has not been installed in this Wicket " + "application. You have to call " + pluginClassName + ".install() in " + "your application init()."); } return plugin; }
From source file:de.alpharogroup.wicket.base.application.plugins.SecuritySettingsPlugin.java
License:Apache License
/** * Returns the {@link SecuritySettingsPlugin} instance that has been installed in the current * Wicket application. This is a convenience method that only works within a Wicket thread, and * it assumes that {@link #install install()} has already been called. * * @return the {@link SecuritySettingsPlugin} instance that has been installed in the current * Wicket application.//from w w w . j a v a 2s .c o m * @throws IllegalStateException * is thrown if no Wicket application bound to the current thread, or if a * {@code DebugSettingsPlugin} has not been installed. */ public static SecuritySettingsPlugin get() { final Application app = Application.get(); if (null == app) { throw new IllegalStateException("No wicket application is bound to the current thread."); } final SecuritySettingsPlugin plugin = app.getMetaData(SECURITY_SETTINGS_PLUGIN_KEY); if (null == plugin) { final String pluginClassName = SecuritySettingsPlugin.class.getSimpleName(); throw new IllegalStateException( "A " + pluginClassName + " has not been installed in this Wicket application. You have to call " + pluginClassName + ".install() in " + "your application init()."); } return plugin; }
From source file:de.alpharogroup.wicket.base.examples.application.WicketApplication.java
License:Apache License
/** * Gets the WicketApplication./*from w ww.j a va 2 s.co m*/ * * @return the WicketApplication object. */ public static WicketApplication get() { return (WicketApplication) Application.get(); }
From source file:de.alpharogroup.wicket.base.util.application.ApplicationExtensions.java
License:Apache License
/** * Gets the default jquery reference from the current application. * * @return the default jquery reference// w w w .ja v a 2 s. c o m */ public static ResourceReference getJQueryReference() { return getJQueryReference(Application.get()); }
From source file:de.alpharogroup.wicket.base.util.application.ApplicationExtensions.java
License:Apache License
/** * Gets the request logger from the given WebApplication. * * @param webApplication//from w w w . ja va2s . c o m * the web application * @return the request logger */ public static IRequestLogger getRequestLogger(WebApplication webApplication) { if (webApplication == null) { webApplication = (WebApplication) Application.get(); } IRequestLogger requestLogger = webApplication.getRequestLogger(); if (requestLogger == null) { requestLogger = new RequestLogger(); } return requestLogger; }
From source file:de.alpharogroup.wicket.base.util.SessionExtensions.java
License:Apache License
/** * Gets the request logger from the given WebApplication. * * @param webApplication//w w w . j a v a 2 s .c om * the web application * @return the request logger */ public static IRequestLogger getRequestLogger(final WebApplication webApplication) { IRequestLogger requestLogger; if (webApplication == null) { requestLogger = ((WebApplication) Application.get()).getRequestLogger(); } else { requestLogger = webApplication.getRequestLogger(); } if (requestLogger == null) { requestLogger = new RequestLogger(); } return requestLogger; }
From source file:de.alpharogroup.wicket.behaviors.datetime.CurrentDatetimeBehavior.java
License:Apache License
/** * {@inheritDoc}//from w ww . j av a 2 s .com */ @Override public void renderHead(final Component component, final IHeaderResponse response) { super.renderHead(component, response); response.render(JavaScriptHeaderItem .forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference())); response.render(JavaScriptHeaderItem.forReference(CurrentDatetimeBehavior.DATETIME_PLUGIN_REFERENCE)); final String js = generateJS(datetimeTemplate); System.out.println(js); response.render(OnLoadHeaderItem.forScript(generateJS(datetimeTemplate))); }
From source file:de.alpharogroup.wicket.components.examples.animate.AnimationPanel.java
License:Apache License
@Override public void renderHead(final IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem .forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference())); response.render(JavaScriptHeaderItem.forReference(SpinResourceReference.get())); }
From source file:de.alpharogroup.wicket.components.examples.collapse.CollapsePanel.java
License:Apache License
@Override public void renderHead(final IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem .forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference())); response.render(JavaScriptHeaderItem.forReference(CollapseJsReference.get())); }
From source file:de.alpharogroup.wicket.components.examples.notifications.NotificationExamplesPanel.java
License:Apache License
@Override public void renderHead(final IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem .forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference())); response.render(JavaScriptHeaderItem.forReference(ToastrResourceReference.INSTANCE)); response.render(JavaScriptHeaderItem.forReference(PnotifyJsReference.INSTANCE)); }