com.jaxfront.core.xui
Class NLS

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap
          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

public class NLS
extends LanguageEnhancedProperties

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

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
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_PRINTING
           
static java.lang.String CONTEXT_SERIAL_LIST_ADD
           
static java.lang.String CONTEXT_TREE_ENTRY
           
static java.lang.String CONTEXT_WATERMARK
           
static java.lang.String CUSTOM_IDENTIFIER
           
static java.lang.String LABEL_DELIMITER
           
static java.lang.String LANG_INDEPENDENT_IDENTIFIER
           
static java.lang.String REFERENCE_KEY_IDENTIFIER_CLOSE
           
static java.lang.String REFERENCE_KEY_IDENTIFIER_OPEN
           
static char TAG_DELIMITER
           
static java.lang.String UNDEFINED_VALUE
           
static java.lang.String XPATH_DELIMITER
           
 
Constructor Summary
NLS()
          Creates empty NLS properties.
NLS(NLS nls)
           
NLS(java.lang.String nlsContentStream, java.lang.String id)
          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, java.lang.String[] nlsLanguageSequence, 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)
           
NLS(java.net.URL xsdURL, FingerPrint fingerPrint, java.lang.String language, java.lang.String[] nlsLanguageSequence)
          Construct NLS properties based on a fingerprint and a language.
NLS(java.net.URL xsdURL, FingerPrint fingerPrint, java.lang.String language, java.lang.String[] nlsLanguageSequence, boolean handleIncludes)
          Construct NLS properties based on a fingerprint and a language.
NLS(java.net.URL xsdURL, FingerPrint fingerPrint, java.lang.String language, java.lang.String[] nlsLanguageSequence, 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(java.lang.String key, java.lang.String defaultVal)
          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)
           
 java.lang.String getResourceID()
           
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)
           
 java.lang.Object searchInCacheArray(java.lang.Object o)
           
 java.lang.Object setProperty(java.lang.String key, java.lang.String value)
           
 void setResourceID(java.lang.String id)
           
 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
getProperty, load, load
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

CLASSIFICATION_TOOL_TIP

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

CLOSING_DELIMITER

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

CONTEXT_CAPTION

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

CONTEXT_CHOICE

public static final java.lang.String CONTEXT_CHOICE
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_DIALOG

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

CONTEXT_HELP

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

CONTEXT_LABEL

public static final java.lang.String CONTEXT_LABEL
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_LINE_INFO_TOOLTIP

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

CONTEXT_MESSAGE

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

CONTEXT_MESSAGE_FORMULA

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

CONTEXT_MODE_VALIDATION_MESSAGE

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

CONTEXT_PAGING

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

CONTEXT_PRINTING

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

CONTEXT_SERIAL_LIST_ADD

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

CONTEXT_TREE_ENTRY

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

CONTEXT_WATERMARK

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

CUSTOM_IDENTIFIER

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

LABEL_DELIMITER

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

LANG_INDEPENDENT_IDENTIFIER

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

REFERENCE_KEY_IDENTIFIER_CLOSE

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

REFERENCE_KEY_IDENTIFIER_OPEN

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

TAG_DELIMITER

public static final char TAG_DELIMITER

UNDEFINED_VALUE

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

XPATH_DELIMITER

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

NLS

public NLS()
Creates empty NLS properties.


NLS

public NLS(NLS nls)

NLS

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


NLS

public NLS(java.net.URL xsdURL,
           Document uiDoc,
           FingerPrint fingerPrint,
           java.lang.String language,
           java.lang.String[] nlsLanguageSequence,
           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,
           FingerPrint fingerPrint,
           java.lang.String language)

NLS

public NLS(java.net.URL xsdURL,
           FingerPrint fingerPrint,
           java.lang.String language,
           java.lang.String[] nlsLanguageSequence)
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,
           java.lang.String[] nlsLanguageSequence,
           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,
           java.lang.String[] nlsLanguageSequence,
           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

addNLSChangeListener

public void addNLSChangeListener(NLSChangeListener listener)

clearSmallCash

public void clearSmallCash()

convertAllNLSFor

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

convertAllNLSFor

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

convertFromGlobalXPath

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

copyAllNLS

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

copyAllNLS

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

copyNLSStartingWithKey

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

copyNLSWithKey

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

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

createParamNLSKey

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

createParamNLSKey

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

createTargetXPathForXUIEditor

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

Parameters:
type - the type

extractRelativeNLS

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

get

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

Parameters:
key - nls key

get

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

Parameters:
key - nls key

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 %

getAllNLSFor

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

getAllNLSFor

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

getAllNLSFor

public java.util.Vector getAllNLSFor(Type aType)

getAllNLSFor

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

getAllNLSWithKey

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

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

getFormula

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

getLanguage

public java.lang.String getLanguage()

getNLSHeader

public static java.lang.String getNLSHeader()

getNLSListener

public java.util.List getNLSListener()

getNLSPageLayoutContext

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

getResourceID

public java.lang.String getResourceID()

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

getTranslation

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

hasChanged

public boolean hasChanged()

hasFormula

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

hasIncludedNLS

public static boolean hasIncludedNLS(Document uiDoc)

hasIncludedNLS

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

insertRelativeNLS

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

isInContext

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

moveAllListEntryNLS

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

moveAllListEntryNLS

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

nlsKey

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

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)

put

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

put

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

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
Overrides:
putAll in class java.util.HashMap
Parameters:
t - Mappings to be stored in this map.
Throws:
java.lang.NullPointerException - if the specified map is null.
Since:
1.2

putInCacheArray

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

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map
Overrides:
remove in class java.util.HashMap

removeAllNLSWithPartitialKey

public void removeAllNLSWithPartitialKey(java.lang.String sourceKey)

removeNLS

public void removeNLS(java.lang.String xpath)

removeNLSChangeListener

public void removeNLSChangeListener(NLSChangeListener listener)

removeStoredEmbeddedNLS

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

replaceAllNLSWithPartitialKey

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

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:

resolveKeyXPath

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

resolveKeyXPathFromXuiComponent

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

searchInCacheArray

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

setProperty

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

setResourceID

public void setResourceID(java.lang.String id)

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(Type contentType)
           throws java.io.IOException
Throws:
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

storeAsSortedNLS

public void storeAsSortedNLS(java.io.File file,
                             java.lang.String rootTypeName)
                      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

swapAllNLSWithPartitialKey

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