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
Nested ClassesModifier and TypeClassDescriptionstatic classSettings for the current thread.Nested classes/interfaces inherited from class java.util.ResourceBundle
ResourceBundle.Control -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringValue used for empty strings, to avoid ambiguity.static final StringFields inherited from class com.aoapps.hodgepodge.i18n.ModifiablePropertiesResourceBundle
PROPERTIES_KEY_COMPARATORFields inherited from class java.util.ResourceBundle
parent -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEditableResourceBundle(Locale locale, EditableResourceBundleSet bundleSet, File... sourceFiles) -
Method Summary
Modifier and TypeMethodDescriptionintThe 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 voidprintEditableResourceBundleLookups(Encoder textInJavascriptEncoder, Encoder textInXhtmlEncoder, Appendable out, boolean isXhtml, int editorRows, boolean verticalButtons) Prints the resource bundle lookup editor.static voidprintEditableResourceBundleLookups(Encoder textInJavascriptEncoder, Encoder textInXhtmlEncoder, Appendable out, int editorRows, boolean verticalButtons) Deprecated.static voidDeprecated.Please useresetThreadSettings()instead.static voidresetRequest(boolean canEditResources, String setValueUrl, boolean modifyAllText) Deprecated.static voidResets the settings for the current thread.static voidsetThreadSettings(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, keySetNoParentsMethods inherited from class com.aoapps.hodgepodge.i18n.ModifiableResourceBundle
removeKey, setObject, setString, setStringArrayMethods 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 removesBundleLookupThreadContextfor the current thread. -
removeThreadSettings
Deprecated.Please useresetThreadSettings()instead.Removes the settings for the current thread. Also removesBundleLookupThreadContextfor the current thread. -
setThreadSettings
Sets the settings for the current thread. Also configuresBundleLookupThreadContextfor 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 withfalseor callingprintEditableResourceBundleLookups.Also resets the thread lookup context.
- Parameters:
setValueUrl- Must be non-null whencanEditResourcesistrue.- 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 theisXhtmlflag. This assumes XHTML serialization for backward-compatibility.- Throws:
IOException
-
compareTo
The natural sorting is based on classname.- Specified by:
compareToin interfaceComparable<EditableResourceBundle>
-
handleGetObject
Gets an object. If editing is enabled and the bundle is modifiable, adds to the thread lookup context if present.- Overrides:
handleGetObjectin 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 theisXhtmlflag.