On 9/4/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Author: schof
Date: Mon Sep 4 18:45:12 2006
New Revision: 440216
URL: http://svn.apache.org/viewvc?view=rev&rev=440216
Log:
LegacyDialogContext should not throw an exception when the transition
cannot be found during the advance method. Instead return a null view id
and let the wrapped NavigationHandler try to recover. (SHALE-276)
I'm going to need to look at this in more detail (probably not until
tomorrow night), but I do not believe in the stated premises behind this
change (and am therefore pretty unlikely to agree with the implemented
solution). Instead, I believe:
* Once you are inside a dialog, the dialog should be the *only* thing that
manages navigation.
There should be *no such thing* as "outcomes not managed by this dialog"
-- any other approach
leads to totally non-deterministic behavior that quickly becomes
impossible to debug. Based
on this, delegating to the wrapped navigation handler (while inside a
dialog) seems to me like an
exceedingly BAD idea.
* If the advance() method returns null, that should mean the same thing that
an action method
returning null means -- redisplay the current view. Otherwise, you are
going to destroy the
ability of a view developer to not worry about whether the view being
maintained is used within
or outside a dialog (or both). Note that this is going to happen to us by
default, if any validation
errors occur, so the framework MUST respect this approach.
Barring further analysis tomorrow, I'm at the moment -1 on this change.
Craig
Modified:
shale/sandbox/shale-dialog2-legacy/src/main/java/org/apache/shale/dialog2/legacy/LegacyDialogContext.java
Modified:
shale/sandbox/shale-dialog2-legacy/src/main/java/org/apache/shale/dialog2/legacy/LegacyDialogContext.java
URL:
http://svn.apache.org/viewvc/shale/sandbox/shale-dialog2-legacy/src/main/java/org/apache/shale/dialog2/legacy/LegacyDialogContext.java?view=diff&rev=440216&r1=440215&r2=440216
==============================================================================
---
shale/sandbox/shale-dialog2-legacy/src/main/java/org/apache/shale/dialog2/legacy/LegacyDialogContext.java
(original)
+++
shale/sandbox/shale-dialog2-legacy/src/main/java/org/apache/shale/dialog2/legacy/LegacyDialogContext.java
Mon Sep 4 18:45:12 2006
@@ -219,7 +219,15 @@
public String advance(FacesContext context, String outcome) {
Position position = peek();
- transition(position, outcome);
+
+ try {
+ transition(position, outcome);
+ } catch (IllegalStateException ie) {
+ // The transition method didn't like our outcome but its
possible we can
+ // recover if the outcome was intended for a different
NavigationHandler
+ return null;
+ }
+
State state = position.getState();
while (true) {
if (state instanceof ActionState) {