java.lang.Object
java.util.ResourceBundle
com.aoapps.hodgepodge.i18n.ModifiableResourceBundle
com.aoapps.hodgepodge.i18n.ModifiablePropertiesResourceBundle
com.aoapps.hodgepodge.i18n.EditableResourceBundle
- All Implemented Interfaces:
Comparable<EditableResourceBundle>
public abstract class EditableResourceBundle
extends ModifiablePropertiesResourceBundle
implements Comparable<EditableResourceBundle>
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 needs to be verified. Verification is required
when any other locale has a modified time greater than the verified time
of this locale.
- Author:
- AO Industries, Inc.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Settings for the current thread.Nested classes/interfaces inherited from class java.util.ResourceBundle
ResourceBundle.Control
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Value used for empty strings, to avoid ambiguity.static final String
Fields inherited from class com.aoapps.hodgepodge.i18n.ModifiablePropertiesResourceBundle
PROPERTIES_KEY_COMPARATOR
Fields inherited from class java.util.ResourceBundle
parent
-
Constructor Summary
ModifierConstructorDescriptionprotected
EditableResourceBundle
(Locale locale, EditableResourceBundleSet bundleSet, File... sourceFiles) -
Method Summary
Modifier and TypeMethodDescriptionint
The natural sorting is based on classname.Gets the current settings for the current thread, initialized toThreadSettings()
when not yet set.handleGetObject
(String key) Gets an object.static void
printEditableResourceBundleLookups
(Encoder textInJavascriptEncoder, Encoder textInXhtmlEncoder, Appendable out, boolean isXhtml, int editorRows, boolean verticalButtons) Prints the resource bundle lookup editor.static void
printEditableResourceBundleLookups
(Encoder textInJavascriptEncoder, Encoder textInXhtmlEncoder, Appendable out, int editorRows, boolean verticalButtons) Deprecated.static void
Deprecated.Please useresetThreadSettings()
instead.static void
resetRequest
(boolean canEditResources, String setValueUrl, boolean modifyAllText) Deprecated.static void
Resets the settings for the current thread.static void
setThreadSettings
(EditableResourceBundle.ThreadSettings threadSettings) Sets the settings for the current thread.Methods inherited from class com.aoapps.hodgepodge.i18n.ModifiablePropertiesResourceBundle
getKeys, getModifiedTime, getValidatedTime, getValue, handleKeySet, handleRemoveKey, handleSetObject, isModifiable, isTrackingKey, keySetNoParents
Methods inherited from class com.aoapps.hodgepodge.i18n.ModifiableResourceBundle
removeKey, setObject, setString, setStringArray
Methods inherited from class java.util.ResourceBundle
clearCache, clearCache, containsKey, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, keySet, setParent
-
Field Details
-
VISIBILITY_COOKIE_NAME
- See Also:
-
EMPTY_DISPLAY
Value used for empty strings, to avoid ambiguity. Other submitted empty will be removed.- See Also:
-
-
Constructor Details
-
EditableResourceBundle
protected EditableResourceBundle(Locale locale, EditableResourceBundleSet bundleSet, File... sourceFiles)
-
-
Method Details
-
getThreadSettings
Gets the current settings for the current thread, initialized toThreadSettings()
when not yet set. -
resetThreadSettings
public static void resetThreadSettings()Resets the settings for the current thread. Also removesBundleLookupThreadContext
for the current thread. -
removeThreadSettings
Deprecated.Please useresetThreadSettings()
instead.Removes the settings for the current thread. Also removesBundleLookupThreadContext
for the current thread. -
setThreadSettings
Sets the settings for the current thread. Also configuresBundleLookupThreadContext
for the current thread.- Parameters:
threadSettings
- Whennull
, is equivalent toresetThreadSettings()
.- See Also:
-
resetRequest
@Deprecated public static void resetRequest(boolean canEditResources, String setValueUrl, boolean modifyAllText) Deprecated.Any page that allows the editing of resources must set this at the beginning of the request. If not all users of the site are allowed to edit the content, must also clear this at the end of the request by either calling this method withfalse
or callingprintEditableResourceBundleLookups
.Also resets the thread lookup context.
- Parameters:
setValueUrl
- Must be non-null whencanEditResources
istrue
.- See Also:
-
printEditableResourceBundleLookups
public static void printEditableResourceBundleLookups(Encoder textInJavascriptEncoder, Encoder textInXhtmlEncoder, Appendable out, boolean isXhtml, int editorRows, boolean verticalButtons) throws IOException Prints the resource bundle lookup editor. This should be called at the end of a request, just before the body tag is closed.Also clears the thread lookup context.
TODO: Add language resources to properties files (but do not make it an editable properties file to avoid possible infinite recursion?) TODO: Decouple from ao-hodgepodge and use ao-fluent-html- Throws:
IOException
-
printEditableResourceBundleLookups
@Deprecated public static void printEditableResourceBundleLookups(Encoder textInJavascriptEncoder, Encoder textInXhtmlEncoder, Appendable out, int editorRows, boolean verticalButtons) throws IOException Deprecated.Please useprintEditableResourceBundleLookups(com.aoapps.lang.io.Encoder, com.aoapps.lang.io.Encoder, java.lang.Appendable, boolean, int, boolean)
directly, providing whether is SGML or XHTML serialization with theisXhtml
flag. This assumes XHTML serialization for backward-compatibility.- Throws:
IOException
-
compareTo
The natural sorting is based on classname.- Specified by:
compareTo
in interfaceComparable<EditableResourceBundle>
-
handleGetObject
Gets an object. If editing is enabled and the bundle is modifiable, adds to the thread lookup context if present.- Overrides:
handleGetObject
in classModifiablePropertiesResourceBundle
- See Also:
-
printEditableResourceBundleLookups(com.aoapps.lang.io.Encoder, com.aoapps.lang.io.Encoder, java.lang.Appendable, boolean, int, boolean)
directly, providing whether is SGML or XHTML serialization with theisXhtml
flag.