Class CmsJsUtils

java.lang.Object
org.opencms.ugc.client.CmsJsUtils

public class CmsJsUtils extends Object
Various utility functions.

  • Field Summary

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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    static com.google.gwt.core.client.JavaScriptObject
    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.

    Methods inherited from class java.lang.Object

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

    • RANDOM

      public static final Random RANDOM
      The random number generator.
  • Constructor Details

  • 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

      public static String generateRandomId()
      Generates a random id.

      Returns:
      the random id