Package org.opencms.ugc.client
Class CmsJsUtils
java.lang.Object
org.opencms.ugc.client.CmsJsUtils
Various utility functions.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionconvertJsObjectToMap
(com.google.gwt.core.client.JavaScriptObject jso) Converts a Javascript object to a map from strings to strings, ignoring all properties of the object whose value is not a string.static com.google.gwt.core.client.JavaScriptObject
convertMapToJsObject
(Map<String, String> stringMap) Converts a map whose keys and values are strings to a Javascript object with the keys as attributes and the corresponding values as the attribute values.static String
Generates a random id.
-
Field Details
-
RANDOM
The random number generator.
-
-
Constructor Details
-
CmsJsUtils
public CmsJsUtils()
-
-
Method Details
-
convertJsObjectToMap
public static Map<String,String> convertJsObjectToMap(com.google.gwt.core.client.JavaScriptObject jso) Converts a Javascript object to a map from strings to strings, ignoring all properties of the object whose value is not a string.- Parameters:
jso
- the Javascript object to convert- Returns:
- the map containing the string-valued properties of the Javascript object
-
convertMapToJsObject
public static com.google.gwt.core.client.JavaScriptObject convertMapToJsObject(Map<String, String> stringMap) Converts a map whose keys and values are strings to a Javascript object with the keys as attributes and the corresponding values as the attribute values.- Parameters:
stringMap
- the map to convert- Returns:
- the Javascript object with the attributes defined by the map
-
generateRandomId
Generates a random id.- Returns:
- the random id
-