You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bs...@apache.org on 2010/07/31 01:09:11 UTC

svn commit: r980990 - in /myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context: RequestContext.java Window.java

Author: bsullivan
Date: Fri Jul 30 23:09:10 2010
New Revision: 980990

URL: http://svn.apache.org/viewvc?rev=980990&view=rev
Log:
TRINIDAD-1857 Add a Map associated with each window or tab that the user is interacting with. This would be below session scope but above page flow scope

Add abstract api to Window and default implementation to RequestContext

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContext.java
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Window.java

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContext.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContext.java?rev=980990&r1=980989&r2=980990&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContext.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContext.java Fri Jul 30 23:09:10 2010
@@ -143,6 +143,31 @@ abstract public class RequestContext
    */
   public abstract Map<String, Object> getViewMap(boolean create);
 
+  /**
+   * Returns a Map of objects associated with the current window if any.  If there is no
+   * current window, the Session Map is returned.
+   * @return Map for storing objects associated with the current window.
+   * @see org.apache.myfaces.trinidad.context.Window#getWindowMap
+   */
+  public Map<String, Object> getWindowMap()
+  {
+    WindowManager wm = getWindowManager();
+    
+    ExternalContext extContext = FacesContext.getCurrentInstance().getExternalContext();
+    
+    Window window = wm.getCurrentWindow(extContext);
+
+    if (window != null)
+    {
+      
+      return window.getWindowMap();
+    }
+    else
+    {
+      return extContext.getSessionMap();
+    }
+  }
+
   //
   // Dialog APIs
   //

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Window.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Window.java?rev=980990&r1=980989&r2=980990&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Window.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Window.java Fri Jul 30 23:09:10 2010
@@ -20,7 +20,7 @@ package org.apache.myfaces.trinidad.cont
 
 import java.io.Serializable;
 
-import javax.faces.context.ExternalContext;
+import java.util.Map;
 
 /**
  * Represents a Window in the current user's Session.  Windows are created and vended
@@ -89,5 +89,12 @@ public abstract class Window implements 
    */
   public abstract boolean isNew();
 
+  /**
+   * Returns the Map for storing data associated with this Window object.  If the environment is
+   * configured for fail-over, the contents of this Map must be Serializable.
+   * @return The client data storage Map.
+   */
+  public abstract Map<String, Object> getWindowMap();
+
   private static final long serialVersionUID = 1L;
 }
\ No newline at end of file