org.apache.myfaces.shared_tomahawk.renderkit.html
Class HtmlJavaScriptUtils

java.lang.Object
  extended by org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlJavaScriptUtils

public final class HtmlJavaScriptUtils
extends Object


Constructor Summary
HtmlJavaScriptUtils()
           
 
Method Summary
static void appendAutoScrollAssignment(javax.faces.context.FacesContext context, StringBuilder onClickValue, String formName)
          Adds the hidden form input value assignment that is necessary for the autoscroll feature to an html link or button onclick attribute.
static void appendAutoScrollAssignment(StringBuilder onClickValue, String formName)
           
static void appendClearHiddenCommandFormParamsFunctionCall(StringBuilder buf, String formName)
           
static String escapeJavaScriptForChain(String javaScript)
          This function correctly escapes the given JavaScript code for the use in the jsf.util.chain() JavaScript function.
static String getAutoScrollFunction(javax.faces.context.FacesContext facesContext)
           
static String getClearHiddenCommandFormParamsFunctionName(String formName)
          Prefixes the given String with "clear_" and removes special characters
static String getClearHiddenCommandFormParamsFunctionNameMyfacesLegacy(String formName)
           
static void renderAutoScrollFunction(javax.faces.context.FacesContext facesContext, javax.faces.context.ResponseWriter writer)
          Renders the autoscroll javascript function.
static void renderAutoScrollHiddenInput(javax.faces.context.FacesContext facesContext, javax.faces.context.ResponseWriter writer)
          Renders the hidden form input that is necessary for the autoscroll feature.
static void renderClearHiddenCommandFormParamsFunction(javax.faces.context.ResponseWriter writer, String formName, Set dummyFormParams, String formTarget)
          Render the javascript function that is called on a click on a commandLink to clear the hidden inputs.
static void renderFormSubmitScript(javax.faces.context.FacesContext facesContext)
           
static void renderViewStateJavascript(javax.faces.context.FacesContext facesContext, String hiddenId, String serializedState)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlJavaScriptUtils

public HtmlJavaScriptUtils()
Method Detail

renderFormSubmitScript

public static void renderFormSubmitScript(javax.faces.context.FacesContext facesContext)
                                   throws IOException
Throws:
IOException

appendAutoScrollAssignment

public static void appendAutoScrollAssignment(StringBuilder onClickValue,
                                              String formName)

appendAutoScrollAssignment

public static void appendAutoScrollAssignment(javax.faces.context.FacesContext context,
                                              StringBuilder onClickValue,
                                              String formName)
Adds the hidden form input value assignment that is necessary for the autoscroll feature to an html link or button onclick attribute.


getAutoScrollFunction

public static String getAutoScrollFunction(javax.faces.context.FacesContext facesContext)

renderAutoScrollHiddenInput

public static void renderAutoScrollHiddenInput(javax.faces.context.FacesContext facesContext,
                                               javax.faces.context.ResponseWriter writer)
                                        throws IOException
Renders the hidden form input that is necessary for the autoscroll feature.

Throws:
IOException

renderAutoScrollFunction

public static void renderAutoScrollFunction(javax.faces.context.FacesContext facesContext,
                                            javax.faces.context.ResponseWriter writer)
                                     throws IOException
Renders the autoscroll javascript function.

Throws:
IOException

appendClearHiddenCommandFormParamsFunctionCall

public static void appendClearHiddenCommandFormParamsFunctionCall(StringBuilder buf,
                                                                  String formName)

getClearHiddenCommandFormParamsFunctionName

public static String getClearHiddenCommandFormParamsFunctionName(String formName)
Prefixes the given String with "clear_" and removes special characters

Parameters:
formName -
Returns:
String

getClearHiddenCommandFormParamsFunctionNameMyfacesLegacy

public static String getClearHiddenCommandFormParamsFunctionNameMyfacesLegacy(String formName)

renderClearHiddenCommandFormParamsFunction

public static void renderClearHiddenCommandFormParamsFunction(javax.faces.context.ResponseWriter writer,
                                                              String formName,
                                                              Set dummyFormParams,
                                                              String formTarget)
                                                       throws IOException
Render the javascript function that is called on a click on a commandLink to clear the hidden inputs. This is necessary because on a browser back, each hidden input still has it's old value (browser cache!) and therefore a new submit would cause the according action once more!

Parameters:
writer -
formName -
dummyFormParams -
formTarget -
Throws:
IOException

escapeJavaScriptForChain

public static String escapeJavaScriptForChain(String javaScript)
This function correctly escapes the given JavaScript code for the use in the jsf.util.chain() JavaScript function. It also handles double-escaping correclty.

Parameters:
javaScript -
Returns:

renderViewStateJavascript

public static void renderViewStateJavascript(javax.faces.context.FacesContext facesContext,
                                             String hiddenId,
                                             String serializedState)
                                      throws IOException
Throws:
IOException


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.