myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r812311 - /myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/
Date Tue, 08 Sep 2009 00:22:16 GMT
Author: lu4242
Date: Tue Sep  8 00:22:15 2009
New Revision: 812311

URL: http://svn.apache.org/viewvc?rev=812311&view=rev
Log:
MYFACES-2323 Implement <f:ajax> tag handler (apply decode client behavior algorithm
on renderers that handle components implementing EditableValueHolder, ActionSource or UIForm)

Modified:
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlFormRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlSecretRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java?rev=812311&r1=812310&r2=812311&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
Tue Sep  8 00:22:15 2009
@@ -27,6 +27,7 @@
 import javax.faces.component.UICommand;
 import javax.faces.component.UIComponent;
 import javax.faces.component.ValueHolder;
+import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.component.html.HtmlCommandButton;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
@@ -59,6 +60,12 @@
             uiComponent.queueEvent(new ActionEvent(uiComponent));
 
             org.apache.myfaces.shared.renderkit.RendererUtils.initPartialValidationAndModelUpdate(uiComponent,
facesContext);
+            
+            if (uiComponent instanceof ClientBehaviorHolder &&
+                    !HtmlRendererUtils.isDisabled(uiComponent))
+            {
+                HtmlRendererUtils.decodeClientBehaviors(facesContext, uiComponent);
+            }
         }
     }
 

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java?rev=812311&r1=812310&r2=812311&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
Tue Sep  8 00:22:15 2009
@@ -27,6 +27,7 @@
 import javax.faces.component.UIComponent;
 import javax.faces.component.UISelectBoolean;
 import javax.faces.component.UISelectMany;
+import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.component.html.HtmlSelectBooleanCheckbox;
 import javax.faces.component.html.HtmlSelectManyCheckbox;
 import javax.faces.context.FacesContext;
@@ -303,6 +304,11 @@
             throw new IllegalArgumentException("Unsupported component class "
                     + component.getClass().getName());
         }
+        if (component instanceof ClientBehaviorHolder &&
+                !HtmlRendererUtils.isDisabled(component))
+        {
+            HtmlRendererUtils.decodeClientBehaviors(facesContext, component);
+        }
     }
 
     public Object getConvertedValue(FacesContext facesContext,

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlFormRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlFormRendererBase.java?rev=812311&r1=812310&r2=812311&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlFormRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlFormRendererBase.java
Tue Sep  8 00:22:15 2009
@@ -24,6 +24,7 @@
 import javax.faces.application.ViewHandler;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIForm;
+import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.component.html.HtmlForm;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
@@ -188,6 +189,8 @@
         {
             htmlForm.setSubmitted(false);
         }
+        
+        HtmlRendererUtils.decodeClientBehaviors(facesContext, component);
     }
 
 

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java?rev=812311&r1=812310&r2=812311&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
Tue Sep  8 00:22:15 2009
@@ -31,6 +31,7 @@
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIOutput;
 import javax.faces.component.UIParameter;
+import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.component.html.HtmlCommandLink;
 import javax.faces.component.html.HtmlOutcomeTargetLink;
 import javax.faces.context.FacesContext;
@@ -78,6 +79,11 @@
 
                 RendererUtils.initPartialValidationAndModelUpdate(component, facesContext);
             }
+            if (component instanceof ClientBehaviorHolder &&
+                    !HtmlRendererUtils.isDisabled(component))
+            {
+                HtmlRendererUtils.decodeClientBehaviors(facesContext, component);
+            }
         }
         else if (component instanceof UIOutput)
         {

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java?rev=812311&r1=812310&r2=812311&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java
Tue Sep  8 00:22:15 2009
@@ -24,6 +24,7 @@
 import javax.faces.component.UIComponent;
 import javax.faces.component.UISelectMany;
 import javax.faces.component.UISelectOne;
+import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.component.html.HtmlSelectManyListbox;
 import javax.faces.component.html.HtmlSelectOneListbox;
 import javax.faces.context.FacesContext;
@@ -100,6 +101,11 @@
         {
             throw new IllegalArgumentException("Unsupported component class " + uiComponent.getClass().getName());
         }
+        if (uiComponent instanceof ClientBehaviorHolder &&
+                !HtmlRendererUtils.isDisabled(uiComponent))
+        {
+            HtmlRendererUtils.decodeClientBehaviors(facesContext, uiComponent);
+        }
     }
 
     public Object getConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object
submittedValue) throws ConverterException

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java?rev=812311&r1=812310&r2=812311&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java
Tue Sep  8 00:22:15 2009
@@ -23,6 +23,7 @@
 import javax.faces.component.UIComponent;
 import javax.faces.component.UISelectMany;
 import javax.faces.component.UISelectOne;
+import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.component.html.HtmlSelectManyMenu;
 import javax.faces.component.html.HtmlSelectOneMenu;
 import javax.faces.context.FacesContext;
@@ -97,6 +98,11 @@
         {
             throw new IllegalArgumentException("Unsupported component class " + uiComponent.getClass().getName());
         }
+        if (uiComponent instanceof ClientBehaviorHolder &&
+                !HtmlRendererUtils.isDisabled(uiComponent))
+        {
+            HtmlRendererUtils.decodeClientBehaviors(facesContext, uiComponent);
+        }
     }
 
     public Object getConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object
submittedValue) throws ConverterException

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java?rev=812311&r1=812310&r2=812311&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
Tue Sep  8 00:22:15 2009
@@ -24,6 +24,7 @@
 import org.apache.myfaces.shared.renderkit.RendererUtils;
 
 import javax.faces.component.*;
+import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.component.html.HtmlSelectOneRadio;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
@@ -294,6 +295,11 @@
         {
             HtmlRendererUtils.decodeUISelectOne(facesContext, uiComponent);
         }
+        if (uiComponent instanceof ClientBehaviorHolder &&
+                !HtmlRendererUtils.isDisabled(uiComponent))
+        {
+            HtmlRendererUtils.decodeClientBehaviors(facesContext, uiComponent);
+        }
     }
 
 

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java?rev=812311&r1=812310&r2=812311&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
Tue Sep  8 00:22:15 2009
@@ -31,6 +31,8 @@
 
 import javax.faces.FacesException;
 import javax.faces.component.*;
+import javax.faces.component.behavior.ClientBehavior;
+import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.component.html.HtmlDataTable;
 import javax.faces.component.html.HtmlPanelGrid;
 import javax.faces.context.ExternalContext;
@@ -242,6 +244,47 @@
             ((EditableValueHolder) component).setSubmittedValue( RendererUtils.NOTHING );
         }
     }
+    
+    public static void decodeClientBehaviors(FacesContext facesContext,
+            UIComponent component)
+    {
+        if (component instanceof ClientBehaviorHolder)
+        {
+            throw new IllegalArgumentException("Component "
+                    + component.getClientId(facesContext)
+                    + " is not an ClientBehaviorHolder");
+        }
+        ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
+        
+        Map<String,List<ClientBehavior>> clientBehaviors = 
+            clientBehaviorHolder.getClientBehaviors();
+                    
+        if (clientBehaviors != null && !clientBehaviors.isEmpty())
+        {
+            Map<String,String> paramMap = facesContext.getExternalContext().
+                getRequestParameterMap();
+            
+            String behaviorEventName = paramMap.get("javax.faces.behavior.event");
+            
+            if (behaviorEventName != null)
+            {
+                List<ClientBehavior> clientBehaviorList = clientBehaviors.get(behaviorEventName);
+                
+                if (clientBehaviorList != null && !clientBehaviorList.isEmpty())
+                {
+                    String clientId = paramMap.get("javax.faces.source");
+                    
+                    if (component.getClientId().equals(clientId))
+                    {
+                        for (ClientBehavior clientBehavior : clientBehaviorList)
+                        {
+                            clientBehavior.decode(facesContext, component);
+                        }
+                    }
+                }
+            }
+        }
+    }
 
     /*
      * public static void renderCheckbox(FacesContext facesContext, UIComponent

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlSecretRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlSecretRendererBase.java?rev=812311&r1=812310&r2=812311&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlSecretRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlSecretRendererBase.java
Tue Sep  8 00:22:15 2009
@@ -24,6 +24,7 @@
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIInput;
 import javax.faces.component.UIOutput;
+import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.component.html.HtmlInputSecret;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
@@ -119,6 +120,11 @@
     {
         org.apache.myfaces.shared.renderkit.RendererUtils.checkParamValidity(facesContext,
component, UIInput.class);
         HtmlRendererUtils.decodeUIInput(facesContext, component);
+        if (component instanceof ClientBehaviorHolder &&
+                !HtmlRendererUtils.isDisabled(component))
+        {
+            HtmlRendererUtils.decodeClientBehaviors(facesContext, component);
+        }
     }
 
     public Object getConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object
submittedValue) throws ConverterException

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextRendererBase.java?rev=812311&r1=812310&r2=812311&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextRendererBase.java
Tue Sep  8 00:22:15 2009
@@ -28,6 +28,7 @@
 import javax.faces.component.UIInput;
 import javax.faces.component.UIOutput;
 import javax.faces.component.UIViewRoot;
+import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.component.html.HtmlInputText;
 import javax.faces.component.html.HtmlOutputText;
 import javax.faces.context.FacesContext;
@@ -201,6 +202,11 @@
         if (component instanceof UIInput)
         {
             HtmlRendererUtils.decodeUIInput(facesContext, component);
+            if (component instanceof ClientBehaviorHolder &&
+                    !HtmlRendererUtils.isDisabled(component))
+            {
+                HtmlRendererUtils.decodeClientBehaviors(facesContext, component);
+            }
         }
         else if (component instanceof UIOutput)
         {

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java?rev=812311&r1=812310&r2=812311&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java
Tue Sep  8 00:22:15 2009
@@ -23,9 +23,11 @@
 import org.apache.myfaces.shared.renderkit.html.HtmlRenderer;
 import org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils;
 
+import javax.faces.component.EditableValueHolder;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIInput;
 import javax.faces.component.UIOutput;
+import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.component.html.HtmlInputTextarea;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
@@ -86,6 +88,11 @@
     {
         RendererUtils.checkParamValidity(facesContext, component, UIInput.class);
         HtmlRendererUtils.decodeUIInput(facesContext, component);
+        if (component instanceof ClientBehaviorHolder &&
+            !HtmlRendererUtils.isDisabled(component))
+        {
+            HtmlRendererUtils.decodeClientBehaviors(facesContext, component);
+        }
     }
 
     public Object getConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object
submittedValue) throws ConverterException



Mime
View raw message