List of usage examples for org.apache.wicket.protocol.http WebApplication getMetaData
public final synchronized <T> T getMetaData(final MetaDataKey<T> key)
From source file:org.efaps.esjp.ui.dev.DevUtils.java
License:Apache License
public Return toggleDevUtils(final Parameter _parameter) throws EFapsException { //Administration if (Role.get(UUID.fromString("1d89358d-165a-4689-8c78-fc625d37aacd")).isAssigned()) { final WebApplication application = WebApplication.get(); DevUtils.LOG// w ww.java 2 s . c om .info("Toggle devutils: " + !application.getDebugSettings().isDevelopmentUtilitiesEnabled()); application.getDebugSettings().setDevelopmentUtilitiesEnabled( !application.getDebugSettings().isDevelopmentUtilitiesEnabled()); // check to add them only once if (application.getMetaData(DevUtils.DEBUG_BAR_CONTRIBUTED) == null) { DebugBar.registerContributor(VersionDebugContributor.DEBUG_BAR_CONTRIB, application); DebugBar.registerContributor(InspectorDebugPanel.DEBUG_BAR_CONTRIB, application); DebugBar.registerContributor(SessionSizeDebugPanel.DEBUG_BAR_CONTRIB, application); DebugBar.registerContributor(PageSizeDebugPanel.DEBUG_BAR_CONTRIB, application); application.setMetaData(DevUtils.DEBUG_BAR_CONTRIBUTED, true); } } return new Return(); }
From source file:org.wicketstuff.mergedresources.ResourceMount.java
License:Apache License
/** * enable annotation based adding of resources and make sure that the * component instantiation listener is only added once * // w w w . j ava 2s . co m * @param application * @see JsContribution * @see CssContribution */ public static void enableAnnotations(WebApplication application) { Boolean enabled = application.getMetaData(ANNOTATIONS_ENABLED_KEY); if (!Boolean.TRUE.equals(enabled)) { try { Class.forName("org.wicketstuff.config.MatchingResources"); Class.forName("org.springframework.core.io.support.PathMatchingResourcePatternResolver"); } catch (ClassNotFoundException e) { throw new WicketRuntimeException( "in order to enable wicketstuff-merged-resources' annotation support, " + "wicketstuff-annotations and spring-core must be on the path " + "(see http://wicketstuff.org/confluence/display/STUFFWIKI/wicketstuff-annotation for details)"); } application.addComponentInstantiationListener(new ContributionInjector()); application.setMetaData(ANNOTATIONS_ENABLED_KEY, Boolean.TRUE); } }
From source file:org.wicketstuff.offline.mode.OfflineCache.java
License:Apache License
/** * Gets the offline cache entries//from w w w . j a v a 2s . c o m * * @return the offline cache entries */ public static List<OfflineCacheEntry> getOfflineCacheEntries(WebApplication application) { return application.getMetaData(OFFLINE_CACHE_ENTRIES); }
From source file:sk.drunkenpanda.leaflet.Leaflet.java
License:Apache License
/** * Install Leaflet with given settings to application. * If application already has Leaflet installed, it ignores new settings. * * @param application application, which Leaflet should be bounded to. * @param settings custom settings, which are used to initialized library * @throws IllegalArgumentException if application is {@code null}. *///from w w w . ja v a 2 s .c om public static void install(WebApplication application, LeafletSettings settings) { // install Leaflet.js with given configuration Args.notNull(application, "application"); if (application.getMetaData(LEAFLET_SETTINGS_KEY) == null) { LeafletSettings settingsOrDefault = settings != null ? settings : new DefaultLeafletSettings(); application.setMetaData(LEAFLET_SETTINGS_KEY, settingsOrDefault); if (settingsOrDefault.autoAppendResources()) { application.getComponentInstantiationListeners().add(new LeafletResourceAppender()); } if (settingsOrDefault.useWebJars()) { WicketWebjars.install(application); } } }