com.jaxfront.core.xui
Class NLS

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<java.lang.Object,java.lang.Object>
          extended by java.util.Properties
              extended by com.jaxfront.core.util.LanguageEnhancedProperties
                  extended by com.jaxfront.core.xui.NLS
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public class NLS
extends LanguageEnhancedProperties

Defines a NLS Property set which holds all the translated values in the current language.

Version:
1.60
See Also:
Serialized Form

Field Summary
static java.lang.String CLASSIFICATION_TOOL_TIP
           
static java.lang.String CLOSING_DELIMITER
           
static java.lang.String CONTEXT_CAPTION
           
static java.lang.String CONTEXT_CHOICE
           
static java.lang.String CONTEXT_CONTEXTDIALOG
           
static java.lang.String CONTEXT_DELETION_MESSAGE
           
static java.lang.String CONTEXT_DIALOG
           
static java.lang.String CONTEXT_HELP
           
static java.lang.String CONTEXT_LABEL
           
static java.lang.String CONTEXT_LINE_INFO
           
static java.lang.String CONTEXT_LINE_INFO_PDF
           
static java.lang.String CONTEXT_LINE_INFO_TOOLTIP
           
static java.lang.String CONTEXT_MESSAGE
           
static java.lang.String CONTEXT_MESSAGE_FORMULA
           
static java.lang.String CONTEXT_MODE_VALIDATION_MESSAGE
           
static java.lang.String CONTEXT_PAGING
           
static java.lang.String CONTEXT_TREE_ENTRY
           
static java.lang.String LABEL_DELIMITER
           
static char TAG_DELIMITER
           
static java.lang.String UNDEFINED_VALUE
           
static java.lang.String XPATH_DELIMITER
           
 
Constructor Summary
NLS()
          Creates empty NLS properties.
NLS(java.lang.String nlsContentStream)
          Creates an NLS according a NLS String stream representing the content of a language specific NLS.
NLS(java.net.URL xsdURL, Document uiDoc, FingerPrint fingerPrint, java.lang.String language, boolean handleIncludes, boolean includesOnly)
          Construct NLS properties based on a fingerprint and a language
NLS(java.net.URL xsdURL, FingerPrint fingerPrint, java.lang.String language)
          Construct NLS properties based on a fingerprint and a language.
NLS(java.net.URL xsdURL, FingerPrint fingerPrint, java.lang.String language, boolean handleIncludes)
          Construct NLS properties based on a fingerprint and a language.
NLS(java.net.URL xsdURL, FingerPrint fingerPrint, java.lang.String language, boolean handleIncludes, boolean includesOnly)
          Construct NLS properties based on a fingerprint and a language
 
Method Summary
 void addNLSChangeListener(NLSChangeListener listener)
           
 void clearSmallCash()
           
 java.util.Hashtable convertAllNLSFor(java.lang.String sourceXPath, java.lang.String targetXPath, boolean updateNLS)
           
 java.util.Hashtable convertAllNLSFor(Type sourceType, Type targetType, boolean updateNLS)
           
static java.lang.String convertFromGlobalXPath(java.lang.String xpath)
           
 java.util.Hashtable copyAllNLS(java.lang.String sourceXPath, java.lang.String targetXpath)
           
 java.util.Hashtable copyAllNLS(Type sourceType, Type targetType)
           
 void copyNLSStartingWithKey(java.lang.String sourceKey, java.lang.String targetKey)
           
 void copyNLSWithKey(java.lang.String sourceKey, java.lang.String targetKey)
           
static java.lang.String createKeyForXUIEditor(Type type, java.lang.String context, java.lang.String subId, java.lang.String classification)
          Create the right key for a context
static java.lang.String createParamNLSKey(Type nlsType)
           
static java.lang.String createParamNLSKey(Type nlsType, java.lang.String paramSuffix, int ruleIndex, int actionIndex, int paramIndex)
           
static java.lang.String createTargetXPathForXUIEditor(Type type)
          Create the right key for a context
 java.util.Properties extractRelativeNLS(java.lang.String relativeTo)
           
 java.lang.String get(java.lang.String key)
          Returns the translated value for a key
 java.lang.String get(Type source, java.lang.String key)
          Returns the translated value for a source type and a key
 java.lang.String get(Type source, java.lang.String key, java.lang.String[] variables)
          Returns the translated value for a souce type and a key.
 java.util.Vector getAllNLSFor(java.lang.String typeXPath)
           
 java.util.Vector getAllNLSFor(java.lang.String typeXPath, java.lang.String context, boolean contextStartsWith)
           
 java.util.Vector getAllNLSFor(Type aType)
           
 java.util.Vector getAllNLSFor(Type aType, java.lang.String context, boolean contextStartsWith)
           
 java.util.Vector getAllNLSWithKey(java.lang.String startsWith)
           
static java.lang.String getContext(Type type)
          Get the context of the type (e.q. treeEntry, caption, ...)
 java.lang.String getFormula(Type source, java.lang.String context, java.lang.String subId)
           
 java.lang.String getLanguage()
           
static java.lang.String getNLSHeader()
           
 java.util.List getNLSListener()
           
static java.lang.String getNLSPageLayoutContext(Type type)
           
static java.lang.String getSubId(Type type)
          Get the subid of the type (e.q. tablelayout 0,1,L,C ...)
 java.lang.String getTranslation(Type source, java.lang.String defaultNLS, java.lang.String context, java.lang.String subId, java.lang.String classification)
           
 boolean hasChanged()
           
 boolean hasFormula(Type source, java.lang.String context, java.lang.String subId)
           
static boolean hasIncludedNLS(Document uiDoc)
           
static boolean hasIncludedNLS(org.w3c.dom.Document w3cUIDoc)
           
 void insertRelativeNLS(java.net.URL location, java.lang.String relativeTo)
           
static boolean isInContext(java.lang.String key, java.lang.String context)
           
 void moveAllListEntryNLS(ListType list, java.lang.String context, int from, int to)
           
 void moveAllListEntryNLS(java.lang.String xpath, java.lang.String context, int from, int to, boolean removeSource)
           
static java.lang.String nlsKey(Type source, java.lang.String context, java.lang.String subId, java.lang.String classification)
           
static java.lang.String nlsKey(Type source, java.lang.String xpath, java.lang.String context, java.lang.String subId, java.lang.String classification)
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value, Type sourceType, java.lang.Object raiser)
           
 void putAll(java.util.Map t)
          Copies all of the mappings from the specified Map to this Hashtable These mappings will replace any mappings that this Hashtable had for any of the keys currently in the specified Map.
 void putInCacheArray(java.lang.Object key, java.lang.Object value)
           
 java.lang.Object remove(java.lang.Object key)
           
 void removeAllNLSWithPartitialKey(java.lang.String sourceKey)
           
 void removeNLS(java.lang.String xpath)
           
 void removeNLSChangeListener(NLSChangeListener listener)
           
static void removeStoredEmbeddedNLS(Document uiDOM)
           
 void replaceAllNLSWithPartitialKey(java.lang.String sourceKey, java.lang.String destKey)
           
static java.lang.String replaceVariables(java.lang.String text, java.lang.String[] variables)
           
static java.lang.String replaceXPathPointers(Type source, java.lang.String text)
          Replaces place holder for 'labels' and 'values' of a passing text.
static java.lang.String resolveKeyXPath(Type type)
           
static java.lang.String resolveKeyXPathFromXuiComponent(Type xuiType)
           
 void save(java.io.OutputStream out, java.lang.String header)
          Deprecated. This method does not throw an IOException if an I/O error occurs while saving the property list. As of the Java 2 platform v1.2, the preferred way to save a properties list is via the store(OutputStream out, String header) method.
 java.lang.Object searchInCacheArray(java.lang.Object o)
           
 java.lang.Object setProperty(java.lang.String key, java.lang.String value)
           
 void store(java.io.OutputStream out, java.lang.String header)
          Calls the store(OutputStream out, String header) method with the JAXFront.getDefaultFileEncoding!
 void store(Type contentType)
           
 void store(java.io.Writer out, java.lang.String header)
          Calls the store(Writer out, String header) method without any encodings!
 void storeAsSortedNLS(java.io.File file, java.lang.String rootTypeName)
           
static void storeEmbeddedNLS(Document uiDOM, NLS nls)
           
 void swapAllNLSWithPartitialKey(java.lang.String sourceKey, java.lang.String destKey)
           
 
Methods inherited from class com.jaxfront.core.util.LanguageEnhancedProperties
load, load
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, loadFromXML, propertyNames, storeToXML, storeToXML
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, size, toString, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

XPATH_DELIMITER

public static final java.lang.String XPATH_DELIMITER
See Also:
Constant Field Values

LABEL_DELIMITER

public static final java.lang.String LABEL_DELIMITER
See Also:
Constant Field Values

UNDEFINED_VALUE

public static final java.lang.String UNDEFINED_VALUE
See Also:
Constant Field Values

CLOSING_DELIMITER

public static final java.lang.String CLOSING_DELIMITER
See Also:
Constant Field Values

TAG_DELIMITER

public static final char TAG_DELIMITER

CONTEXT_TREE_ENTRY

public static final java.lang.String CONTEXT_TREE_ENTRY
See Also:
Constant Field Values

CONTEXT_LABEL

public static final java.lang.String CONTEXT_LABEL
See Also:
Constant Field Values

CONTEXT_PAGING

public static final java.lang.String CONTEXT_PAGING
See Also:
Constant Field Values

CONTEXT_CHOICE

public static final java.lang.String CONTEXT_CHOICE
See Also:
Constant Field Values

CONTEXT_CAPTION

public static final java.lang.String CONTEXT_CAPTION
See Also:
Constant Field Values

CONTEXT_HELP

public static final java.lang.String CONTEXT_HELP
See Also:
Constant Field Values

CONTEXT_MESSAGE

public static final java.lang.String CONTEXT_MESSAGE
See Also:
Constant Field Values

CONTEXT_LINE_INFO

public static final java.lang.String CONTEXT_LINE_INFO
See Also:
Constant Field Values

CONTEXT_LINE_INFO_PDF

public static final java.lang.String CONTEXT_LINE_INFO_PDF
See Also:
Constant Field Values

CONTEXT_DIALOG

public static final java.lang.String CONTEXT_DIALOG
See Also:
Constant Field Values

CONTEXT_CONTEXTDIALOG

public static final java.lang.String CONTEXT_CONTEXTDIALOG
See Also:
Constant Field Values

CONTEXT_DELETION_MESSAGE

public static final java.lang.String CONTEXT_DELETION_MESSAGE
See Also:
Constant Field Values

CONTEXT_MESSAGE_FORMULA

public static final java.lang.String CONTEXT_MESSAGE_FORMULA
See Also:
Constant Field Values

CONTEXT_LINE_INFO_TOOLTIP

public static final java.lang.String CONTEXT_LINE_INFO_TOOLTIP
See Also:
Constant Field Values

CONTEXT_MODE_VALIDATION_MESSAGE

public static final java.lang.String CONTEXT_MODE_VALIDATION_MESSAGE
See Also:
Constant Field Values

CLASSIFICATION_TOOL_TIP

public static final java.lang.String CLASSIFICATION_TOOL_TIP
See Also:
Constant Field Values
Constructor Detail

NLS

public NLS(java.lang.String nlsContentStream)
Creates an NLS according a NLS String stream representing the content of a language specific NLS.


NLS

public NLS()
Creates empty NLS properties.


NLS

public NLS(java.net.URL xsdURL,
           FingerPrint fingerPrint,
           java.lang.String language)
Construct NLS properties based on a fingerprint and a language. This will handle all includes.

Parameters:
fingerPrint - to create NLS properties from
language - nls language

NLS

public NLS(java.net.URL xsdURL,
           FingerPrint fingerPrint,
           java.lang.String language,
           boolean handleIncludes)
Construct NLS properties based on a fingerprint and a language. This will handle all includes.

Parameters:
fingerPrint - to create NLS properties from
language - nls language
handleIncludes - indicates if internal includes should be processed

NLS

public NLS(java.net.URL xsdURL,
           FingerPrint fingerPrint,
           java.lang.String language,
           boolean handleIncludes,
           boolean includesOnly)
Construct NLS properties based on a fingerprint and a language

Parameters:
fingerPrint - to create NLS properties from
language - nls language
handleIncludes - indicates if internal includes should be processed
includesOnly - process only included fingerprints

NLS

public NLS(java.net.URL xsdURL,
           Document uiDoc,
           FingerPrint fingerPrint,
           java.lang.String language,
           boolean handleIncludes,
           boolean includesOnly)
Construct NLS properties based on a fingerprint and a language

Parameters:
fingerPrint - to create NLS properties from
language - nls language
handleIncludes - indicates if internal includes should be processed
includesOnly - process only included fingerprints
Method Detail

hasIncludedNLS

public static boolean hasIncludedNLS(Document uiDoc)

hasIncludedNLS

public static boolean hasIncludedNLS(org.w3c.dom.Document w3cUIDoc)

get

public java.lang.String get(java.lang.String key)
Returns the translated value for a key

Parameters:
key - nls key

putAll

public void putAll(java.util.Map t)
Copies all of the mappings from the specified Map to this Hashtable These mappings will replace any mappings that this Hashtable had for any of the keys currently in the specified Map.

Specified by:
putAll in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
putAll in class java.util.Hashtable<java.lang.Object,java.lang.Object>
Parameters:
t - Mappings to be stored in this map.
Throws:
java.lang.NullPointerException - if the specified map is null.
Since:
1.2

get

public java.lang.String get(Type source,
                            java.lang.String key)
Returns the translated value for a source type and a key

Parameters:
source - type source
key - nls key

get

public java.lang.String get(Type source,
                            java.lang.String key,
                            java.lang.String[] variables)
Returns the translated value for a souce type and a key. The passing variables will replace % in the resulting nls text.

Parameters:
source - type source
key - nls key
variables - to replace %

replaceVariables

public static java.lang.String replaceVariables(java.lang.String text,
                                                java.lang.String[] variables)

replaceXPathPointers

public static java.lang.String replaceXPathPointers(Type source,
                                                    java.lang.String text)
Replaces place holder for 'labels' and 'values' of a passing text.

Parameters:
source - type souce
text - to replace
Returns:

hasChanged

public boolean hasChanged()

setProperty

public java.lang.Object setProperty(java.lang.String key,
                                    java.lang.String value)
Overrides:
setProperty in class java.util.Properties

save

public void save(java.io.OutputStream out,
                 java.lang.String header)
Deprecated. This method does not throw an IOException if an I/O error occurs while saving the property list. As of the Java 2 platform v1.2, the preferred way to save a properties list is via the store(OutputStream out, String header) method.

Calls the store(OutputStream out, String header) method and suppresses IOExceptions that were thrown. Uses the JAXFront.getDefaultFileEncoding!

Overrides:
save in class LanguageEnhancedProperties
Parameters:
out - an output stream.
header - a description of the property list.
Throws:
java.lang.ClassCastException - if this Properties object contains any keys or values that are not Strings.

store

public void store(java.io.OutputStream out,
                  java.lang.String header)
           throws java.io.IOException
Calls the store(OutputStream out, String header) method with the JAXFront.getDefaultFileEncoding!

Overrides:
store in class LanguageEnhancedProperties
Parameters:
out - an output stream.
header - a description of the property list.
Throws:
java.lang.ClassCastException - if this Properties object contains any keys or values that are not Strings.
java.io.IOException

store

public void store(java.io.Writer out,
                  java.lang.String header)
           throws java.io.IOException
Description copied from class: LanguageEnhancedProperties
Calls the store(Writer out, String header) method without any encodings!

Overrides:
store in class LanguageEnhancedProperties
Parameters:
out - an output stream.
header - a description of the property list.
Throws:
java.io.IOException

getNLSHeader

public static java.lang.String getNLSHeader()

store

public void store(Type contentType)
           throws java.io.IOException
Throws:
java.io.IOException

storeAsSortedNLS

public void storeAsSortedNLS(java.io.File file,
                             java.lang.String rootTypeName)
                      throws java.io.IOException
Throws:
java.io.IOException

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
put in class java.util.Hashtable<java.lang.Object,java.lang.Object>

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value,
                            Type sourceType,
                            java.lang.Object raiser)

createParamNLSKey

public static java.lang.String createParamNLSKey(Type nlsType,
                                                 java.lang.String paramSuffix,
                                                 int ruleIndex,
                                                 int actionIndex,
                                                 int paramIndex)

createParamNLSKey

public static java.lang.String createParamNLSKey(Type nlsType)

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
remove in class java.util.Hashtable<java.lang.Object,java.lang.Object>

removeNLS

public void removeNLS(java.lang.String xpath)

swapAllNLSWithPartitialKey

public void swapAllNLSWithPartitialKey(java.lang.String sourceKey,
                                       java.lang.String destKey)

removeAllNLSWithPartitialKey

public void removeAllNLSWithPartitialKey(java.lang.String sourceKey)

replaceAllNLSWithPartitialKey

public void replaceAllNLSWithPartitialKey(java.lang.String sourceKey,
                                          java.lang.String destKey)

insertRelativeNLS

public void insertRelativeNLS(java.net.URL location,
                              java.lang.String relativeTo)
                       throws java.io.IOException
Throws:
java.io.IOException

extractRelativeNLS

public java.util.Properties extractRelativeNLS(java.lang.String relativeTo)

getFormula

public java.lang.String getFormula(Type source,
                                   java.lang.String context,
                                   java.lang.String subId)

hasFormula

public boolean hasFormula(Type source,
                          java.lang.String context,
                          java.lang.String subId)

getTranslation

public java.lang.String getTranslation(Type source,
                                       java.lang.String defaultNLS,
                                       java.lang.String context,
                                       java.lang.String subId,
                                       java.lang.String classification)

searchInCacheArray

public java.lang.Object searchInCacheArray(java.lang.Object o)

clearSmallCash

public void clearSmallCash()

putInCacheArray

public void putInCacheArray(java.lang.Object key,
                            java.lang.Object value)

getNLSPageLayoutContext

public static java.lang.String getNLSPageLayoutContext(Type type)

nlsKey

public static java.lang.String nlsKey(Type source,
                                      java.lang.String xpath,
                                      java.lang.String context,
                                      java.lang.String subId,
                                      java.lang.String classification)

nlsKey

public static java.lang.String nlsKey(Type source,
                                      java.lang.String context,
                                      java.lang.String subId,
                                      java.lang.String classification)

getAllNLSFor

public java.util.Vector getAllNLSFor(Type aType)

getAllNLSFor

public java.util.Vector getAllNLSFor(java.lang.String typeXPath)

getAllNLSWithKey

public java.util.Vector getAllNLSWithKey(java.lang.String startsWith)

getAllNLSFor

public java.util.Vector getAllNLSFor(Type aType,
                                     java.lang.String context,
                                     boolean contextStartsWith)

getAllNLSFor

public java.util.Vector getAllNLSFor(java.lang.String typeXPath,
                                     java.lang.String context,
                                     boolean contextStartsWith)

convertAllNLSFor

public java.util.Hashtable convertAllNLSFor(Type sourceType,
                                            Type targetType,
                                            boolean updateNLS)

copyAllNLS

public java.util.Hashtable copyAllNLS(Type sourceType,
                                      Type targetType)

copyAllNLS

public java.util.Hashtable copyAllNLS(java.lang.String sourceXPath,
                                      java.lang.String targetXpath)

copyNLSWithKey

public void copyNLSWithKey(java.lang.String sourceKey,
                           java.lang.String targetKey)

copyNLSStartingWithKey

public void copyNLSStartingWithKey(java.lang.String sourceKey,
                                   java.lang.String targetKey)

moveAllListEntryNLS

public void moveAllListEntryNLS(ListType list,
                                java.lang.String context,
                                int from,
                                int to)

isInContext

public static boolean isInContext(java.lang.String key,
                                  java.lang.String context)

moveAllListEntryNLS

public void moveAllListEntryNLS(java.lang.String xpath,
                                java.lang.String context,
                                int from,
                                int to,
                                boolean removeSource)

convertAllNLSFor

public java.util.Hashtable convertAllNLSFor(java.lang.String sourceXPath,
                                            java.lang.String targetXPath,
                                            boolean updateNLS)

convertFromGlobalXPath

public static java.lang.String convertFromGlobalXPath(java.lang.String xpath)

resolveKeyXPath

public static java.lang.String resolveKeyXPath(Type type)

resolveKeyXPathFromXuiComponent

public static java.lang.String resolveKeyXPathFromXuiComponent(Type xuiType)

createKeyForXUIEditor

public static java.lang.String createKeyForXUIEditor(Type type,
                                                     java.lang.String context,
                                                     java.lang.String subId,
                                                     java.lang.String classification)
Create the right key for a context

Parameters:
type - the type

createTargetXPathForXUIEditor

public static java.lang.String createTargetXPathForXUIEditor(Type type)
Create the right key for a context

Parameters:
type - the type

addNLSChangeListener

public void addNLSChangeListener(NLSChangeListener listener)

removeNLSChangeListener

public void removeNLSChangeListener(NLSChangeListener listener)

getNLSListener

public java.util.List getNLSListener()

getLanguage

public java.lang.String getLanguage()

getSubId

public static java.lang.String getSubId(Type type)
Get the subid of the type (e.q. tablelayout 0,1,L,C ...)

Parameters:
type - the type for the context

getContext

public static java.lang.String getContext(Type type)
Get the context of the type (e.q. treeEntry, caption, ...)

Parameters:
type - the type for the context

removeStoredEmbeddedNLS

public static void removeStoredEmbeddedNLS(Document uiDOM)
                                    throws java.io.IOException
Throws:
java.io.IOException

storeEmbeddedNLS

public static void storeEmbeddedNLS(Document uiDOM,
                                    NLS nls)
                             throws java.io.IOException
Throws:
java.io.IOException