Package com.aoindustries.util.i18n
Class ModifiablePropertiesResourceBundle
- java.lang.Object
-
- java.util.ResourceBundle
-
- com.aoindustries.util.i18n.ModifiableResourceBundle
-
- com.aoindustries.util.i18n.ModifiablePropertiesResourceBundle
-
- Direct Known Subclasses:
EditableResourceBundle
public abstract class ModifiablePropertiesResourceBundle extends ModifiableResourceBundle
Wraps the resources with XHTML and scripts to allow the modification of the resource bundle contents directly through the web interface. Also adds an indicator when the resource need to be verified. Verification is required when any other locale has a modified time greater than the verified time of this locale.
The properties file should have the same name as this class, including any language or locale. For instance, class
com.aoindustries.swing.ApplicationResources_ja
would load its properties fromcom/aoindustries/swing/ApplicationResources_ja.properties
.Idea: Occasionally check sourceFile and reload properties if externally modified.
- Author:
- AO Industries, Inc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.ResourceBundle
ResourceBundle.Control
-
-
Field Summary
Fields Modifier and Type Field Description static Comparator<Object>
PROPERTIES_KEY_COMPARATOR
-
Fields inherited from class java.util.ResourceBundle
parent
-
-
Constructor Summary
Constructors Constructor Description ModifiablePropertiesResourceBundle(File... sourceFiles)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Enumeration<String>
getKeys()
Long
getModifiedTime(String key)
Provides direct read access to the modified times.Long
getValidatedTime(String key)
Provides direct read access to the validated times.protected String
getValue(String key)
Provides direct read access to the value.protected Object
handleGetObject(String key)
protected Set<String>
handleKeySet()
protected void
handleRemoveKey(String key)
This will only be called on modifiable bundles.protected void
handleSetObject(String key, Object value, boolean modified)
This will only be called on modifiable bundles.boolean
isModifiable()
Checks if this bundle is currently modifiable.static boolean
isTrackingKey(String key)
Checks if a key is used for tracking status.Set<String>
keySetNoParents()
-
Methods inherited from class com.aoindustries.util.i18n.ModifiableResourceBundle
removeKey, setObject, setString, setStringArray
-
Methods inherited from class java.util.ResourceBundle
clearCache, clearCache, containsKey, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, keySet, setParent
-
-
-
-
Field Detail
-
PROPERTIES_KEY_COMPARATOR
public static final Comparator<Object> PROPERTIES_KEY_COMPARATOR
-
-
Constructor Detail
-
ModifiablePropertiesResourceBundle
public ModifiablePropertiesResourceBundle(File... sourceFiles)
- Parameters:
sourceFiles
- The source file(s). If multiple source files are provided, only one may exist and be both readable and writable. If more than one possible source file exists, will throw an IllegalStateException.
-
-
Method Detail
-
isTrackingKey
public static boolean isTrackingKey(String key)
Checks if a key is used for tracking status.
-
handleGetObject
protected Object handleGetObject(String key)
- Specified by:
handleGetObject
in classResourceBundle
-
getKeys
public Enumeration<String> getKeys()
- Specified by:
getKeys
in classResourceBundle
-
handleKeySet
protected Set<String> handleKeySet()
- Overrides:
handleKeySet
in classResourceBundle
-
isModifiable
public boolean isModifiable()
Description copied from class:ModifiableResourceBundle
Checks if this bundle is currently modifiable.- Specified by:
isModifiable
in classModifiableResourceBundle
-
handleRemoveKey
protected void handleRemoveKey(String key)
Description copied from class:ModifiableResourceBundle
This will only be called on modifiable bundles.- Specified by:
handleRemoveKey
in classModifiableResourceBundle
- See Also:
ModifiableResourceBundle.isModifiable()
-
handleSetObject
protected void handleSetObject(String key, Object value, boolean modified)
Description copied from class:ModifiableResourceBundle
This will only be called on modifiable bundles.
-
getValidatedTime
public Long getValidatedTime(String key)
Provides direct read access to the validated times.
-
-