You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2012/05/31 12:34:05 UTC

svn commit: r1344642 - /myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java

Author: lu4242
Date: Thu May 31 10:34:04 2012
New Revision: 1344642

URL: http://svn.apache.org/viewvc?rev=1344642&view=rev
Log:
MYFACES-3556 [perf] call markInitialState() inside vdl.retargetAttachedObjects() and vdl.retargetMethodExpressions()

Modified:
    myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java

Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java?rev=1344642&r1=1344641&r2=1344642&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java Thu May 31 10:34:04 2012
@@ -125,6 +125,9 @@ import org.apache.myfaces.view.facelets.
 import org.apache.myfaces.view.facelets.util.ReflectionUtil;
 
 import org.apache.myfaces.view.facelets.impl.SectionUniqueIdCounter;
+import org.apache.myfaces.view.facelets.tag.jsf.PartialMethodExpressionActionListener;
+import org.apache.myfaces.view.facelets.tag.jsf.PartialMethodExpressionValidator;
+import org.apache.myfaces.view.facelets.tag.jsf.PartialMethodExpressionValueChangeListener;
 
 /**
  * This class represents the abstraction of Facelets as a ViewDeclarationLanguage.
@@ -806,6 +809,10 @@ public class FaceletViewDeclarationLangu
                         {
                             currentHandler.applyAttachedObject(context, component);
                         }
+                        if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
+                        {
+                            component.markInitialState();
+                        }
                     }
                 }
                 else if ((currentTarget instanceof BehaviorHolderAttachedObjectTarget &&
@@ -860,6 +867,10 @@ public class FaceletViewDeclarationLangu
                                     currentHandler.applyAttachedObject(context, component);
                                 }
                             }
+                            if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
+                            {
+                                component.markInitialState();
+                            }
                         }
                     }
                 }
@@ -1096,6 +1107,10 @@ public class FaceletViewDeclarationLangu
                                 mctx.clearMethodExpressionAttribute(innerComponent, attributeName);
 
                                 retargetMethodExpressions(context, innerComponent);
+                                if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
+                                {
+                                    innerComponent.markInitialState();
+                                }
                             }
                             else
                             {
@@ -1115,6 +1130,10 @@ public class FaceletViewDeclarationLangu
                                     {
                                         ((ActionSource2)innerComponent).setActionExpression(methodExpression);
                                     }
+                                    if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
+                                    {
+                                        innerComponent.markInitialState();
+                                    }
                                 }
                                 else if ("actionListener".equals(attributeName))
                                 {
@@ -1142,10 +1161,21 @@ public class FaceletViewDeclarationLangu
                                                 createMethodExpression(elContext,
                                                         attributeExpressionString, Void.TYPE, EMPTY_CLASS_ARRAY), attributeNameValueExpression);
 
-                                        actionListener = new MethodExpressionActionListener(methodExpression, methodExpression2);
+                                        if (mctx.isUsingPSSOnThisView())
+                                        {
+                                            actionListener = new PartialMethodExpressionActionListener(methodExpression, methodExpression2);
+                                        }
+                                        else
+                                        {
+                                            actionListener = new MethodExpressionActionListener(methodExpression, methodExpression2);
+                                        }
                                     }
                                     ((ActionSource2) innerComponent).addActionListener(actionListener);
                                     mctx.addMethodExpressionTargeted(innerComponent, attributeName, actionListener);
+                                    if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
+                                    {
+                                        innerComponent.markInitialState();
+                                    }
                                 }
                                 else if ("validator".equals(attributeName))
                                 {
@@ -1169,11 +1199,21 @@ public class FaceletViewDeclarationLangu
                                                 createMethodExpression(elContext,
                                                         attributeExpressionString, Void.TYPE,
                                                         VALIDATOR_SIGNATURE), attributeNameValueExpression);
-
-                                        validator = new MethodExpressionValidator(methodExpression);
+                                        if (mctx.isUsingPSSOnThisView())
+                                        {
+                                            validator = new PartialMethodExpressionValidator(methodExpression);
+                                        }
+                                        else
+                                        {
+                                            validator = new MethodExpressionValidator(methodExpression);
+                                        }
                                     }
                                     ((EditableValueHolder) innerComponent).addValidator(validator);
                                     mctx.addMethodExpressionTargeted(innerComponent, attributeName, validator);
+                                    if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
+                                    {
+                                        innerComponent.markInitialState();
+                                    }
                                 }
                                 else if ("valueChangeListener".equals(attributeName))
                                 {
@@ -1202,10 +1242,21 @@ public class FaceletViewDeclarationLangu
                                                         attributeExpressionString, Void.TYPE,
                                                         EMPTY_CLASS_ARRAY), attributeNameValueExpression);
 
-                                        valueChangeListener = new MethodExpressionValueChangeListener(methodExpression, methodExpression2);
+                                        if (mctx.isUsingPSSOnThisView())
+                                        {
+                                            valueChangeListener = new PartialMethodExpressionValueChangeListener(methodExpression, methodExpression2);
+                                        }
+                                        else
+                                        {
+                                            valueChangeListener = new MethodExpressionValueChangeListener(methodExpression, methodExpression2);
+                                        }
                                     }
                                     ((EditableValueHolder) innerComponent).addValueChangeListener(valueChangeListener);
                                     mctx.addMethodExpressionTargeted(innerComponent, attributeName, valueChangeListener);
+                                    if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
+                                    {
+                                        innerComponent.markInitialState();
+                                    }
                                 }
                             }
                         }
@@ -1246,6 +1297,10 @@ public class FaceletViewDeclarationLangu
                                 mctx.clearMethodExpressionAttribute(innerComponent, attributeName);
 
                                 retargetMethodExpressions(context, innerComponent);
+                                if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
+                                {
+                                    innerComponent.markInitialState();
+                                }
                             }
                             else
                             {
@@ -1260,6 +1315,10 @@ public class FaceletViewDeclarationLangu
                                 {
                                     innerComponent.getAttributes().put(attributeName, methodExpression);
                                 }
+                                if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
+                                {
+                                    innerComponent.markInitialState();
+                                }
                             }
                         }
                         //Store the method expression to the topLevelComponent to allow reference it through EL