|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.metamatrix.console.ui.util.property.PropertyProvider
public class PropertyProvider
The PropertyProvider
class provides property values on request.
It can be configured to look at one or more property files in a predetermined
order looking for properties. The first occurrence of the property is returned.
This class uses the UIStandards
class to read the property files and
to obtain the property values.
Field Summary | |
---|---|
static java.lang.String |
COMMON_PROP
The common properties file used by the Console. |
static java.lang.String |
DEFAULT_ERROR_PREFIX
The default error prefix is "**". |
protected javax.swing.AbstractButton |
DO_NOT_USE_1
Declared just to get rid of javadoc warning. |
protected ObjectPropertyManager |
DO_NOT_USE_2
Declared just to get rid of javadoc warning. |
Constructor Summary | |
---|---|
PropertyProvider(java.util.List thePropertiesCollection)
Constructs a PropertyProvider that has one or more
property files associated with it. |
|
PropertyProvider(java.lang.String thePropertiesFile)
Constructs a PropertyProvider that has only one
properties file associated with it. |
Method Summary | |
---|---|
boolean |
getBoolean(java.lang.String theKey)
Gets the value of the given property as a boolean . |
static PropertyProvider |
getDefault()
A provider configured only to use COMMON_PROP . |
java.lang.String |
getErrorPrefix()
Gets the error prefix. |
javax.swing.Icon |
getIcon(java.lang.String theKey)
Gets the icon associated with the given property. |
int |
getInt(java.lang.String theKey,
int theDefault)
Gets the value of the given property as an int . |
static javax.swing.Icon |
getMissingIcon()
Gets the Icon used when the requested one cannot be found. |
java.lang.Object |
getObject(java.lang.String theKey)
Gets the value of the given property as an Object . |
java.lang.String |
getPropertiesFile(java.lang.String theKey)
Gets the first properties file name where the property was found. |
java.lang.String |
getString(java.lang.String theKey)
Gets the requested property value. |
java.lang.String |
getString(java.lang.String theKey,
boolean theReturnNullFlag)
Gets the requested property value. |
java.lang.String |
getString(java.lang.String theKey,
java.lang.Object[] theArgs)
Gets the requested property value and inserts the argument element(s) into the returned message. |
void |
setErrorPrefix(java.lang.String theErrorPrefix)
Sets the error prefix. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_ERROR_PREFIX
public static final java.lang.String COMMON_PROP
protected javax.swing.AbstractButton DO_NOT_USE_1
protected ObjectPropertyManager DO_NOT_USE_2
Constructor Detail |
---|
public PropertyProvider(java.lang.String thePropertiesFile)
PropertyProvider
that has only one
properties file associated with it.
thePropertiesFile
- the name of the properties file
java.lang.IllegalArgumentException
- if argument is null
or
emptypublic PropertyProvider(java.util.List thePropertiesCollection)
PropertyProvider
that has one or more
property files associated with it.
thePropertiesCollection
- a collection of property files
java.lang.IllegalArgumentException
- if argument is null
or
empty, or if any of the arguments elements are null
, not
a String
, or an empty String
Method Detail |
---|
public boolean getBoolean(java.lang.String theKey)
boolean
. Here is
an example properties file entry:filename.required="true"
theKey
- the property whose value is being requested
boolean
or
false
if property not foundpublic static PropertyProvider getDefault()
COMMON_PROP
.
public java.lang.String getErrorPrefix()
public javax.swing.Icon getIcon(java.lang.String theKey)
icon.back="com/metamatrix/console/images/back_medium.gif"
theKey
- the property whose value is being requested
Icon
or a generic
icon if not foundgetMissingIcon()
public int getInt(java.lang.String theKey, int theDefault)
int
. Here is
an example properties file entry:portnum.default="15001"
theKey
- the property whose value is being requestedtheDefault
- the default value
int
or the default
value if the property is not foundpublic static javax.swing.Icon getMissingIcon()
Icon
used when the requested one cannot be found.
Icon
used when the requested one cannot be foundpublic java.lang.Object getObject(java.lang.String theKey)
Object
. Here is
an example properties file entry:importexport.extensions=new String[] {"xml"}
theKey
- the property whose value is being requested
Object
or null
if not foundpublic java.lang.String getPropertiesFile(java.lang.String theKey)
theKey
- the property whose value is being requested
public java.lang.String getString(java.lang.String theKey)
getString
never returns null
. If the property cannot be found, the
property name is prepended with the error prefix and returned.
theKey
- the property whose value is being requested
public java.lang.String getString(java.lang.String theKey, boolean theReturnNullFlag)
theReturnNullFlag
is true
a null
value is returned if the
property cannot be found. If set to false
and the
property cannot be found, the property name is prepended with the
error prefix and returned.
theKey
- the property whose value is being requestedtheReturnNullFlag
- indicates if null
should be
returned if the property is not found
null
public java.lang.String getString(java.lang.String theKey, java.lang.Object[] theArgs)
confirmdelete.title="Delete Host {0}"
theKey
- the property whose value is being requestedtheArgs
- the arguments being inserted into the property value
null
if not foundpublic void setErrorPrefix(java.lang.String theErrorPrefix)
null
or empty,
the default prefix is used.
theErrorPrefix
- the new error prefixDEFAULT_ERROR_PREFIX
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |