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>
- Direct Known Subclasses:
ApplicationResources,ApplicationResources,ApplicationResources,ApplicationResources,ApplicationResources,ApplicationResources,ApplicationResources,ApplicationResources_ja,ApplicationResources_ja,ApplicationResources_ja,ApplicationResources_ja,ApplicationResources_ja,ApplicationResources_ja,ApplicationResources_ja
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/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 Modifier and Type Method Description intcompareTo(EditableResourceBundle o)The natural sorting is based on classname.ObjecthandleGetObject(String key)Gets an object.static voidprintEditableResourceBundleLookups(Encoder textInJavaScriptEncoder, Encoder textInXhtmlEncoder, Appendable out, int editorRows, boolean verticalButtons)Prints the resource bundle lookup editor.static voidresetRequest(boolean canEditResources, String setValueUrl, boolean modifyAllText)Any page that allows the editing of resources must set this at the beginning of the request.-
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
-
resetRequest
public static void resetRequest(boolean canEditResources, String setValueUrl, boolean modifyAllText)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 whencanEditResourcesis true.- See Also:
BundleLookupThreadContext,printEditableResourceBundleLookups(com.aoindustries.io.Encoder, com.aoindustries.io.Encoder, java.lang.Appendable, int, boolean)
-
printEditableResourceBundleLookups
public static void printEditableResourceBundleLookups(Encoder textInJavaScriptEncoder, Encoder textInXhtmlEncoder, Appendable out, 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.
-
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
-
-