org.apache.beehive.netui.databinding.datagrid.api
Class DataGridResourceProvider

Object
  extended by DataGridResourceProvider

public abstract class DataGridResourceProvider
extends Object

This abstract class provides an abstraction used for obtaining messages and strings used during data grid rendering.


Constructor Summary
DataGridResourceProvider()
           
 
Method Summary
protected  ResourceBundle createResourceBundle(String path)
           
abstract  String formatMessage(String key, Object[] args)
          Abstract method used to format a pattern given a pattern / message key and an array of arguments.
 Locale getLocale()
          Accessor for obtaining the Locale used when looking up messages.
abstract  String getMessage(String key)
          Abstract method used to obtain a message String given a key
 String getResourceBundlePath()
          Accessor for obtaining the path to the resource bundle used by a DataGridResourceProvider implementation.
protected  String internalFormatMessage(String pattern, Object[] args)
          Internal convenience method that is used to format a message given a pattern and a set of arguments.
 boolean isEnableChaining()
          Accessor for determining if implementations are chaining enabled.
 void setEnableChaining(boolean enableChaining)
          Setter for enabling or disabling chaining
 void setLocale(Locale locale)
          Set the Locale in which a message String should be looked up.
 void setResourceBundlePath(String resourceBundlePath)
          Set the path used for creating a ResourceBundle object.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataGridResourceProvider

public DataGridResourceProvider()
Method Detail

getMessage

public abstract String getMessage(String key)
Abstract method used to obtain a message String given a key

Parameters:
key - the key used to lookup a String
Returns:
the returned String if a message is found matching the key

formatMessage

public abstract String formatMessage(String key,
                                     Object[] args)
Abstract method used to format a pattern given a pattern / message key and an array of arguments.

Parameters:
key - the key to use when looking up a message to format
args - the arguments to use when formatting a message
Returns:
the formatted message if a message is found matching the key

isEnableChaining

public boolean isEnableChaining()
Accessor for determining if implementations are chaining enabled. When chaining is enabled, subclasses must use any nested DataGridResourceProvider instances to lookup messages. When chaining is enabled, the default messages for the data grid will be returned. When chaining is disabled, implementations are free to hide message keys.

Returns:
true if chaining is enabled; false otherwise

setEnableChaining

public void setEnableChaining(boolean enableChaining)
Setter for enabling or disabling chaining

Parameters:
enableChaining - the new chaining enabled value

setLocale

public void setLocale(Locale locale)
Set the Locale in which a message String should be looked up.

Parameters:
locale - the Locale to use

getLocale

public Locale getLocale()
Accessor for obtaining the Locale used when looking up messages.

Returns:
the Locale used for message lookup or null if no Locale was set

setResourceBundlePath

public void setResourceBundlePath(String resourceBundlePath)
Set the path used for creating a ResourceBundle object.

Parameters:
resourceBundlePath - the path to a resource bundle

getResourceBundlePath

public String getResourceBundlePath()
Accessor for obtaining the path to the resource bundle used by a DataGridResourceProvider implementation.

Returns:
the path to the ResourceBundle

createResourceBundle

protected ResourceBundle createResourceBundle(String path)

internalFormatMessage

protected String internalFormatMessage(String pattern,
                                       Object[] args)
Internal convenience method that is used to format a message given a pattern and a set of arguments.

Parameters:
pattern - the pattern to format
args - the arguments to use when formatting
Returns:
the formatted string