org.ajax4jsf.javascript

## Class ScriptUtils

- java.lang.Object
- - org.ajax4jsf.javascript.ScriptUtils

-     public final class ScriptUtils
      extends Object

  Version:
    $Revision: 1.1.2.3 $ $Date: 2007/01/24 13:22:31 $
  Author:
    shura (latest modification by $Author: alexsmirnov $)

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `appendEncoded(Appendable appendable, Object obj)`
    `static void` | `appendEncodedString(Appendable appendable, Object obj)`
    `static void` | `appendScript(Appendable appendable, Object obj)`
    `static String` | `escapeCSSMetachars(String s)` Escapes CSS meta-characters in string according to jQuery selectors document.
    `static String` | `getMD5scriptHash(String script)`
    `static String` | `getValidJavascriptName(String script)`
    `static boolean` | `isValidProperty(Object property)` Test for valid value of property.
    `static boolean` | `shouldRenderAttribute(Object attributeVal)`
    `static boolean` | `shouldRenderAttribute(String attributeName, Object attributeVal)`
    `static String` | `toScript(Object obj)` Convert any Java Object to JavaScript representation ( as possible ).
    `static void` | `writeToStream(javax.faces.context.ResponseWriter responseWriter, Object obj)` Convert any Java Object to JavaScript representation ( as possible ) and write it to writer immediately

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### writeToStream

          public static void writeToStream(javax.faces.context.ResponseWriter responseWriter,
                           Object obj)
                                    throws IOException

      Convert any Java Object to JavaScript representation ( as possible ) and write it to writer immediately
      Parameters:
        `responseWriter` -
        `obj` -
      Throws:
        `IOException`

    - #### toScript

          public static String toScript(Object obj)

      Convert any Java Object to JavaScript representation ( as possible ).
      Parameters:
        `obj` -
      Returns:
        Java Object converted to JavaScript representation

    - #### appendScript

          public static void appendScript(Appendable appendable,
                          Object obj)
                                   throws IOException

      Throws:
        `IOException`

    - #### appendEncodedString

          public static void appendEncodedString(Appendable appendable,
                                 Object obj)
                                          throws IOException

      Throws:
        `IOException`

    - #### appendEncoded

          public static void appendEncoded(Appendable appendable,
                           Object obj)
                                    throws IOException

      Throws:
        `IOException`

    - #### getValidJavascriptName

          public static String getValidJavascriptName(String script)

    - #### getMD5scriptHash

          public static String getMD5scriptHash(String script)

    - #### shouldRenderAttribute

          public static boolean shouldRenderAttribute(Object attributeVal)

    - #### shouldRenderAttribute

          public static boolean shouldRenderAttribute(String attributeName,
                                      Object attributeVal)

    - #### isValidProperty

          public static boolean isValidProperty(Object property)

      Test for valid value of property. by default, for non-setted properties with Java primitive types of JSF component return appropriate MIN_VALUE .
      Parameters:
        `property` - - value of property returned from `UIComponent.getAttributes()`
      Returns:
        true for setted property, false otherthise.

    - #### escapeCSSMetachars

          public static String escapeCSSMetachars(String s)

      Escapes CSS meta-characters in string according to jQuery selectors document.

      Parameters:
        `s` - `String` to escape meta-characters in
      Returns:
        string with escaped characters.

Copyright © 2015 JBoss by Red Hat. All Rights Reserved.