shale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject svn commit: r481140 - /shale/framework/trunk/shale-dialog-basic/src/main/java/org/apache/shale/dialog/basic/BasicDialogContext.java
Date Fri, 01 Dec 2006 03:56:18 GMT
Author: craigmcc
Date: Thu Nov 30 19:56:17 2006
New Revision: 481140

URL: http://svn.apache.org/viewvc?view=rev&rev=481140
Log:
When BasicDialogContext.advance() was called with a null outcome, we were
correctly staying in the same state (to emulate JSF standard navigation
behavior), but we were *incorrectly* recreating the view.  This would destroy
any accumulated information in the component tree and cause it to be
reinitialized, which was the proximate cause for this particular sample app
failing.

Change things so that a null outcome causes us to stay in the same state
*without* recreating the view.  Thanks to Mario Buonopane for the concise
reproducible test case, and to Gary for pointing right at the problem area.

SHALE-341

Modified:
    shale/framework/trunk/shale-dialog-basic/src/main/java/org/apache/shale/dialog/basic/BasicDialogContext.java

Modified: shale/framework/trunk/shale-dialog-basic/src/main/java/org/apache/shale/dialog/basic/BasicDialogContext.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-dialog-basic/src/main/java/org/apache/shale/dialog/basic/BasicDialogContext.java?view=diff&rev=481140&r1=481139&r2=481140
==============================================================================
--- shale/framework/trunk/shale-dialog-basic/src/main/java/org/apache/shale/dialog/basic/BasicDialogContext.java
(original)
+++ shale/framework/trunk/shale-dialog-basic/src/main/java/org/apache/shale/dialog/basic/BasicDialogContext.java
Thu Nov 30 19:56:17 2006
@@ -91,7 +91,7 @@
     }
 
 
-    // ------------------------------------------------------ DialogContext Variables
+    // ------------------------------------------------- DialogContext Variables
 
 
     /**
@@ -175,7 +175,15 @@
     private static final Class[] ACTION_STATE_SIGNATURE = new Class[0];
 
 
-    // ----------------------------------------------------- DialogContext Properties
+    /**
+     * <p>Flag outcome value that signals a need to transition to the
+     * start state for this dialg.</p>
+     */
+    private static final String START_OUTCOME =
+            "org.apache.shale.dialog.basic.START_OUTCOME";
+
+
+    // ------------------------------------------------ DialogContext Properties
 
 
     /** {@inheritDoc} */
@@ -256,7 +264,7 @@
     }
 
 
-    // -------------------------------------------------------- DialogContext Methods
+    // --------------------------------------------------- DialogContext Methods
 
 
     /** {@inheritDoc} */
@@ -273,10 +281,22 @@
                       + ", outcome=" + outcome + ")");
         }
 
+        // If the incoming outcome is null, we want to stay in the same
+        // (view) state *without* recreating it, which would destroy
+        // any useful information that components might have stored
+        if (outcome == null) {
+            if (log().isTraceEnabled()) {
+                log().trace("punt early since outcome is null");
+            }
+            return;
+        }
+
         // Perform an initial transition from the current state based on
         // the logical outcome received from the (current) view state
         Position position = peek();
-        transition(position, outcome);
+        if (!START_OUTCOME.equals(outcome)) {
+            transition(position, outcome);
+        }
         State state = position.getState();
         String viewId = null;
         boolean redirect = false;
@@ -401,7 +421,7 @@
 
         // Advance the computation of our dialog until a view state
         // is encountered, then navigate to it
-        advance(context, null);
+        advance(context, START_OUTCOME);
 
     }
 



Mime
View raw message