myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject svn commit: r1778044 - in /myfaces/core/branches/2.3.x/impl/src: main/java/org/apache/myfaces/component/search/ test/java/org/apache/myfaces/component/search/
Date Mon, 09 Jan 2017 20:51:23 GMT
Author: tandraschko
Date: Mon Jan  9 20:51:23 2017
New Revision: 1778044

URL: http://svn.apache.org/viewvc?rev=1778044&view=rev
Log:
MYFACES-4075 SearchExpression API (spec alignments)

Modified:
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/AllSearchKeywordResolver.java
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ChildSearchKeywordResolver.java
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/CompositeComponentParentSearchKeywordResolver.java
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/CompositeSearchKeywordResolver.java
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/FormSearchKeywordResolver.java
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/IdSearchKeywordResolver.java
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NamingContainerSearchKeywordResolver.java
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NextSearchKeywordResolver.java
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NoneSearchKeywordResolver.java
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ParentSearchKeywordResolver.java
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/PreviousSearchKeywordResolver.java
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/RootSearchKeywordResolver.java
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/SearchExpressionHandlerImpl.java
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ThisSearchKeywordResolver.java
    myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/component/search/SearchExpressionImplTest.java

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/AllSearchKeywordResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/AllSearchKeywordResolver.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/AllSearchKeywordResolver.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/AllSearchKeywordResolver.java
Mon Jan  9 20:51:23 2017
@@ -33,9 +33,9 @@ public class AllSearchKeywordResolver ex
     public static final String ALL_KEYWORD = "all";
 
     @Override
-    public void resolve(SearchKeywordContext expressionContext, UIComponent previous, String
command)
+    public void resolve(SearchKeywordContext expressionContext, UIComponent current, String
keyword)
     {
-        UIComponent parent = previous.getParent();
+        UIComponent parent = current.getParent();
 
         while (parent.getParent() != null)
         {
@@ -46,7 +46,7 @@ public class AllSearchKeywordResolver ex
     }
 
     @Override
-    public boolean matchKeyword(SearchExpressionContext searchExpressionContext, String keyword)
+    public boolean isResolverForKeyword(SearchExpressionContext searchExpressionContext,
String keyword)
     {
         return ALL_KEYWORD.equalsIgnoreCase(keyword);
     }

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ChildSearchKeywordResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ChildSearchKeywordResolver.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ChildSearchKeywordResolver.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ChildSearchKeywordResolver.java
Mon Jan  9 20:51:23 2017
@@ -39,28 +39,28 @@ public class ChildSearchKeywordResolver
     private static final Pattern PATTERN = Pattern.compile("child\\((\\d+)\\)");
 
     @Override
-    public void resolve(SearchKeywordContext expressionContext, UIComponent previous, String
command)
+    public void resolve(SearchKeywordContext expressionContext, UIComponent current, String
keyword)
     {
         try
         {
-            Matcher matcher = PATTERN.matcher(command);
+            Matcher matcher = PATTERN.matcher(keyword);
 
             if (matcher.matches())
             {
 
                 int childNumber = Integer.parseInt(matcher.group(1));
 
-                if (childNumber + 1 > previous.getChildCount())
+                if (childNumber + 1 > current.getChildCount())
                 {
                     throw new FacesException("Component with clientId \""
-                            + previous.getClientId(expressionContext.getSearchExpressionContext().getFacesContext())

+                            + current.getClientId(expressionContext.getSearchExpressionContext().getFacesContext())

                             + "\" has fewer children as \"" + 
-                              childNumber + "\". Expression: \"" + command + "\"");
+                              childNumber + "\". Expression: \"" + keyword + "\"");
                 }
 
-                List<UIComponent> list = previous.getChildren();
+                List<UIComponent> list = current.getChildren();
                 int count = 0;
-                for (int i = 0; i < previous.getChildCount(); i++)
+                for (int i = 0; i < current.getChildCount(); i++)
                 {
                     if (! (list.get(i) instanceof UntargetableComponent))
                     {
@@ -68,34 +68,34 @@ public class ChildSearchKeywordResolver
                     }
                     if (count == childNumber + 1)
                     {
-                        expressionContext.invokeContextCallback(previous.getChildren().get(childNumber));
+                        expressionContext.invokeContextCallback(current.getChildren().get(childNumber));
                         break;
                     }
                 }
                 if (count < childNumber)
                 {
                     throw new FacesException("Component with clientId \""
-                            + previous.getClientId(expressionContext.getSearchExpressionContext().getFacesContext())

+                            + current.getClientId(expressionContext.getSearchExpressionContext().getFacesContext())

                             + "\" has fewer children as \"" + 
-                              childNumber + "\". Expression: \"" + command + "\"");
+                              childNumber + "\". Expression: \"" + keyword + "\"");
                 }
             }
             else
             {
                 throw new FacesException(
-                        "Expression does not match following pattern @child(n). Expression:
\"" + command + "\"");
+                        "Expression does not match following pattern @child(n). Expression:
\"" + keyword + "\"");
             }
 
         }
         catch (Exception e)
         {
             throw new FacesException(
-                    "Expression does not match following pattern @child(n). Expression: \""
+ command + "\"", e);
+                    "Expression does not match following pattern @child(n). Expression: \""
+ keyword + "\"", e);
         }
     }
 
     @Override
-    public boolean matchKeyword(SearchExpressionContext searchExpressionContext, String command)
+    public boolean isResolverForKeyword(SearchExpressionContext searchExpressionContext,
String command)
     {
         if (command != null && command.length() > 6 && 
                 command.substring(0, CHILD_KEYWORD.length()).equalsIgnoreCase(CHILD_KEYWORD))

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/CompositeComponentParentSearchKeywordResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/CompositeComponentParentSearchKeywordResolver.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/CompositeComponentParentSearchKeywordResolver.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/CompositeComponentParentSearchKeywordResolver.java
Mon Jan  9 20:51:23 2017
@@ -32,13 +32,13 @@ public class CompositeComponentParentSea
     public static final String COMPOSITE_KEYWORD = "composite";
 
     @Override
-    public void resolve(SearchKeywordContext expressionContext, UIComponent previous, String
command)
+    public void resolve(SearchKeywordContext expressionContext, UIComponent current, String
keyword)
     {
-        expressionContext.invokeContextCallback(UIComponent.getCompositeComponentParent(previous));
+        expressionContext.invokeContextCallback(UIComponent.getCompositeComponentParent(current));
     }
     
     @Override
-    public boolean matchKeyword(SearchExpressionContext searchExpressionContext, String keyword)
+    public boolean isResolverForKeyword(SearchExpressionContext searchExpressionContext,
String keyword)
     {
         return COMPOSITE_KEYWORD.equalsIgnoreCase(keyword);
     }

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/CompositeSearchKeywordResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/CompositeSearchKeywordResolver.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/CompositeSearchKeywordResolver.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/CompositeSearchKeywordResolver.java
Mon Jan  9 20:51:23 2017
@@ -56,16 +56,16 @@ public class CompositeSearchKeywordResol
     }
 
     @Override
-    public void resolve(SearchKeywordContext context, UIComponent previous, String command)
+    public void resolve(SearchKeywordContext context, UIComponent current, String keyword)
     {
-        context.setCommandResolved(false);
+        context.setKeywordResolved(false);
         int sz = this.size;
         for (int i = 0; i < sz; i++)
         {
-            if (this.resolvers[i].matchKeyword(context.getSearchExpressionContext(), command))
+            if (this.resolvers[i].isResolverForKeyword(context.getSearchExpressionContext(),
keyword))
             {
-                this.resolvers[i].resolve(context, previous, command);
-                if (context.isCommandResolved())
+                this.resolvers[i].resolve(context, current, keyword);
+                if (context.isKeywordResolved())
                 {
                     return;
                 }
@@ -74,12 +74,12 @@ public class CompositeSearchKeywordResol
     }
 
     @Override
-    public boolean matchKeyword(SearchExpressionContext searchExpressionContext, String keyword)
+    public boolean isResolverForKeyword(SearchExpressionContext searchExpressionContext,
String keyword)
     {
         int sz = this.size;
         for (int i = 0; i < sz; i++)
         {
-            if (this.resolvers[i].matchKeyword(searchExpressionContext, keyword))
+            if (this.resolvers[i].isResolverForKeyword(searchExpressionContext, keyword))
             {
                 return true;
             }
@@ -93,7 +93,7 @@ public class CompositeSearchKeywordResol
         int sz = this.size;
         for (int i = 0; i < sz; i++)
         {
-            if (this.resolvers[i].matchKeyword(searchExpressionContext, keyword))
+            if (this.resolvers[i].isResolverForKeyword(searchExpressionContext, keyword))
             {
                 return this.resolvers[i].isPassthrough(searchExpressionContext, keyword);
             }
@@ -107,7 +107,7 @@ public class CompositeSearchKeywordResol
         int sz = this.size;
         for (int i = 0; i < sz; i++)
         {
-            if (this.resolvers[i].matchKeyword(searchExpressionContext, keyword))
+            if (this.resolvers[i].isResolverForKeyword(searchExpressionContext, keyword))
             {
                 return this.resolvers[i].isLeaf(searchExpressionContext, keyword);
             }

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/FormSearchKeywordResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/FormSearchKeywordResolver.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/FormSearchKeywordResolver.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/FormSearchKeywordResolver.java
Mon Jan  9 20:51:23 2017
@@ -34,9 +34,9 @@ public class FormSearchKeywordResolver e
     public static final String FORM_KEYWORD = "form";
 
     @Override
-    public void resolve(SearchKeywordContext expressionContext, UIComponent previous, String
command)
+    public void resolve(SearchKeywordContext expressionContext, UIComponent current, String
keyword)
     {
-        expressionContext.invokeContextCallback(closest(UIForm.class, previous));
+        expressionContext.invokeContextCallback(closest(UIForm.class, current));
     }
     
     private static <T> T closest(Class<T> type, UIComponent base) 
@@ -57,7 +57,7 @@ public class FormSearchKeywordResolver e
     }    
     
     @Override
-    public boolean matchKeyword(SearchExpressionContext searchExpressionContext, String keyword)
+    public boolean isResolverForKeyword(SearchExpressionContext searchExpressionContext,
String keyword)
     {
         return FORM_KEYWORD.equalsIgnoreCase(keyword);
     }

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/IdSearchKeywordResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/IdSearchKeywordResolver.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/IdSearchKeywordResolver.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/IdSearchKeywordResolver.java
Mon Jan  9 20:51:23 2017
@@ -43,23 +43,23 @@ public class IdSearchKeywordResolver ext
     private static final Pattern PATTERN = Pattern.compile("id\\((\\w+)\\)");
 
     @Override
-    public void resolve(SearchKeywordContext expressionContext, UIComponent previous, String
command)
+    public void resolve(SearchKeywordContext expressionContext, UIComponent current, String
keyword)
     {
         FacesContext facesContext = expressionContext.getSearchExpressionContext().getFacesContext();
         
-        final String targetId = extractId(command);
+        final String targetId = extractId(keyword);
         if (expressionContext.getSearchExpressionContext().getExpressionHints() != null
                 && expressionContext.getSearchExpressionContext().getExpressionHints().contains(
                         SearchExpressionHint.SKIP_VIRTUAL_COMPONENTS))
         {
             // Avoid visit tree because in this case we need real component instances.
             // This means components inside UIData will not be scanned. 
-            withId(facesContext, targetId, previous, expressionContext.getCallback());
-            expressionContext.setCommandResolved(true);
+            withId(facesContext, targetId, current, expressionContext.getCallback());
+            expressionContext.setKeywordResolved(true);
         }
         else
         {
-            previous.visitTree(
+            current.visitTree(
                     VisitContext.createVisitContext(facesContext, null,
                             expressionContext.getSearchExpressionContext().getVisitHints()),
                     new VisitCallback()
@@ -139,7 +139,7 @@ public class IdSearchKeywordResolver ext
     }
     
     @Override
-    public boolean matchKeyword(SearchExpressionContext searchExpressionContext, String command)
+    public boolean isResolverForKeyword(SearchExpressionContext searchExpressionContext,
String command)
     {
         if (command != null && command.length() > 6 && 
                 command.substring(0, ID_KEYWORD.length()).equalsIgnoreCase(ID_KEYWORD))

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NamingContainerSearchKeywordResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NamingContainerSearchKeywordResolver.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NamingContainerSearchKeywordResolver.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NamingContainerSearchKeywordResolver.java
Mon Jan  9 20:51:23 2017
@@ -33,9 +33,9 @@ public class NamingContainerSearchKeywor
     public static final String NAMING_CONTAINER_KEYWORD = "namingcontainer";
 
     @Override
-    public void resolve(SearchKeywordContext expressionContext, UIComponent previous, String
command)
+    public void resolve(SearchKeywordContext expressionContext, UIComponent current, String
keyword)
     {
-        expressionContext.invokeContextCallback((UIComponent) closest(NamingContainer.class,
previous));
+        expressionContext.invokeContextCallback((UIComponent) closest(NamingContainer.class,
current));
     }
     
     private static <T> T closest(Class<T> type, UIComponent base) 
@@ -56,7 +56,7 @@ public class NamingContainerSearchKeywor
     }
     
     @Override
-    public boolean matchKeyword(SearchExpressionContext searchExpressionContext, String keyword)
+    public boolean isResolverForKeyword(SearchExpressionContext searchExpressionContext,
String keyword)
     {
         return NAMING_CONTAINER_KEYWORD.equalsIgnoreCase(keyword);
     }

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NextSearchKeywordResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NextSearchKeywordResolver.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NextSearchKeywordResolver.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NextSearchKeywordResolver.java
Mon Jan  9 20:51:23 2017
@@ -34,13 +34,13 @@ public class NextSearchKeywordResolver e
     public static final String NEXT_KEYWORD = "next";
 
     @Override
-    public void resolve(SearchKeywordContext expressionContext, UIComponent previous, String
command)
+    public void resolve(SearchKeywordContext expressionContext, UIComponent current, String
keyword)
     {
-        UIComponent parent = previous.getParent();
+        UIComponent parent = current.getParent();
         if (parent.getChildCount() > 1) 
         {
             List<UIComponent> children = parent.getChildren();
-            int index = children.indexOf(previous);
+            int index = children.indexOf(current);
 
             if (index < parent.getChildCount() - 1)
             {
@@ -60,11 +60,11 @@ public class NextSearchKeywordResolver e
                 }
             }
         }
-        expressionContext.setCommandResolved(true);
+        expressionContext.setKeywordResolved(true);
     }
     
     @Override
-    public boolean matchKeyword(SearchExpressionContext searchExpressionContext, String keyword)
+    public boolean isResolverForKeyword(SearchExpressionContext searchExpressionContext,
String keyword)
     {
         return NEXT_KEYWORD.equalsIgnoreCase(keyword);
     }

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NoneSearchKeywordResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NoneSearchKeywordResolver.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NoneSearchKeywordResolver.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/NoneSearchKeywordResolver.java
Mon Jan  9 20:51:23 2017
@@ -33,13 +33,13 @@ public class NoneSearchKeywordResolver e
     public static final String NONE_KEYWORD = "none";
 
     @Override
-    public void resolve(SearchKeywordContext expressionContext, UIComponent previous, String
command)
+    public void resolve(SearchKeywordContext expressionContext, UIComponent current, String
keyword)
     {
-        expressionContext.setCommandResolved(true);
+        expressionContext.setKeywordResolved(true);
     }
     
     @Override
-    public boolean matchKeyword(SearchExpressionContext searchExpressionContext, String keyword)
+    public boolean isResolverForKeyword(SearchExpressionContext searchExpressionContext,
String keyword)
     {
         return NONE_KEYWORD.equalsIgnoreCase(keyword);
     }

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ParentSearchKeywordResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ParentSearchKeywordResolver.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ParentSearchKeywordResolver.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ParentSearchKeywordResolver.java
Mon Jan  9 20:51:23 2017
@@ -32,13 +32,13 @@ public class ParentSearchKeywordResolver
     public static final String PARENT_KEYWORD = "parent";
 
     @Override
-    public void resolve(SearchKeywordContext expressionContext, UIComponent previous, String
command)
+    public void resolve(SearchKeywordContext expressionContext, UIComponent current, String
keyword)
     {
-        expressionContext.invokeContextCallback(previous.getParent());
+        expressionContext.invokeContextCallback(current.getParent());
     }
 
     @Override
-    public boolean matchKeyword(SearchExpressionContext searchExpressionContext, String keyword)
+    public boolean isResolverForKeyword(SearchExpressionContext searchExpressionContext,
String keyword)
     {
         return PARENT_KEYWORD.equalsIgnoreCase(keyword);
     }

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/PreviousSearchKeywordResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/PreviousSearchKeywordResolver.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/PreviousSearchKeywordResolver.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/PreviousSearchKeywordResolver.java
Mon Jan  9 20:51:23 2017
@@ -34,14 +34,14 @@ public class PreviousSearchKeywordResolv
     public static final String PREVIOUS_KEYWORD = "previous";
 
     @Override
-    public void resolve(SearchKeywordContext expressionContext, UIComponent previous, String
command)
+    public void resolve(SearchKeywordContext expressionContext, UIComponent current, String
keyword)
     {
-        UIComponent parent = previous.getParent();
+        UIComponent parent = current.getParent();
 
         if (parent.getChildCount() > 1)
         {
             List<UIComponent> children = parent.getChildren();
-            int index = children.indexOf(previous);
+            int index = children.indexOf(current);
 
             if (index > 0)
             {
@@ -61,11 +61,11 @@ public class PreviousSearchKeywordResolv
                 }
             }
         }
-        expressionContext.setCommandResolved(true);
+        expressionContext.setKeywordResolved(true);
     }
     
     @Override
-    public boolean matchKeyword(SearchExpressionContext searchExpressionContext, String keyword)
+    public boolean isResolverForKeyword(SearchExpressionContext searchExpressionContext,
String keyword)
     {
         return PREVIOUS_KEYWORD.equalsIgnoreCase(keyword);
     }

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/RootSearchKeywordResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/RootSearchKeywordResolver.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/RootSearchKeywordResolver.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/RootSearchKeywordResolver.java
Mon Jan  9 20:51:23 2017
@@ -32,14 +32,14 @@ public class RootSearchKeywordResolver e
     public static final String ROOT_KEYWORD = "root";
 
     @Override
-    public void resolve(SearchKeywordContext expressionContext, UIComponent previous, String
command)
+    public void resolve(SearchKeywordContext expressionContext, UIComponent current, String
keyword)
     {
         expressionContext.invokeContextCallback(
                 expressionContext.getSearchExpressionContext().getFacesContext().getViewRoot());
     }
 
     @Override
-    public boolean matchKeyword(SearchExpressionContext searchExpressionContext, String keyword)
+    public boolean isResolverForKeyword(SearchExpressionContext searchExpressionContext,
String keyword)
     {
         return ROOT_KEYWORD.equalsIgnoreCase(keyword);
     }

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/SearchExpressionHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/SearchExpressionHandlerImpl.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/SearchExpressionHandlerImpl.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/SearchExpressionHandlerImpl.java
Mon Jan  9 20:51:23 2017
@@ -19,12 +19,9 @@
 
 package org.apache.myfaces.component.search;
 
-import java.beans.BeanInfo;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.EnumSet;
 import java.util.List;
-import java.util.Set;
 import javax.faces.FacesException;
 import javax.faces.component.ContextCallback;
 import javax.faces.component.NamingContainer;
@@ -35,8 +32,6 @@ import javax.faces.component.search.Sear
 import javax.faces.component.search.SearchExpressionHint;
 import javax.faces.component.search.SearchKeywordContext;
 import javax.faces.context.FacesContext;
-import javax.faces.view.AttachedObjectTarget;
-import javax.faces.view.EditableValueHolderAttachedObjectTarget;
 
 /**
  *
@@ -94,10 +89,6 @@ public class SearchExpressionHandlerImpl
                         searchExpressionContext, searchExpressionContext.getSource(), expression,
callback);
             }
 
-            if (!callback.isClientIdFound() && isHintSet(searchExpressionContext,
SearchExpressionHint.PARENT_FALLBACK))
-            {
-                callback.invokeContextCallback(facesContext, searchExpressionContext.getSource().getParent());
-            }
             if (!callback.isClientIdFound())
             {
                 if (isHintSet(searchExpressionContext, SearchExpressionHint.IGNORE_NO_RESULT))
@@ -173,10 +164,6 @@ public class SearchExpressionHandlerImpl
             }
         }
 
-        if (!callback.isClientIdFound() && isHintSet(searchExpressionContext, SearchExpressionHint.PARENT_FALLBACK))
-        {
-            callback.invokeContextCallback(facesContext, searchExpressionContext.getSource().getParent());
-        }
         if (!callback.isClientIdFound())
         {
             if (isHintSet(searchExpressionContext, SearchExpressionHint.IGNORE_NO_RESULT))
@@ -253,10 +240,6 @@ public class SearchExpressionHandlerImpl
                     expression, checkCallback);
         }
 
-        if (!checkCallback.isInvoked() && isHintSet(searchExpressionContext, SearchExpressionHint.PARENT_FALLBACK))
-        {
-            checkCallback.invokeContextCallback(facesContext, searchExpressionContext.getSource().getParent());
-        }
         if (!checkCallback.isInvoked())
         {
             if (isHintSet(searchExpressionContext, SearchExpressionHint.IGNORE_NO_RESULT))
@@ -333,11 +316,6 @@ public class SearchExpressionHandlerImpl
             }
         }
 
-        // ...
-        if (!checkCallback.isInvoked() && isHintSet(searchExpressionContext, SearchExpressionHint.PARENT_FALLBACK))
-        {
-            checkCallback.invokeContextCallback(facesContext, searchExpressionContext.getSource().getParent());
-        }
         if (!checkCallback.isInvoked())
         {
             if (isHintSet(searchExpressionContext, SearchExpressionHint.IGNORE_NO_RESULT))
@@ -545,14 +523,7 @@ public class SearchExpressionHandlerImpl
             }
             if (currentBase != null)
             {
-                if (isHintSet(searchExpressionContext, SearchExpressionHint.UNWRAP_COMPOSITE_COMPONENT))
-                {
-                    unwrapCompositeComponent(facesContext, target, topCallback);
-                }
-                else
-                {
-                    topCallback.invokeContextCallback(facesContext, currentBase);
-                }
+                topCallback.invokeContextCallback(facesContext, currentBase);
             }
         }
     }
@@ -561,28 +532,9 @@ public class SearchExpressionHandlerImpl
     protected void applyKeyword(SearchExpressionContext searchExpressionContext, UIComponent
last,
                              String command, String remainingExpression, ContextCallback
topCallback)
     {
-        SearchKeywordContext searchContext;
-        
-        if (isHintSet(searchExpressionContext, SearchExpressionHint.UNWRAP_COMPOSITE_COMPONENT)
-                && remainingExpression == null)
-        {
-            ContextCallback wrapperCallback = new ContextCallback()
-            {
-                @Override
-                public void invokeContextCallback(FacesContext context, UIComponent target)
-                {
-                    unwrapCompositeComponent(context, target, topCallback);
-                }
-            };
-                    
-            searchContext = new SearchKeywordContext(searchExpressionContext, wrapperCallback);
-        }
-        else
-        {
-            searchContext = new SearchKeywordContext(searchExpressionContext, topCallback);
-        }
+        SearchKeywordContext searchContext =
+                new SearchKeywordContext(searchExpressionContext, topCallback, remainingExpression);
 
-        searchContext.setRemainingExpression(remainingExpression);
         searchExpressionContext.getFacesContext().getApplication()
                 .getSearchKeywordResolver().resolve(searchContext, last, command);
     }
@@ -685,7 +637,7 @@ public class SearchExpressionHandlerImpl
 
             // If the keyword is @child, @composite, @form, @namingcontainer, @next, @none,
@parent, @previous,
             // @root, @this ,  all commands change the source to be applied the action
-            isValid = facesContext.getApplication().getSearchKeywordResolver().matchKeyword(
+            isValid = facesContext.getApplication().getSearchKeywordResolver().isResolverForKeyword(
                     searchExpressionContext, command);
             if (remaining != null)
             {
@@ -853,38 +805,4 @@ public class SearchExpressionHandlerImpl
         return tokens.toArray(new String[tokens.size()]);
     }
 
-    private static final Set<SearchExpressionHint> UNWRAP_COMPOSITE_COMPONENT_HINTS
= EnumSet.of(
-            SearchExpressionHint.SKIP_VIRTUAL_COMPONENTS,
-            SearchExpressionHint.UNWRAP_COMPOSITE_COMPONENT);
-    
-    protected void unwrapCompositeComponent(FacesContext facesContext, UIComponent composite,
-            ContextCallback callback)
-    {
-        boolean resolved = false;
-        
-        if (UIComponent.isCompositeComponent(composite))
-        {
-            BeanInfo info = (BeanInfo) composite.getAttributes().get(UIComponent.BEANINFO_KEY);
-            List<AttachedObjectTarget> targets = (List<AttachedObjectTarget>)
info.getBeanDescriptor()
-                    .getValue(AttachedObjectTarget.ATTACHED_OBJECT_TARGETS_KEY);
-
-            for (AttachedObjectTarget target : targets)
-            {
-                if (target instanceof EditableValueHolderAttachedObjectTarget)
-                {
-                    SearchExpressionContext searchExpressionContext =
-                            SearchExpressionContext.createSearchExpressionContext(facesContext,
composite,
-                                    UNWRAP_COMPOSITE_COMPONENT_HINTS, null);
-                    facesContext.getApplication().getSearchExpressionHandler().resolveComponent(
-                            searchExpressionContext, target.getName(), callback);
-                    resolved = true;
-                }
-            }
-        }
-
-        if (!resolved)
-        {
-            callback.invokeContextCallback(facesContext, composite);
-        }
-    }
 }
\ No newline at end of file

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ThisSearchKeywordResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ThisSearchKeywordResolver.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ThisSearchKeywordResolver.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/search/ThisSearchKeywordResolver.java
Mon Jan  9 20:51:23 2017
@@ -32,13 +32,13 @@ public class ThisSearchKeywordResolver e
     public static final String THIS_KEYWORD = "this";
 
     @Override
-    public void resolve(SearchKeywordContext expressionContext, UIComponent previous, String
command)
+    public void resolve(SearchKeywordContext expressionContext, UIComponent current, String
keyword)
     {
-        expressionContext.invokeContextCallback(previous);
+        expressionContext.invokeContextCallback(current);
     }
 
     @Override
-    public boolean matchKeyword(SearchExpressionContext searchExpressionContext, String keyword)
+    public boolean isResolverForKeyword(SearchExpressionContext searchExpressionContext,
String keyword)
     {
         return THIS_KEYWORD.equalsIgnoreCase(keyword);
     }

Modified: myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/component/search/SearchExpressionImplTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/component/search/SearchExpressionImplTest.java?rev=1778044&r1=1778043&r2=1778044&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/component/search/SearchExpressionImplTest.java
(original)
+++ myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/component/search/SearchExpressionImplTest.java
Mon Jan  9 20:51:23 2017
@@ -228,24 +228,16 @@ public class SearchExpressionImplTest ex
         executeBeforeRender();
         executeBuildViewCycle();
         
-        UIOutput out = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:showName");
-        Set<SearchExpressionHint> expressionHints = new HashSet<SearchExpressionHint>();
-        expressionHints.add(SearchExpressionHint.PARENT_FALLBACK);
-        SearchExpressionContext searchContextWithParentFallback = 
-                SearchExpressionContext.createSearchExpressionContext(facesContext, out,
expressionHints, null);
         SearchExpressionHandler handler = facesContext.getApplication().getSearchExpressionHandler();
         
-        String clientId = handler.resolveClientId(searchContextWithParentFallback, "@none");
-        Assert.assertNotNull(clientId);
-        
-        Assert.assertNotNull(handler.resolveClientId(searchContextWithParentFallback, " "));
-        
-        expressionHints = new HashSet<SearchExpressionHint>();
+        UIOutput out = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:showName");
+        Set<SearchExpressionHint> expressionHints = new HashSet<SearchExpressionHint>();
+
         expressionHints.add(SearchExpressionHint.IGNORE_NO_RESULT);
         SearchExpressionContext searchContextWithIgnoreNoResult = 
                 SearchExpressionContext.createSearchExpressionContext(facesContext, out,
expressionHints, null);
         
-        clientId = handler.resolveClientId(searchContextWithIgnoreNoResult, "@none");
+        String clientId = handler.resolveClientId(searchContextWithIgnoreNoResult, "@none");
         Assert.assertNull(clientId);
         
         SearchExpressionContext searchContext = 
@@ -270,22 +262,15 @@ public class SearchExpressionImplTest ex
         executeBeforeRender();
         executeBuildViewCycle();
         
-        UIOutput out = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:showName");
-        Set<SearchExpressionHint> expressionHints = new HashSet<SearchExpressionHint>();
-        expressionHints.add(SearchExpressionHint.PARENT_FALLBACK);
-        SearchExpressionContext searchContextWithParentFallback = 
-                SearchExpressionContext.createSearchExpressionContext(facesContext, out,
expressionHints, null);
         SearchExpressionHandler handler = facesContext.getApplication().getSearchExpressionHandler();
         
-        List<String> clientId = handler.resolveClientIds(searchContextWithParentFallback,
"@none");
-        Assert.assertNotNull(clientId.get(0));
-        
-        expressionHints = new HashSet<SearchExpressionHint>();
+        UIOutput out = (UIOutput) facesContext.getViewRoot().findComponent("mainForm:showName");
+        Set<SearchExpressionHint> expressionHints = new HashSet<SearchExpressionHint>();
         expressionHints.add(SearchExpressionHint.IGNORE_NO_RESULT);
         SearchExpressionContext searchContextWithIgnoreNoResult = 
                 SearchExpressionContext.createSearchExpressionContext(facesContext, out,
expressionHints, null);
         
-        clientId = handler.resolveClientIds(searchContextWithIgnoreNoResult, "@none");
+        List<String> clientId = handler.resolveClientIds(searchContextWithIgnoreNoResult,
"@none");
         Assert.assertTrue(clientId.isEmpty());
         
         SearchExpressionContext searchContext = 
@@ -396,49 +381,4 @@ public class SearchExpressionImplTest ex
         
         
     }
-    
-    @Test
-    public void testCompositeComponentWrappedInput() throws Exception
-    {
-        startViewRequest("/testCompositeWrappedInput.xhtml");
-        processLifecycleExecute();
-        executeBeforeRender();
-        executeBuildViewCycle();
-
-        Assert.assertNotNull(
-                facesContext.getViewRoot().findComponent("testForm1"));
-        Assert.assertNotNull(
-                facesContext.getViewRoot().findComponent(":testForm1:myComposite"));
-        Assert.assertTrue(
-                UIComponent.isCompositeComponent(facesContext.getViewRoot().findComponent(":testForm1:myComposite")));
-        Assert.assertNotNull(
-                facesContext.getViewRoot().findComponent(":testForm1:myComposite:myComposite"));
-        
-        final SearchExpressionHandler handler = facesContext.getApplication().getSearchExpressionHandler();
-        
-        final Set<SearchExpressionHint> expressionHints = new HashSet<>();
-        expressionHints.add(SearchExpressionHint.UNWRAP_COMPOSITE_COMPONENT);
-
-        SearchExpressionContext searchContext = SearchExpressionContext.createSearchExpressionContext(facesContext,
-                facesContext.getViewRoot(), expressionHints, null);
-        Assert.assertEquals("testForm1:myComposite:myInput",
-                handler.resolveClientId(searchContext, ":testForm1:myComposite"));
-        
-        handler.resolveComponent(searchContext, "testForm1", new ContextCallback() {
-
-            @Override
-            public void invokeContextCallback(FacesContext context, UIComponent target) {
               
-                SearchExpressionContext innerSearchContext =
-                        SearchExpressionContext.createSearchExpressionContext(facesContext,
-                                target, expressionHints, null);
-                
-                Assert.assertEquals("testForm1:myComposite:myInput", handler.resolveClientId(innerSearchContext,
"@child(0)"));
-                Assert.assertEquals("testForm1:myWrappedComposite:wrappedWrapped:myInput",
handler.resolveClientId(innerSearchContext, "@child(1)"));
-            }
-        });
-        
-        
-        searchContext = SearchExpressionContext.createSearchExpressionContext(facesContext,
facesContext.getViewRoot());
-        Assert.assertEquals("testForm1:myComposite", handler.resolveClientId(searchContext,
":testForm1:myComposite"));
-    }
 }



Mime
View raw message