Class CmsJsUtils


  • public class CmsJsUtils
    extends java.lang.Object
    Various utility functions.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Random RANDOM
      The random number generator.
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsJsUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<java.lang.String,​java.lang.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.
      static com.google.gwt.core.client.JavaScriptObject convertMapToJsObject​(java.util.Map<java.lang.String,​java.lang.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 java.lang.String generateRandomId()
      Generates a random id.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • RANDOM

        public static final java.util.Random RANDOM
        The random number generator.
    • Method Detail

      • convertJsObjectToMap

        public static java.util.Map<java.lang.String,​java.lang.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​(java.util.Map<java.lang.String,​java.lang.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

        public static java.lang.String generateRandomId()
        Generates a random id.

        Returns:
        the random id