empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1378650 - in /empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2: controls/InputControl.java utils/TagEncodingHelper.java
Date Wed, 29 Aug 2012 17:08:39 GMT
Author: doebele
Date: Wed Aug 29 17:08:38 2012
New Revision: 1378650

URL: http://svn.apache.org/viewvc?rev=1378650&view=rev
Log:
EMPIREDB-157 
JSF2 find the correct composite Component Parent

Modified:
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java

Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java?rev=1378650&r1=1378649&r2=1378650&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java
(original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java
Wed Aug 29 17:08:38 2012
@@ -343,8 +343,8 @@ public abstract class InputControl
             input.setLocalValueSet(false);
             input.setValueExpression("value", (ValueExpression)value);
             
-            Object check = ((ValueExpression)value).getValue(FacesContext.getCurrentInstance().getELContext());
-            log.info("Expression value is {}.", check);
+            // Object check = ((ValueExpression)value).getValue(FacesContext.getCurrentInstance().getELContext());
+            // log.info("Expression value is {}.", check);
         }    
         else
         {   // Set the value

Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java?rev=1378650&r1=1378649&r2=1378650&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java
(original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java
Wed Aug 29 17:08:38 2012
@@ -68,6 +68,10 @@ import org.apache.empire.jsf2.controls.T
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.sun.faces.component.CompositeComponentStackManager;
+import com.sun.faces.facelets.el.ContextualCompositeValueExpression;
+import com.sun.faces.facelets.el.TagValueExpression;
+
 public class TagEncodingHelper implements NamingContainer
 {
     /**
@@ -805,13 +809,31 @@ public class TagEncodingHelper implement
         String expr = ve.getExpressionString();
         while (expr.startsWith(CC_ATTR_EXPR))
         {
+            // Unwrap
+            if (ve instanceof TagValueExpression)
+                ve = ((TagValueExpression)ve).getWrapped();
             // find parent
-            parent = UIComponent.getCompositeComponentParent(parent);
+            if (ve instanceof ContextualCompositeValueExpression)
+            {
+                FacesContext ctx = FacesContext.getCurrentInstance();
+                ContextualCompositeValueExpression ccve = (ContextualCompositeValueExpression)ve;
+                CompositeComponentStackManager manager = CompositeComponentStackManager.getManager(ctx);
+                UIComponent cc = manager.findCompositeComponentUsingLocation(ctx, ccve.getLocation());
+                // set Parent
+                parent = cc;
+            }
+            else
+            {   // find parent
+                parent = UIComponent.getCompositeComponentParent(parent);
+            }
             if (parent == null)
                 return null;
             // check expression
             int end = expr.indexOf('}');
             String attrib = expr.substring(CC_ATTR_EXPR.length(), end);
+            if (attrib.indexOf('.')>0)
+                return ve; // do not investigate any further
+            // find attribute 
             ve = parent.getValueExpression(attrib);
             if (ve == null)
                 return null;



Mime
View raw message