|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.click.util.MessagesMap
Provides a localized read only messages Map for Page and Control classes.
A MessagesMap instance is available in each Velocity page using the name "messages". For example suppose you have a localized page title, which is stored in the Page's properties file. You can access page "title" message in your page template via:
$messages.title
This is roughly equivalent to making the call:
public void onInit() { .. addModel("title", getMessage("title"); }Please note if the specified message does not exist in your Page's properties file, or if the Page does not have a properties file, then a MissingResourceException will be thrown. The ClickServlet adds a MessagesMap instance to the Velocity Context before it is merged with the page template.
| Nested Class Summary |
| Nested classes inherited from class java.util.Map |
Map.Entry |
| Field Summary | |
protected Class |
baseClass
The base class. |
protected static Object |
CACHE_LOAD_LOCK
The cache key set load lock. |
protected String |
globalBaseName
The class global resource bundle base name. |
protected Locale |
locale
The resource bundle locale. |
protected Map |
messages
The map of localized messages. |
protected static Map |
MESSAGES_CACHE
Cache of messages keyed by bundleName + Locale name. |
protected static Set |
NOT_FOUND_CACHE
Cache of resource bundle and locales which were not found. |
| Constructor Summary | |
MessagesMap(Class baseClass,
String globalResource)
Create a resource bundle messages Map adaptor for the given object's class resource bundle, the global resource bundle and Context. |
|
| Method Summary | |
void |
clear()
This method is not supported and will throw UnsupportedOperationException if invoked. |
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
Set |
entrySet()
|
Object |
get(Object key)
Return localized resource message for the given key. |
boolean |
isEmpty()
|
Set |
keySet()
|
Object |
put(Object key,
Object value)
This method is not supported and will throw UnsupportedOperationException if invoked. |
void |
putAll(Map map)
This method is not supported and will throw UnsupportedOperationException if invoked. |
Object |
remove(Object key)
This method is not supported and will throw UnsupportedOperationException if invoked. |
int |
size()
|
String |
toString()
|
Collection |
values()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
equals, hashCode |
| Field Detail |
protected static final Set NOT_FOUND_CACHE
protected static final Map MESSAGES_CACHE
protected static final Object CACHE_LOAD_LOCK
protected final Class baseClass
protected final String globalBaseName
protected Map messages
protected final Locale locale
| Constructor Detail |
public MessagesMap(Class baseClass,
String globalResource)
baseClass - the target classglobalResource - the global resource bundle name| Method Detail |
public int size()
size in interface MapMap.size()public boolean isEmpty()
isEmpty in interface MapMap.isEmpty()public boolean containsKey(Object key)
containsKey in interface MapMap.containsKey(Object)public boolean containsValue(Object value)
containsValue in interface MapMap.containsValue(Object)public Object get(Object key)
get in interface MapMissingResourceException - if the given key was not foundMap.get(Object)
public Object put(Object key,
Object value)
put in interface MapMap.put(Object, Object)public Object remove(Object key)
remove in interface MapMap.remove(Object)public void putAll(Map map)
putAll in interface MapMap.putAll(Map)public void clear()
clear in interface MapMap.clear()public Set keySet()
keySet in interface MapMap.keySet()public Collection values()
values in interface MapMap.values()public Set entrySet()
entrySet in interface MapMap.entrySet()public String toString()
toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||