net.sf.jeters.util
Class AssistedComponent

java.lang.Object
  extended by net.sf.jeters.util.AssistedComponent
All Implemented Interfaces:
Configurable, Translatable
Direct Known Subclasses:
DefaultGUI, MediaWikiIO, RegExReplacer

public abstract class AssistedComponent
extends java.lang.Object
implements Configurable, Translatable

superclass offering the combined benefits of AssistedConfigurable and AssistedTranslatable

Author:
Tobias Knerr

Constructor Summary
AssistedComponent()
           
 
Method Summary
 Configuration getConfiguration()
          this method is called to retrieve the current configuration for this component.
 void setConfiguration(Configuration configuration)
          sets the configuration for this object.
 void setLanguageResourceBundle(java.util.ResourceBundle langRB)
          sets the ResourceBundle that contains the messages to use
protected  java.lang.String str(java.lang.String key)
          returns the language-specific string identified by the given key
protected  java.lang.String str(java.lang.String key, java.lang.Object... arguments)
          returns the language-specific string identified by the given key and replaces placeholders ({0}, {1}, ...) in the string with the arguments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssistedComponent

public AssistedComponent()
Method Detail

getConfiguration

public Configuration getConfiguration()
Description copied from interface: Configurable
this method is called to retrieve the current configuration for this component. It will e.g. be used for storing changes made during component usage to the configuration file. If it is called before setConfiguration, a default configuration for this component is expected to be returned (which is used, among other things, for creating the initial config file).

Specified by:
getConfiguration in interface Configurable
Returns:
configuration currently used by the component; not null

setConfiguration

public void setConfiguration(Configuration configuration)
Description copied from interface: Configurable
sets the configuration for this object. The referenced configuration will not change after being passed to configurationSet. However, it is possible that setConfiguration is called again. This will not happen during execution of other component methods. Any config passed to setConfiguration is guaranteed to include at least those configuration entries that were included in a previous getConfiguration result, thus you needn't check for missing entries. The object must not rely on this method being called. Instead, it then has to work with a default configuration.

Specified by:
setConfiguration in interface Configurable
Parameters:
configuration - configuration to be used by the component; not null

setLanguageResourceBundle

public void setLanguageResourceBundle(java.util.ResourceBundle langRB)
Description copied from interface: Translatable
sets the ResourceBundle that contains the messages to use

Specified by:
setLanguageResourceBundle in interface Translatable
Parameters:
langRB - ResourceBundle to retrieve Strings from

str

protected java.lang.String str(java.lang.String key)
returns the language-specific string identified by the given key

Parameters:
key - string identifier used in the properties files
Returns:
string associated with key

str

protected java.lang.String str(java.lang.String key,
                               java.lang.Object... arguments)
returns the language-specific string identified by the given key and replaces placeholders ({0}, {1}, ...) in the string with the arguments

Parameters:
key - string identifier used in the properties files
arguments - object whose .toString() output is used to replace placeholders in the string
Returns:
string associated with key, with placeholders replaced with arguments