|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.util.AbstractXmlObject
com.waveset.msgcat.CustomCatalog
An object containing localized messages. Similar to com.waveset.msgcat.Catalog but:
a) can store the messages in the repository rather than on the file system
b) can be modified at run-time
Represents a single custom catalog that consists of a set of locales, each having
a set of message-id to translation mappings.
Field Summary | |
static java.lang.String |
ATT_ENABLED
|
static java.lang.String |
ATT_ID
|
static java.lang.String |
code_id
|
static java.lang.String |
DEFAULT_ID
|
static java.lang.String |
ELEMENT
|
static java.lang.String |
SEP
|
Fields inherited from class com.waveset.util.AbstractXmlObject |
_trace |
Constructor Summary | |
CustomCatalog(org.w3c.dom.Element e)
Constructs this catalog from an XML element. |
|
CustomCatalog(java.lang.String id)
Constructor that allows the specification of an id. |
Method Summary | |
void |
disable()
Flags this catalog as "disabled". |
void |
enable()
Flags this catalog as "enabled". |
java.lang.String |
getElementName()
Gets the XML element name for this object. |
java.lang.String |
getId()
Gets the id for this catalog. |
java.util.ArrayList |
getLocales()
Gets a list of locales currently in the catalog. |
java.lang.String |
getMessage(java.lang.String id,
java.util.Locale locale)
Gets the message for the given locale. |
java.util.Set |
getMessageIds(java.util.Locale locale)
Gets a list of ids for the all the messages in the given locale's message set. |
boolean |
isEnabled()
Indicates whether or not this catalog is "enabled". |
java.lang.String |
localize(java.lang.String id,
java.lang.Object[] vals,
java.util.Locale locale)
Return a formatted, localized message with arguments filled in and full locale resolution (i.e. |
void |
parseXml(org.w3c.dom.Element e)
Uses the given XML element to fill in the data for this object. |
void |
putMessage(java.lang.String id,
java.lang.String text,
java.util.Locale locale)
Add/set a message id mapping to the catalog for the given locale. |
void |
removeMessage(java.lang.String id,
java.util.Locale locale)
Remove the given message from the given locale. |
void |
setDefaultLocale(java.util.Locale locale)
Set the default locale. |
void |
toXml(java.lang.StringBuffer b,
int indent)
Serializes this object as XML to the given string buffer. |
Methods inherited from class com.waveset.util.AbstractXmlObject |
addXmlHeader, cloneObject, dump, dumpFile, getReference, println, setTrace, toIdentityString, toVerboseString, toVerboseString, toXml, toXml, toXml |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String code_id
public static final java.lang.String DEFAULT_ID
public static final java.lang.String ELEMENT
public static final java.lang.String ATT_ID
public static final java.lang.String ATT_ENABLED
public static final java.lang.String SEP
Constructor Detail |
public CustomCatalog(java.lang.String id)
id
- The id for this catalog.public CustomCatalog(org.w3c.dom.Element e) throws WavesetException
e
- The XML element to construct this catalog with.Method Detail |
public void enable()
public void disable()
public boolean isEnabled()
public java.lang.String getId()
public void setDefaultLocale(java.util.Locale locale)
locale
- The locale to set as default.public void putMessage(java.lang.String id, java.lang.String text, java.util.Locale locale)
id
- The id for the message.text
- The translated text.locale
- The locale to set this message for.public java.util.ArrayList getLocales()
public java.util.Set getMessageIds(java.util.Locale locale)
locale
- The locale.
public java.lang.String getMessage(java.lang.String id, java.util.Locale locale)
id
- Id of the message to get.locale
- The locale.
public void removeMessage(java.lang.String id, java.util.Locale locale)
id
- Id of the message to remove.locale
- The locale.public java.lang.String localize(java.lang.String id, java.lang.Object[] vals, java.util.Locale locale)
id
- The id to use for lookup.vals
- The to pass to the message during formatting.locale
- The locale to localize to.
public java.lang.String getElementName()
getElementName
in interface XmlObject
getElementName
in class AbstractXmlObject
public void parseXml(org.w3c.dom.Element e) throws WavesetException
e
- The XML element to parse.
WavesetException
public void toXml(java.lang.StringBuffer b, int indent)
toXml
in interface XmlObject
toXml
in class AbstractXmlObject
b
- The string buffer to write to.indent
- Indicates how many spaces to indent, for formatting
purposes.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |