myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r414102 - /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java
Date Wed, 14 Jun 2006 06:15:56 GMT
Author: matzew
Date: Tue Jun 13 23:15:55 2006
New Revision: 414102

URL: http://svn.apache.org/viewvc?rev=414102&view=rev
Log:
enhancing NavigationHandlerImpl. part I

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java?rev=414102&r1=414101&r2=414102&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java
Tue Jun 13 23:15:55 2006
@@ -70,7 +70,7 @@
 
         String viewId = facesContext.getViewRoot().getViewId();
         Map casesMap = getNavigationCases(facesContext);
-        NavigationCase navigationCase = null;
+        NavigationCase navigationCase = getNavigationCase(facesContext, fromAction, outcome);
 
         List casesList = (List)casesMap.get(viewId);
         if (casesList != null)
@@ -79,37 +79,6 @@
             navigationCase = calcMatchingNavigationCase(casesList, fromAction, outcome);
         }
 
-        if (navigationCase == null)
-        {
-            // Wildcard match?
-            List keys = getSortedWildcardKeys();
-            for (int i = 0, size = keys.size(); i < size; i++)
-            {
-                String fromViewId = (String)keys.get(i);
-                if (fromViewId.length() > 2)
-                {
-                    String prefix = fromViewId.substring(0, fromViewId.length() - 1);
-                    if (viewId != null && viewId.startsWith(prefix))
-                    {
-                        casesList = (List)casesMap.get(fromViewId);
-                        if (casesList != null)
-                        {
-                            navigationCase = calcMatchingNavigationCase(casesList, fromAction,
outcome);
-                            if (navigationCase != null) break;
-                        }
-                    }
-                }
-                else
-                {
-                    casesList = (List)casesMap.get(fromViewId);
-                    if (casesList != null)
-                    {
-                        navigationCase = calcMatchingNavigationCase(casesList, fromAction,
outcome);
-                        if (navigationCase != null) break;
-                    }
-                }
-            }
-        }
 
         if (navigationCase != null)
         {
@@ -155,6 +124,54 @@
             }
         }
     }
+
+    protected NavigationCase getNavigationCase(FacesContext facesContext, String fromAction,
String outcome)
+    {
+        String viewId = facesContext.getViewRoot().getViewId();
+        Map casesMap = getNavigationCases(facesContext);
+        NavigationCase navigationCase = null;
+
+        List casesList = (List)casesMap.get(viewId);
+        if (casesList != null)
+        {
+            // Exact match?
+            navigationCase = calcMatchingNavigationCase(casesList, fromAction, outcome);
+        }
+
+        if (navigationCase == null)
+        {
+            // Wildcard match?
+            List keys = getSortedWildcardKeys();
+            for (int i = 0, size = keys.size(); i < size; i++)
+            {
+                String fromViewId = (String)keys.get(i);
+                if (fromViewId.length() > 2)
+                {
+                    String prefix = fromViewId.substring(0, fromViewId.length() - 1);
+                    if (viewId != null && viewId.startsWith(prefix))
+                    {
+                        casesList = (List)casesMap.get(fromViewId);
+                        if (casesList != null)
+                        {
+                            navigationCase = calcMatchingNavigationCase(casesList, fromAction,
outcome);
+                            if (navigationCase != null) break;
+                        }
+                    }
+                }
+                else
+                {
+                    casesList = (List)casesMap.get(fromViewId);
+                    if (casesList != null)
+                    {
+                        navigationCase = calcMatchingNavigationCase(casesList, fromAction,
outcome);
+                        if (navigationCase != null) break;
+                    }
+                }
+            }
+        }
+        return navigationCase;
+    }
+
 
     private NavigationCase calcMatchingNavigationCase(List casesList, String actionRef, String
outcome)
     {



Mime
View raw message