SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 277 | Next

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"

bind(SupportedLocales.class,
SupportedLocalesImpl.class);
}
That's it! The service is ready, and we can now inject it into any page or component.
Remove the supportedLocales parameter from the LocaleSwitcher class and add
the following two lines of code instead:
@Inject
private SupportedLocales supportedLocales;
We shall also need to modify the getLocaleModel method:
public SelectModel getLocaleModel()
{
return new LocaleSelectModel(
supportedLocales.getSupportedLocales());
}
Chapter 8
[ 231 ]
Finally, remove the supportedLocales parameter from the component declaration
in the Border.tml template:



Run the application, and it should work exactly as before, with the only difference
being that the list of supported locales are now provided by our new custom service.
Isn't it great that we can drop this simple tag whenever we want in an internalized
application and the component will automatically define which locales are supported
by the application and provide the functionality for switching between them?
It would be even more impressive if we could package our custom components into
a library and share it with friends.


Pages:
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6