/** * Constructor. <strong>Use {@link #init()} for any configuration of your application instead of * overriding the constructor.</strong> */ public Application() { // Install default component instantiation listener that uses // authorization strategy to check component instantiations. getComponentInstantiationListeners().add(new IComponentInstantiationListener() { /** * @see org.apache.wicket.application.IComponentInstantiationListener#onInstantiation(org.apache.wicket.Component) */ @Override public void onInstantiation(final Component component) { final Class<? extends Component> cl = component.getClass(); // If component instantiation is not authorized if (!Session.get().getAuthorizationStrategy().isInstantiationAuthorized(cl)) { // then call any unauthorized component instantiation // listener getSecuritySettings().getUnauthorizedComponentInstantiationListener() .onUnauthorizedInstantiation(component); } } }); }
@Override public void onInstantiation(final Component component) { notify(new INotifier<IComponentInstantiationListener>() { @Override public void notify(IComponentInstantiationListener listener) { listener.onInstantiation(component); } }); } }
/** * Constructor. All components have names. A component's id cannot be null. This constructor * includes a model. * * @param id * The non-null id of this component * @param model * The component's model * * @throws WicketRuntimeException * Thrown if the component has been given a null id. */ public Component(final String id, final IModel<?> model) { checkId(id); this.id = id; init(); Application application = getApplication(); application.getComponentInstantiationListeners().onInstantiation(this); final DebugSettings debugSettings = application.getDebugSettings(); if (debugSettings.isLinePreciseReportingOnNewComponentEnabled() && debugSettings.getComponentUseCheck()) { setMetaData(CONSTRUCTED_AT_KEY, ComponentStrings.toString(this, new MarkupException("constructed"))); } if (model != null) { setModelImpl(wrap(model)); } }
/** * Constructor. All components have names. A component's id cannot be null. This constructor * includes a model. * * @param id * The non-null id of this component * @param model * The component's model * * @throws WicketRuntimeException * Thrown if the component has been given a null id. */ public Component(final String id, final IModel<?> model) { checkId(id); this.id = id; init(); Application application = getApplication(); application.getComponentInstantiationListeners().onInstantiation(this); final DebugSettings debugSettings = application.getDebugSettings(); if (debugSettings.isLinePreciseReportingOnNewComponentEnabled() && debugSettings.getComponentUseCheck()) { setMetaData(CONSTRUCTED_AT_KEY, ComponentStrings.toString(this, new MarkupException("constructed"))); } if (model != null) { setModelImpl(wrap(model)); } }
/** * Constructor. <strong>Use {@link #init()} for any configuration of your application instead of * overriding the constructor.</strong> */ public Application() { // Install default component instantiation listener that uses // authorization strategy to check component instantiations. getComponentInstantiationListeners().add(new IComponentInstantiationListener() { /** * @see org.apache.wicket.application.IComponentInstantiationListener#onInstantiation(org.apache.wicket.Component) */ @Override public void onInstantiation(final Component component) { final Class<? extends Component> cl = component.getClass(); // If component instantiation is not authorized if (!Session.get().getAuthorizationStrategy().isInstantiationAuthorized(cl)) { // then call any unauthorized component instantiation // listener getSecuritySettings().getUnauthorizedComponentInstantiationListener() .onUnauthorizedInstantiation(component); } } }); }
@Override public void onInstantiation(final Component component) { notify(new INotifier<IComponentInstantiationListener>() { @Override public void notify(IComponentInstantiationListener listener) { listener.onInstantiation(component); } }); } }
/** * Initializes the given WebApplication with the Spring framework. * * @param application * the WebApplication */ public static void initializeSpring(final WebApplication application) { application.getComponentInstantiationListeners() .add(new SpringComponentInjector(application)); }
protected void initWicketComponentInjection(final Injector injector) { // if serializable, then brings in dependency on cglib, and in turn asm. // This would block us from migrating to DN 4.0.x getComponentInstantiationListeners().add(new GuiceComponentInjector(this, injector, false)); }
protected void initFontAwesome() { getComponentInstantiationListeners().add(component -> { if (component instanceof Page) { component.add(new FontAwesomeResourceBehavior()); } }); }
protected void initCssBrowserSelector() { getComponentInstantiationListeners().add(component -> { if (component instanceof Page) { component.add(new CssBrowserSelectorResourceBehavior()); } }); }
protected void initFontAwesome() { getComponentInstantiationListeners().add(component -> { if (component instanceof Page) { component.add(new FontAwesomeResourceBehavior()); } }); }
protected void initBaseLayoutCss() { getComponentInstantiationListeners().add(component -> { if (component instanceof Page) { component.add(BaseLayoutCssResourceBehavior.get()); } }); } protected void initKendo()
protected void initCssBrowserSelector() { getComponentInstantiationListeners().add(component -> { if (component instanceof Page) { component.add(new CssBrowserSelectorResourceBehavior()); } }); }
protected void initBaseLayoutCss() { getComponentInstantiationListeners().add(component -> { if (component instanceof Page) { component.add(BaseLayoutCssResourceBehavior.get()); } }); } protected void initKendo()
@Override public void init(Application application) { // create dashboard context DashboardContext dashboardContext = new DashboardContext(); // store dashboard context in application application.setMetaData(DASHBOARD_CONTEXT_KEY, dashboardContext); // add dashboard context injector DashboardContextInjector dashboardContextInjector = new DashboardContextInjector(dashboardContext); application.getComponentInstantiationListeners().add(dashboardContextInjector); }
app.getComponentInstantiationListeners().add(new GuiceComponentInjector(app, injector)); return app;
private SimplifiedPaxWicketInjector(WicketTester tester) { tester.getApplication().getComponentInstantiationListeners().add( new PaxWicketSpringBeanComponentInjector(tester.getApplication(), applicationContext)); }
@Override public void init(Application application) { // create dashboard context DashboardContext dashboardContext = new DashboardContext(); // store dashboard context in application application.setMetaData(DASHBOARD_CONTEXT_KEY, dashboardContext); // add dashboard context injector DashboardContextInjector dashboardContextInjector = new DashboardContextInjector(dashboardContext); application.getComponentInstantiationListeners().add(dashboardContextInjector); }
@Override protected void init() { super.init(); getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContext)); WicketAutoConfig.Builder builder = new WicketAutoConfig.Builder(this.getClass()); wicketEndpointRepository.add(builder .withDetail("signInPages", classCandidates.getSignInPageCandidates()) .withDetail("homePages", classCandidates.getHomePageCandidates()) .build()); for (WicketApplicationInitConfiguration configuration : configurations) { logger.info("init-config: " + configuration.getClass().getName()); configuration.init(this); } }
@Override protected void init() { super.init(); getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContext)); WicketAutoConfig.Builder builder = new WicketAutoConfig.Builder(this.getClass()); wicketEndpointRepository.add(builder .withDetail("signInPages", classCandidates.getSignInPageCandidates()) .withDetail("homePages", classCandidates.getHomePageCandidates()) .build()); for (WicketApplicationInitConfiguration configuration : configurations) { logger.info("init-config: " + configuration.getClass().getName()); configuration.init(this); } }