Poseidon for UMLTM
  UMLdoc
 PREV  CLASSIFIER    NEXT  CLASSIFIER     FRAMES    NO FRAMES      
SUMMARY:   INNER | ATTR | ASSOC | CONSTR | METHOD     DETAIL:   INNER | ATTR | ASSOC | CONSTR | METHOD     DIAGRAMS:   COLLAB | SEQ | STATE | ACTIV

com.gentleware.poseidon.openapi

Class PoseidonResourceConnector

com.gentleware.poseidon.openapi.PoseidonResourceConnector

public final class PoseidonResourceConnector


Facade to Plugins that want to address Poseidon's resource loading process. This class is of interest to plugins that want internationalization (i18n, for short) or provide their own icons.
Authors:
JvV


 Constructor Summary
private   PoseidonResourceConnector()
 
arrow_up
 

 Method Summary
public static void   addLanguageResource(String binding, String resourceName, ClassLoader pluginLoader)
Adds a class or a property file to the i18n lookup list. 
public static void   addResourceLocation(String filepath, ClassLoader loader)
Adds a directory that is searched when a resource is requested. 
public static String   getConfigurationValue(String key)
Reads a value from the tool's configuration file. 
public static KeyStroke   getShortcut(String name, String key)
Translates a shortcut placed in the named resource. 
public static KeyStroke   getShortcut(ResourceId resourceId)
 
public static String   localize(ResourceId resourceId)
Translates a key placed in the named resource. 
public static void   putConfigurationValue(String key, String value)
Writes a value to the tool's configuration file to make it persistent across sessions. 
public static void   removeLanguageResource(String name)
Removes a file from the i18n lookup list. 
public static void   removeResourceLocation(String filepath)
Removes a directory from the resource lookup list. 
arrow_up
 

Tagged Values
static false
 

 Constructor Detail

PoseidonResourceConnector

private PoseidonResourceConnector PoseidonResourceConnector()

Returns:
arrow_up
 Method Detail

addLanguageResource

public static void addLanguageResource(String binding, String resourceName, ClassLoader pluginLoader)


Adds a class or a property file to the i18n lookup list. The given file must be a Properties file, that is, it contains a bunch of lines like 'key=value'.

The localization system then determines which locale the program is in. This can also be set via the environment variable LANG, by the way, or by giving the JVM the parameters -Duser.language= and -Duser.region= . Every localization call receives a resource name String and a key String. The localizer retrieves a file based on the resource name and the locale, and looks for a string for the given key.

The default, English bundle has the given name; all other languages have their own file, named just like the English file with an extension of the locale. The German i18n file ends in _de, the Spanish one in _es, the Taiwanese in _zh_TW, etc.

You only need to register the English bundle under your preferred name, and the retrieval of the correctly localized file is done automagically. You only need to call localize(bundleName, key) to i18nize a String.  

Parameters:
binding - The alias/binding/shortName for the resource.
resourceName - The full bundle name (ie, with package qualification) of the file containing the localization strings.
pluginLoader - The classloader responsible for loading the bundle. May be null, so that Poseidon's default class loader is used.
arrow_up


addResourceLocation

public static void addResourceLocation(String filepath, ClassLoader loader)


Adds a directory that is searched when a resource is requested.  
Parameters:
filepath - The location, in directory format. E.g., /com/gentleware/poseidon/resources.
loader -
arrow_up


getConfigurationValue

public static String getConfigurationValue(String key)


Reads a value from the tool's configuration file.  
Parameters:
key - The key of the value that should be read.
Returns:
The value or the empty string, never null.
arrow_up


getShortcut

public static KeyStroke getShortcut(String name, String key)


Translates a shortcut placed in the named resource. If the shortcut was not found in the i18ned resource, the default (English) shortcut is returned. If the shortcut was not found at all, null is returned.  
Parameters:
name -
key -
Returns:
arrow_up


getShortcut

public static KeyStroke getShortcut(ResourceId resourceId)

Parameters:
resourceId -
Returns:
arrow_up


localize

public static String localize(ResourceId resourceId)


Translates a key placed in the named resource.

If the key is not present in the i18ned bundle, the default value (in the English bundle) is returned. If the key is not present in the bundle at all, the key itself is returned.  

Parameters:
resourceId -
Returns:
arrow_up


putConfigurationValue

public static void putConfigurationValue(String key, String value)


Writes a value to the tool's configuration file to make it persistent across sessions.  
Parameters:
key - A unique identifier for the value. Please choose a unique value, e.g. by using your company's name and/or your plugin name as prefix.
value - The value you want to store.
arrow_up


removeLanguageResource

public static void removeLanguageResource(String name)


Removes a file from the i18n lookup list.

Should be called when a plugin is turned off. If you remove the wrong resource, i18n of other parts of Poseidon may become defunct.  

Parameters:
name -
arrow_up


removeResourceLocation

public static void removeResourceLocation(String filepath)


Removes a directory from the resource lookup list.

Should be called when a plugin is turned off.  

Parameters:
filepath -
arrow_up
Created  2004 - 10 - 21

    Poseidon for UMLTM
  UMLdoc
 PREV  CLASSIFIER    NEXT  CLASSIFIER     FRAMES    NO FRAMES      
SUMMARY:   INNER | ATTR | ASSOC | CONSTR | METHOD     DETAIL:   INNER | ATTR | ASSOC | CONSTR | METHOD     DIAGRAMS:   COLLAB | SEQ | STATE | ACTIV

Generated with Poseidon for UMLTM.
Poseidon is a registered trademark of Gentleware AG in Germany, USA and other countries. Copyright 2003-2004 Gentleware AG, Schanzenstr. 70, 20357 Hamburg, Germany. All Rights Reserved.

UML is a trademark or registered trademark of Object Management Group, Inc. in the U.S. and other countries.