incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r482438 - in /incubator/adffaces/trunk/trinidad: trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/DialogService.java trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/NavigationHandlerImpl.java
Date Tue, 05 Dec 2006 01:14:31 GMT
Author: awiner
Date: Mon Dec  4 17:14:29 2006
New Revision: 482438

URL: http://svn.apache.org/viewvc?view=rev&rev=482438
Log:
ADFFACES-315: Want API to disable dialog navigation outcome handling.  Added a servlet context
init parameter + attribute that can be used to programatically get rid of "dialog:" handling
altogether.

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/DialogService.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/NavigationHandlerImpl.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/DialogService.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/DialogService.java?view=diff&rev=482438&r1=482437&r2=482438
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/DialogService.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/DialogService.java
Mon Dec  4 17:14:29 2006
@@ -41,6 +41,14 @@
     "org.apache.myfaces.trinidad.DIALOG_NAVIGATION_PREFIX";
 
   /**
+   * Configuration parameter for setting the prefix used in
+   * dialog navigation.  This can either be set as a WEB-INF/web.xml
+   * or programatically set as a ServletContext attribute.
+   */
+  public static final String DISABLE_DIALOG_OUTCOMES_PARAM_NAME =
+    "org.apache.myfaces.trinidad.DISABLE_DIALOG_OUTCOMES";
+
+  /**
    * Create an DialogService.
    */
   protected DialogService()

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/NavigationHandlerImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/NavigationHandlerImpl.java?view=diff&rev=482438&r1=482437&r2=482438
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/NavigationHandlerImpl.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/NavigationHandlerImpl.java
Mon Dec  4 17:14:29 2006
@@ -19,6 +19,7 @@
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.FacesContext;
 
+import org.apache.myfaces.trinidad.context.DialogService;
 import org.apache.myfaces.trinidad.context.RequestContext;
 
 public class NavigationHandlerImpl extends NavigationHandler
@@ -34,6 +35,12 @@
     String       fromAction,
     String       outcome)
   {
+    if (_disableNavigationHandler(context))
+    {
+      _delegate.handleNavigation(context, fromAction, outcome);
+      return;
+    }
+
     UIViewRoot oldRoot = context.getViewRoot();
         
     _delegate.handleNavigation(context, fromAction, outcome);
@@ -57,6 +64,37 @@
     }
   }
   
-  
+  /**
+   * Returns true if "dialog:" prefixes should be entirely disabled.
+   */
+  synchronized private boolean _disableNavigationHandler(FacesContext context)
+  {
+    if (_disabled == null)
+    {
+      _disabled = Boolean.FALSE;
+
+      // First, look in the application map for "true" or Boolean.TRUE.
+      Object disabledAttr = context.getExternalContext().getApplicationMap().
+        get(DialogService.DIALOG_NAVIGATION_PREFIX_PARAM_NAME);
+      if (disabledAttr != null)
+      {
+        _disabled = "true".equalsIgnoreCase(disabledAttr.toString());
+      }
+      else
+      {
+        String disabledParam =
+          context.getExternalContext().getInitParameter(
+                        DialogService.DIALOG_NAVIGATION_PREFIX_PARAM_NAME);
+        if (disabledParam != null)
+        {
+          _disabled = "true".equalsIgnoreCase(disabledParam);
+        }
+      }
+    }
+    
+    return _disabled.booleanValue();
+  }
+
+  private Boolean _disabled;
   private NavigationHandler _delegate;
 }



Mime
View raw message