LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.misc
Class LyResourceBundle

java.lang.Object
  extended by leon.misc.LyResourceBundle
Direct Known Subclasses:
LyColors, LyFiles, LyFonts, LyImages, LyResources, LyStrings

public abstract class LyResourceBundle
extends java.lang.Object

This class is used to manage the resources of an application. It is based on the resource bundle mechanism used in the Java language. The resources must be contained in properties files (such as strings_fr.properties). See the javadoc of ResourceBundle for more details on how to declare these files). Its attributes are :

This class must be inherited in order to manage a given type of resources (files, colors, strings...).

See Also:
ResourceBundle

Field Summary
static java.lang.String __VERSION
           
static java.lang.String PACKAGE_DIR
           
static java.lang.String PROPERTIES_DIR
           
static boolean UPPER_CASE_KEYS_ONLY
           
 
Constructor Summary
LyResourceBundle(LyEnvironment environment)
          Constructor with a given environment.
LyResourceBundle(LyEnvironment environment, java.lang.String name)
          Constructor with a given environment and name.
 
Method Summary
 boolean checkKey(java.lang.String key, boolean checkAll)
          Check if the given key is found in this resource bundle.
 void clearCache()
          Clears cache for this resource bundle.
 void free()
          Clear all resources of this bundle.
 java.lang.String get(java.lang.String key)
          Return the String corresponding to the key passed.
 java.util.Vector<java.lang.String> getKeyList(boolean addParent)
          Gets the list of keys from extra resources, generic ResourceBundle and application ResourceBundle.
 java.util.Enumeration<java.lang.String> getKeys(boolean addParent)
          Gets the list of keys from extra resources, generic ResourceBundle and application ResourceBundle.
static java.util.ArrayList<LyEnvironment> getSonEnvironments(LyEnvironment parent)
          Find the son environments from specified parent
 boolean hasKey(java.lang.String key)
          Check if the given key is found in this resource bundle.
 void put(java.lang.String key, java.lang.String value)
          Adds a resource in this resource bundle.
 void remove(java.lang.String key)
          Removes a resource from this resource bundle.
static void removeBundles(LyEnvironment environment)
          Free all resource bundles of the given environment.
 void saveTo(java.lang.String dir)
          Save resource bundle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

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

PROPERTIES_DIR

public static java.lang.String PROPERTIES_DIR

PACKAGE_DIR

public static java.lang.String PACKAGE_DIR

UPPER_CASE_KEYS_ONLY

public static boolean UPPER_CASE_KEYS_ONLY
Constructor Detail

LyResourceBundle

public LyResourceBundle(LyEnvironment environment)
Constructor with a given environment. Calls LyResourceBundle(environment, null, null)

Parameters:
environment - The environment of the bundle.

LyResourceBundle

public LyResourceBundle(LyEnvironment environment,
                        java.lang.String name)
Constructor with a given environment and name. Calls LyResourceBundle(environment, name, null)

Parameters:
environment - The environment of the bundle.
name - The name of the resource bundle.
Method Detail

getSonEnvironments

public static java.util.ArrayList<LyEnvironment> getSonEnvironments(LyEnvironment parent)
Find the son environments from specified parent

Parameters:
parent - parent environment
Returns:
son environments (which parent is the specified arg)

removeBundles

public static void removeBundles(LyEnvironment environment)
Free all resource bundles of the given environment.

Parameters:
environment - the environment whose resource bundles must be freed

free

public void free()
Clear all resources of this bundle.


clearCache

public void clearCache()
Clears cache for this resource bundle. Reset the internal _lastKey and _lastValue attribute.


get

public java.lang.String get(java.lang.String key)
Return the String corresponding to the key passed.

Parameters:
key - The key to search
Returns:
The corresponding value or null if not found.

checkKey

public boolean checkKey(java.lang.String key,
                        boolean checkAll)
Check if the given key is found in this resource bundle.

Parameters:
key - the key to search
checkAll - if true, we check the existence in the application and in the AE properties. If false we only look in the application
Returns:
true if the key was found.

hasKey

public boolean hasKey(java.lang.String key)
Check if the given key is found in this resource bundle.

Parameters:
key - the key to search
Returns:
true if the key was found.

put

public void put(java.lang.String key,
                java.lang.String value)
Adds a resource in this resource bundle. Key and value must not be null.

Parameters:
key - Key of the resource.
value - Value of this new resource.

remove

public void remove(java.lang.String key)
Removes a resource from this resource bundle.

Parameters:
key - Key of the removed resource.

getKeyList

public java.util.Vector<java.lang.String> getKeyList(boolean addParent)
Gets the list of keys from extra resources, generic ResourceBundle and application ResourceBundle.

Parameters:
addParent - Boolean indicating if parent keys are added or not in result.
Returns:
The enumeration of all this bundle keys.

getKeys

public java.util.Enumeration<java.lang.String> getKeys(boolean addParent)
Gets the list of keys from extra resources, generic ResourceBundle and application ResourceBundle.

Parameters:
addParents - Boolean indicating if parent keys are added or not in result.
Returns:
The enumeration of all this bundle keys.

saveTo

public void saveTo(java.lang.String dir)
Save resource bundle.


(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com