Class JsUtil



  • public class JsUtil
    extends java.lang.Object
    Utility methods to generate JavaScript code.
    Since:
    2.1.1
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getJsObjectForFieldsValue​(java.lang.String... ids)  
      static java.lang.String getJsObjectForFieldsValue​(java.util.Map<java.lang.String,java.lang.Object> jsKeyAndElementId)  
      static java.lang.String getJsObjectForFieldsValue​(java.util.Set<java.lang.Object> ids)  
      • Methods inherited from class java.lang.Object

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

      • getJsObjectForFieldsValue

        public static java.lang.String getJsObjectForFieldsValue​(java.util.Map<java.lang.String,java.lang.Object> jsKeyAndElementId)
        Parameters:
        jsKeyAndElementId - The map containing key values. The key in the map will be used as the key in the generated js object. The value in the map should be the id of the field.
        Returns:
        the JavaScript object for the fields value. Sample : {username:document.getElementById('uId')}
        Since:
        2.1.1
      • getJsObjectForFieldsValue

        public static java.lang.String getJsObjectForFieldsValue​(java.util.Set<java.lang.Object> ids)
        Parameters:
        ids - The set containing element ids. The id will be used as the key in the generated js object. The value in the set should be the id of the field. The id in the set should be a valid JavaScript object key.
        Returns:
        the JavaScript object for the fields value. Sample : {uId:document.getElementById('uId')}
        Since:
        2.1.1
      • getJsObjectForFieldsValue

        public static java.lang.String getJsObjectForFieldsValue​(java.lang.String... ids)
        Parameters:
        ids - The string array containing element ids. The id will be used as the key in the generated js object. The value in the array should be the id of the field. The id in the array should be a valid JavaScript object key.
        Returns:
        the JavaScript object for the fields value. Sample : {uId:document.getElementById('uId')}
        Since:
        2.1.3