Package com.aoindustries.util.i18n
Class EditableResourceBundle
- java.lang.Object
-
- java.util.ResourceBundle
-
- com.aoindustries.util.i18n.ModifiableResourceBundle
-
- com.aoindustries.util.i18n.ModifiablePropertiesResourceBundle
-
- com.aoindustries.util.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 Classes Modifier and Type Class Description static classEditableResourceBundle.ThreadSettingsSettings for the current thread.-
Nested classes/interfaces inherited from class java.util.ResourceBundle
ResourceBundle.Control
-
-
Field Summary
Fields Modifier and Type Field Description static StringEMPTY_DISPLAYValue used for empty strings, to avoid ambiguity.static StringVISIBILITY_COOKIE_NAME-
Fields inherited from class com.aoindustries.util.i18n.ModifiablePropertiesResourceBundle
PROPERTIES_KEY_COMPARATOR
-
Fields inherited from class java.util.ResourceBundle
parent
-
-
Constructor Summary
Constructors Constructor Description EditableResourceBundle(Locale locale, EditableResourceBundleSet bundleSet, File... sourceFiles)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intcompareTo(EditableResourceBundle o)The natural sorting is based on classname.static EditableResourceBundle.ThreadSettingsgetThreadSettings()Gets the current settings for the current thread, initialized toThreadSettings()when not yet set.ObjecthandleGetObject(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.Please useprintEditableResourceBundleLookups(com.aoindustries.io.Encoder, com.aoindustries.io.Encoder, java.lang.Appendable, boolean, int, boolean)directly, providing whether is SGML or XHTML serialization with theisXhtmlflag.static voidremoveThreadSettings()Deprecated.Please useresetThreadSettings()instead.static voidresetRequest(boolean canEditResources, String setValueUrl, boolean modifyAllText)Deprecated.static voidresetThreadSettings()Resets the settings for the current thread.static voidsetThreadSettings(EditableResourceBundle.ThreadSettings threadSettings)Sets the settings for the current thread.-
Methods inherited from class com.aoindustries.util.i18n.ModifiablePropertiesResourceBundle
getKeys, getModifiedTime, getValidatedTime, getValue, handleKeySet, handleRemoveKey, handleSetObject, isModifiable, isTrackingKey, 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
-
VISIBILITY_COOKIE_NAME
public static final String VISIBILITY_COOKIE_NAME
- See Also:
- Constant Field Values
-
EMPTY_DISPLAY
public static final String EMPTY_DISPLAY
Value used for empty strings, to avoid ambiguity. Other submitted empty will be removed.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EditableResourceBundle
public EditableResourceBundle(Locale locale, EditableResourceBundleSet bundleSet, File... sourceFiles)
-
-
Method Detail
-
getThreadSettings
public static EditableResourceBundle.ThreadSettings 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 public static void removeThreadSettings()
Deprecated.Please useresetThreadSettings()instead.Removes the settings for the current thread. Also removesBundleLookupThreadContextfor the current thread.
-
setThreadSettings
public static void setThreadSettings(EditableResourceBundle.ThreadSettings threadSettings)
Sets the settings for the current thread. Also configuresBundleLookupThreadContextfor the current thread.- Parameters:
threadSettings- Whennull, is equivalent toresetThreadSettings().- See Also:
printEditableResourceBundleLookups(com.aoindustries.io.Encoder, com.aoindustries.io.Encoder, java.lang.Appendable, boolean, int, boolean)
-
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(com.aoindustries.io.Encoder, com.aoindustries.io.Encoder, java.lang.Appendable, boolean, int, boolean)
-
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 aocode-public 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.aoindustries.io.Encoder, com.aoindustries.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
public int compareTo(EditableResourceBundle o)
The natural sorting is based on classname.- Specified by:
compareToin interfaceComparable<EditableResourceBundle>
-
handleGetObject
public Object handleGetObject(String key)
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:
BundleLookupThreadContext
-
-