A context for adding messages to a central pool of messages for later
output with a consistent look.
A good example is
org.araneaframework.framework.filter.StandardMessagingFilterWidget .
It registers a MessageContext in the environment and if a childservice needs to output a
message which should have a consistent look (location on the screen, styles etc.) it adds
the message via showMessage(String,String).
A widget can use the MessageContext from the environment to output the accumulated
messages.
Permanent messages should stay in MessageContext until explicitly cleared, other messages should
be cleared after the user has seen them once.
author: "Toomas Römer" author: Jevgeni Kabanov (ekabanov at araneaframework dot org) author: Taimo Peelo (taimo@araneaframework.org)
Returns all messages as a Map. The keys
of the Map are the different message types encountered so far and under the keys
are the messages in a Collection.
A child service should do as follows to access the messages
...
MessageContext msgCtx = (MessageContext) getEnvironment().requireEntry(MessageContext.class);
Map map = msgCtx.getMessages();
Collection list = (Collection) map.get(MessageContext.ERROR_TYPE); // collection contains all the error messages
The map could be null if this service was not used. The collection is null if no messages of
that type been added to the messages.
since: 1.1
hideErrorMessage
public void hideErrorMessage(String message)(Code)