|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.swing.messaging.DefaultMessageFactory
public class DefaultMessageFactory
A factory that makes Message Objects availiable.
You can register/deregister to this class several MessageResources.
So its possible to register at startup of application some default resources
and only if its necessary add/remove other resources. Resources will added only
once, trying to add a resource a second time will do nothing.
The factory expects the following key/value pairs for each message:
Field Summary | |
---|---|
static String[] |
OK_ACTION_TEXTS
The default text for a pure confirmation action. |
static String[] |
OK_CANCEL_ACTION_TEXTS
The default text pair for the OK/CANCEL action. |
static String[] |
YES_NO_ACTION_TEXTS
An alternative text pair for the OK/CANCEL action, representing YES/NO. |
static String[] |
YES_NO_CANCEL_ACTION_TEXTS
An alternative text pair for the OK/NO/CANCEL action, representing YES/NO. |
Constructor Summary | |
---|---|
DefaultMessageFactory(String bundleName)
Constructor for MessageFactory. |
Method Summary | |
---|---|
boolean |
containsKey(String key)
Returns whether given key has a value in one of the registered resources. |
Message |
createMessage(String messageKey)
Create a Message specified by given key. |
Message |
createMessage(String messageKey,
Object[] parameters,
Throwable e)
Create a Message specified by given key and additionally parameters. |
Collection |
getSuppressableMessages()
Returns a Collection of Message identifiers of messages that are
allowed to be suppressed by the user. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String[] OK_CANCEL_ACTION_TEXTS
public static final String[] OK_ACTION_TEXTS
public static final String[] YES_NO_ACTION_TEXTS
public static final String[] YES_NO_CANCEL_ACTION_TEXTS
Constructor Detail |
---|
public DefaultMessageFactory(String bundleName)
Method Detail |
---|
public Message createMessage(String messageKey)
MessageFactory
createMessage
in interface MessageFactory
public Message createMessage(String messageKey, Object[] parameters, Throwable e)
MessageFactory
createMessage
in interface MessageFactory
messageKey
- identifier keyparameters
- replacing the placeholders {0}, {1}... in the body text.e
- an Exception belonging to the message
public boolean containsKey(String key)
MessageFactory
containsKey
in interface MessageFactory
key
- the key to look up in the resource bundle
public Collection getSuppressableMessages()
Message
identifiers of messages that are
allowed to be suppressed by the user. Those messages are marked as
"isSuppressableMessage" in the properties file. Moreover, they
have to be set to "isSuppressedMessage=NO" (as an alternative,
"isSuppressedMessage" can be omitted).
getSuppressableMessages
in interface MessageFactory
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |