myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmarinsc...@apache.org
Subject svn commit: r513793 - in /myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html: HtmlButtonRendererBase.java HtmlLinkRendererBase.java HtmlRendererUtils.java
Date Fri, 02 Mar 2007 14:59:28 GMT
Author: mmarinschek
Date: Fri Mar  2 06:59:27 2007
New Revision: 513793

URL: http://svn.apache.org/viewvc?view=rev&rev=513793
Log:
MYFACES-1552: less javascript per button rendered

Modified:
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java?view=diff&rev=513793&r1=513792&r2=513793
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
(original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
Fri Mar  2 06:59:27 2007
@@ -79,6 +79,8 @@
 
         ResponseWriter writer = facesContext.getResponseWriter();
 
+        HtmlRendererUtils.renderFormSubmitScript(facesContext);
+
         writer.startElement(HTML.INPUT_ELEM, uiComponent);
 
         writer.writeAttribute(HTML.ID_ATTR, clientId, org.apache.myfaces.shared.renderkit.JSFAttr.ID_ATTR);

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java?view=diff&rev=513793&r1=513792&r2=513793
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
(original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
Fri Mar  2 06:59:27 2007
@@ -47,7 +47,6 @@
     extends HtmlRenderer {
     public static final String URL_STATE_MARKER = "JSF_URL_STATE_MARKER=DUMMY";
     public static final int URL_STATE_MARKER_LEN = URL_STATE_MARKER.length();
-    private static final String FIRST_LINK_ON_PAGE = "org.apache.MyFaces.FIRST_LINK_ON_PAGE";
 
     //private static final Log log = LogFactory.getLog(HtmlLinkRenderer.class);
 
@@ -217,7 +216,7 @@
             onClick.append("'});return false;");
         }
         else {
-            renderFormSubmitScriptIfNecessary(facesContext);
+            HtmlRendererUtils.renderFormSubmitScript(facesContext);
 
             StringBuffer params = addChildParameters(component, nestingForm);
 
@@ -248,19 +247,6 @@
         writer.startElement(HTML.ANCHOR_ELEM, component);
         writer.writeURIAttribute(HTML.HREF_ATTR, "#", null);
         writer.writeAttribute(HTML.ONCLICK_ATTR, onClick.toString(), null);
-    }
-
-    private static void renderFormSubmitScriptIfNecessary(FacesContext facesContext)
-        throws IOException {
-
-        Map map = facesContext.getExternalContext().getRequestMap();
-        Boolean firstLink = (Boolean) map.get(FIRST_LINK_ON_PAGE);
-
-        if (firstLink == null || firstLink.equals(Boolean.TRUE)) {
-            map.put(FIRST_LINK_ON_PAGE, Boolean.FALSE);
-            HtmlRendererUtils.renderFormSubmitScript(facesContext);
-
-        }
     }
 
     private String getTarget(UIComponent component) {

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java?view=diff&rev=513793&r1=513792&r2=513793
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
(original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
Fri Mar  2 06:59:27 2007
@@ -58,12 +58,17 @@
 
     public static final String CLEAR_HIDDEN_FIELD_FN_NAME =
         "clearFormHiddenParams";
+    public static final String SUBMIT_FORM_FN_NAME = "oamSubmitForm";
+    public static final String ALLOW_CDATA_SECTION_ON = "org.apache.myfaces.ResponseWriter.CdataSectionOn";
+
     private static final String SET_HIDDEN_INPUT_FN_NAME = "oamSetHiddenInput";
     private static final String CLEAR_HIDDEN_INPUT_FN_NAME = "oamClearHiddenInput";
-    public static final String SUBMIT_FORM_FN_NAME = "oamSubmitForm";
+
     private static final String AUTO_SCROLL_PARAM = "autoScroll";
     private static final String AUTO_SCROLL_FUNCTION = "getScrolling";
-    public static final String ALLOW_CDATA_SECTION_ON = "org.apache.myfaces.ResponseWriter.CdataSectionOn";
+
+    private static final String FIRST_SUBMIT_SCRIPT_ON_PAGE = "org.apache.MyFaces.FIRST_SUBMIT_SCRIPT_ON_PAGE";
+
 
     private HtmlRendererUtils() {
         // utility class, do not instantiate
@@ -843,6 +848,18 @@
     public static void renderFormSubmitScript(FacesContext facesContext)
             throws IOException
     {
+
+        Map map = facesContext.getExternalContext().getRequestMap();
+        Boolean firstScript = (Boolean) map.get(FIRST_SUBMIT_SCRIPT_ON_PAGE);
+
+        if (firstScript == null || firstScript.equals(Boolean.TRUE)) {
+            map.put(FIRST_SUBMIT_SCRIPT_ON_PAGE, Boolean.FALSE);
+            HtmlRendererUtils.renderFormSubmitScriptIfNecessary(facesContext);
+
+        }
+    }
+
+    private static void renderFormSubmitScriptIfNecessary(FacesContext facesContext) throws
IOException {
         ResponseWriter writer = facesContext.getResponseWriter();
 
         writer.startElement(HTML.SCRIPT_ELEM, null);



Mime
View raw message