com.wewebu.ow.server.util
Class OwString

java.lang.Object
  extended by com.wewebu.ow.server.util.OwString
Direct Known Subclasses:
OwString1, OwString2, OwString3

public class OwString
extends Object

Utility class OwString. Used to localize strings.

NOTE: The class name OwString can be found by the FileNet Resourcecompiler.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Field Summary
static String LABEL_PREFIX
          prefix for labels
protected  String m_strDefaultDisplayName
          default displayname if key was not found
protected  String m_strKeyName
          key for localization
 
Constructor Summary
OwString(String strLabel_p)
          construct a label (symbolic name or metadata) that can be localized later using getString(Locale locale_p)
OwString(String strKeyyName_p, String strDefaultDisplayName_p)
          construct a string that can be localized later using getString(Locale locale_p)
OwString(String strLabelOrKey_p, String strDefaultDisplayName_p, boolean fTreatAsLabel_p)
          construct a string that can be localized later using getString(Locale locale_p)
 
Method Summary
 String getDefaultDisplayName()
          get the default displayname
 String getKey()
          get the key
 String getString(Locale locale_p)
          localize this String
static boolean hasLabel(Locale local_p, String strLabel_p)
          check if a label (symbolic name or metadata) is defined
static String localize(Locale local_p, String strKey_p, String strText_p)
          localizes a string
static String localize1(Locale local_p, String strKey_p, String strText_p, String strAttribute1_p)
          localizes a string with additional parameter that is replaced with %1
static String localize2(Locale local_p, String strKey_p, String strText_p, String strAttribute1_p, String strAttribute2_p)
          localizes a string with additional parameter that is replaced with %1
static String localize3(Locale local_p, String strKey_p, String strText_p, String strAttribute1_p, String strAttribute2_p, String strAttribute3_p)
          localizes a string with additional parameter that is replaced with %1
static String localizeLabel(Locale local_p, String strLabel_p)
          localizes a label (symbolic name or metadata)
static String localizeLabel(Locale local_p, String strLabel_p, String strDefault_p)
          localizes a label (symbolic name or metadata)
static void putAll(Locale locale_p, Map properties_p)
          Adds the given key mapped localization properties to the current text mappings.
static void putLabel(Locale locale_p, String key_p, String label_p)
          Adds the given key mapped label to the current text mappings.
static void replaceAll(StringBuffer strIn_p, String strPattern_p, String strReplacement_p)
          replaces all occurrences of strPattern_p with strReplacement_p
static void replaceAll(StringBuilder strIn_p, String pattern_p, String replacement_p)
          Replace all occurrences of the provided pattern with the replacement String.
static String replaceAll(String strIn_p, String strPattern_p, String strReplacement_p)
          replaces all occurrences of strPattern_p with strReplaceMent_p NOTE: This function might be replaced by String.replaceAll(...) function, which is provided in JDK 1.4.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_strKeyName

protected String m_strKeyName
key for localization


m_strDefaultDisplayName

protected String m_strDefaultDisplayName
default displayname if key was not found


LABEL_PREFIX

public static final String LABEL_PREFIX
prefix for labels

See Also:
Constant Field Values
Constructor Detail

OwString

public OwString(String strKeyyName_p,
                String strDefaultDisplayName_p)
construct a string that can be localized later using getString(Locale locale_p)

Parameters:
strKeyyName_p - String unique localize key for display name
strDefaultDisplayName_p - String default display name

OwString

public OwString(String strLabelOrKey_p,
                String strDefaultDisplayName_p,
                boolean fTreatAsLabel_p)
construct a string that can be localized later using getString(Locale locale_p)

Parameters:
strLabelOrKey_p - String (like a symbolic name) or a unique key
strDefaultDisplayName_p - String default display name
fTreatAsLabel_p - boolean true = strLabelOrKey_p is a label, false = strLabelOrKey_p is a unique key

OwString

public OwString(String strLabel_p)
construct a label (symbolic name or metadata) that can be localized later using getString(Locale locale_p)

Parameters:
strLabel_p - String label (like a symbolic name)
Method Detail

getKey

public String getKey()
get the key


getDefaultDisplayName

public String getDefaultDisplayName()
get the default displayname


toString

public String toString()
Overrides:
toString in class Object

getString

public String getString(Locale locale_p)
localize this String

Parameters:
locale_p - Locale to use
Returns:
localized String

replaceAll

public static void replaceAll(StringBuffer strIn_p,
                              String strPattern_p,
                              String strReplacement_p)
replaces all occurrences of strPattern_p with strReplacement_p

Parameters:
strIn_p - StringBuffer to replace
strPattern_p - String to look for
strReplacement_p - replacement string

replaceAll

public static void replaceAll(StringBuilder strIn_p,
                              String pattern_p,
                              String replacement_p)
Replace all occurrences of the provided pattern with the replacement String.

Parameters:
strIn_p - StringBuilder
pattern_p - String pattern to replace
replacement_p - String replacement for pattern
Since:
3.2.0.0

replaceAll

public static String replaceAll(String strIn_p,
                                String strPattern_p,
                                String strReplacement_p)
replaces all occurrences of strPattern_p with strReplaceMent_p NOTE: This function might be replaced by String.replaceAll(...) function, which is provided in JDK 1.4. For JDK 1.3 compliance we need to write our own replace function

Parameters:
strIn_p - String to replace
strPattern_p - String to look for
strReplacement_p - replacement string
Returns:
the new replaced string

localizeLabel

public static String localizeLabel(Locale local_p,
                                   String strLabel_p)
localizes a label (symbolic name or metadata)

Parameters:
local_p - Locale to use
strLabel_p - label that should be localized
Returns:
String localized String

hasLabel

public static boolean hasLabel(Locale local_p,
                               String strLabel_p)
check if a label (symbolic name or metadata) is defined

Parameters:
local_p - Locale to use
strLabel_p - label that should be localized
Returns:
String localized String

localize

public static String localize(Locale local_p,
                              String strKey_p,
                              String strText_p)
localizes a string

Parameters:
local_p - Locale to use
strKey_p - Key value used to retrieve localized string from resource
strText_p - current language Text
Returns:
String localized strText_p

localizeLabel

public static String localizeLabel(Locale local_p,
                                   String strLabel_p,
                                   String strDefault_p)
localizes a label (symbolic name or metadata)

Parameters:
local_p - Locale to use
strLabel_p - label that should be localized
strDefault_p - default if label does not exist
Returns:
String localized String

localize1

public static String localize1(Locale local_p,
                               String strKey_p,
                               String strText_p,
                               String strAttribute1_p)
localizes a string with additional parameter that is replaced with %1

Parameters:
local_p - Locale to use
strKey_p - Key value used to retrieve localized string from resource
strText_p - current language Text
strAttribute1_p - String that replaces %1 tokens
Returns:
String localized strText_p

localize2

public static String localize2(Locale local_p,
                               String strKey_p,
                               String strText_p,
                               String strAttribute1_p,
                               String strAttribute2_p)
localizes a string with additional parameter that is replaced with %1

Parameters:
local_p - Locale to use
strKey_p - Key value used to retrieve localized string from resource
strText_p - current language Text
strAttribute1_p - String that replaces %1 tokens
strAttribute2_p - String that replaces %2 tokens
Returns:
String localized strText_p

localize3

public static String localize3(Locale local_p,
                               String strKey_p,
                               String strText_p,
                               String strAttribute1_p,
                               String strAttribute2_p,
                               String strAttribute3_p)
localizes a string with additional parameter that is replaced with %1

Parameters:
local_p - Locale to use
strKey_p - Key value used to retrieve localized string from resource
strText_p - current language Text
strAttribute1_p - String that replaces %1 tokens
strAttribute2_p - String that replaces %2 tokens
strAttribute3_p - String that replaces %3 tokens
Returns:
String localized strText_p

putAll

public static void putAll(Locale locale_p,
                          Map properties_p)
                   throws Exception
Adds the given key mapped localization properties to the current text mappings.

Parameters:
locale_p -
properties_p -
Throws:
Exception
Since:
3.1.0.5

putLabel

public static void putLabel(Locale locale_p,
                            String key_p,
                            String label_p)
                     throws Exception
Adds the given key mapped label to the current text mappings. The LABEL_PREFIX is added to the given key.

Parameters:
locale_p -
key_p -
label_p -
Throws:
Exception
Since:
3.1.0.5


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.