Permalink
Browse files

further listener collection cleanup

git-svn-id: https://svn.apache.org/repos/asf/wicket/trunk@1026203 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 3ec7ff8 commit 5a6075e981e01be9bbb49855e57282fa5ece090d Igor Vaynberg committed Oct 22, 2010
@@ -78,7 +78,7 @@ public void testNonBookmarkablePage()
boolean hit = false;
try
{
- tester.getApplication().addPostComponentOnBeforeRenderListener(checker);
+ tester.getApplication().getComponentPostOnBeforeRenderListeners().add(checker);
tester.startPage(StatelessPage.class);
}
catch (IllegalArgumentException ex)
@@ -93,7 +93,7 @@ public void testNonBookmarkablePage()
*/
public void testPositive()
{
- tester.getApplication().addPostComponentOnBeforeRenderListener(checker);
+ tester.getApplication().getComponentPostOnBeforeRenderListeners().add(checker);
tester.startComponent(new StatelessLabel("foo"));
}
}
@@ -35,7 +35,7 @@ protected void init()
{
super.init();
- addComponentInstantiationListener(new GuiceComponentInjector(this));
+ getComponentInstantiationListeners().add(new GuiceComponentInjector(this));
}
/**
@@ -48,7 +48,7 @@ protected void init()
// THIS LINE IS IMPORTANT - IT INSTALLS THE COMPONENT INJECTOR THAT WILL
// INJECT NEWLY CREATED COMPONENTS WITH THEIR SPRING DEPENDENCIES
- addComponentInstantiationListener(new SpringComponentInjector(this));
+ getComponentInstantiationListeners().add(new SpringComponentInjector(this));
}
@Override
@@ -98,15 +98,16 @@ public WebApplication createApplication(WicketFilter filter)
Injector injector;
String injectorContextAttribute = filter.getFilterConfig().getInitParameter(
- "injectorContextAttribute");
+ "injectorContextAttribute");
Stage stage = null;
String stageContextAttribute = filter.getFilterConfig().getInitParameter(STAGE_PARAMETER);
if (stageContextAttribute == null)
{
- stageContextAttribute = filter.getFilterConfig().getServletContext().getInitParameter(
- STAGE_PARAMETER);
+ stageContextAttribute = filter.getFilterConfig()
+ .getServletContext()
+ .getInitParameter(STAGE_PARAMETER);
}
if (stageContextAttribute != null)
{
@@ -123,8 +124,8 @@ public WebApplication createApplication(WicketFilter filter)
if (injector == null)
{
throw new RuntimeException(
- "Could not find Guice Injector in the ServletContext under attribute: " +
- injectorContextAttribute);
+ "Could not find Guice Injector in the ServletContext under attribute: " +
+ injectorContextAttribute);
}
}
else if (filter.getFilterConfig().getInitParameter("module") != null)
@@ -137,24 +138,24 @@ else if (filter.getFilterConfig().getInitParameter("module") != null)
String moduleName = moduleNames[i].trim();
try
{
- Class< ? > moduleClazz = Class.forName(moduleName);
+ Class<?> moduleClazz = Class.forName(moduleName);
Object moduleObject = moduleClazz.newInstance();
modules[i] = (Module)moduleObject;
}
catch (InstantiationException e)
{
throw new RuntimeException(
- "Could not create new instance of Guice Module class " + moduleName, e);
+ "Could not create new instance of Guice Module class " + moduleName, e);
}
catch (ClassNotFoundException e)
{
throw new RuntimeException(
- "Could not create new instance of Guice Module class " + moduleName, e);
+ "Could not create new instance of Guice Module class " + moduleName, e);
}
catch (IllegalAccessException e)
{
throw new RuntimeException(
- "Could not create new instance of Guice Module class " + moduleName, e);
+ "Could not create new instance of Guice Module class " + moduleName, e);
}
}
if (stage != null)
@@ -169,10 +170,10 @@ else if (filter.getFilterConfig().getInitParameter("module") != null)
else
{
throw new RuntimeException(
- "To use GuiceWebApplicationFactory, you must specify either an 'injectorContextAttribute' or a 'module' init-param.");
+ "To use GuiceWebApplicationFactory, you must specify either an 'injectorContextAttribute' or a 'module' init-param.");
}
WebApplication app = injector.getInstance(WebApplication.class);
- app.addComponentInstantiationListener(new GuiceComponentInjector(app, injector));
+ app.getComponentInstantiationListeners().add(new GuiceComponentInjector(app, injector));
return app;
}
@@ -58,10 +58,12 @@ public void testInjectionAndSerialization()
public void configure(Binder binder)
{
binder.bind(ITestService.class).to(TestService.class);
- binder.bind(ITestService.class).annotatedWith(Red.class).to(
- TestServiceRed.class);
- binder.bind(ITestService.class).annotatedWith(Blue.class).to(
- TestServiceBlue.class);
+ binder.bind(ITestService.class)
+ .annotatedWith(Red.class)
+ .to(TestServiceRed.class);
+ binder.bind(ITestService.class)
+ .annotatedWith(Blue.class)
+ .to(TestServiceBlue.class);
binder.bind(new TypeLiteral<Map<String, String>>()
{
}).toProvider(new Provider<Map<String, String>>()
@@ -78,7 +80,7 @@ public void configure(Binder binder)
}
});
- app.addComponentInstantiationListener(injector);
+ app.getComponentInstantiationListeners().add(injector);
// Create a new component, which should be automatically injected,
// and test to make sure the injection has worked.
@@ -115,7 +117,7 @@ private void doChecksForComponent(TestComponent component)
assertEquals(ITestService.RESULT, component.getInjectedFieldProvider().get().getString());
- assertEquals(ITestService.RESULT, component.getInjectedTypeLiteralField().get(
- ITestService.RESULT));
+ assertEquals(ITestService.RESULT,
+ component.getInjectedTypeLiteralField().get(ITestService.RESULT));
}
}
Oops, something went wrong.

0 comments on commit 5a6075e

Please sign in to comment.