org.apache.click.service
Interface MessagesMapService

All Known Implementing Classes:
DefaultMessagesMapService

public interface MessagesMapService

Provides a messages map factory service for the Click runtime.

Configuration

The default MessagesMapService implementation is DefaultMessagesMapService.

You can instruct Click to use a different implementation by adding the following element to your click.xml configuration file.

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <click-app charset="UTF-8">

     <pages package="org.apache.click.examples.page"/>

     <messages-map-service classname="com.mycorp.CustomMessagesMapService"/>

 </click-app> 
The class com.mycorp.CustomMessagesMapService might be defined as follows:
 package com.mycorp;

 public class CustomMessagesMapService implements MessagesMapService {

     public Map createMessagesMap(Class<?> baseClass, String globalResource, Locale locale) {
         return new MyMessagesMap(baseClass, globalResource, locale);
     }
 } 


Method Summary
 Map<String,String> createMessagesMap(Class<?> baseClass, String globalResource, Locale locale)
          Return a new messages map for the given baseClass (a page or control) and the given global resource bundle name.
 void onDestroy()
          Destroy the MessagesMapService.
 void onInit(ServletContext servletContext)
          Initialize the MessagesMapService with the given application servlet context.
 

Method Detail

onInit

void onInit(ServletContext servletContext)
            throws Exception
Initialize the MessagesMapService with the given application servlet context.

This method is invoked after the MessagesMapService has been constructed.

Parameters:
servletContext - the application servlet context
Throws:
Exception - if an error occurs initializing the LogService

onDestroy

void onDestroy()
Destroy the MessagesMapService.


createMessagesMap

Map<String,String> createMessagesMap(Class<?> baseClass,
                                     String globalResource,
                                     Locale locale)
Return a new messages map for the given baseClass (a page or control) and the given global resource bundle name.

Parameters:
baseClass - the target class
globalResource - the global resource bundle name
locale - the users Locale
Returns:
a new messages map with the messages for the target.