deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject deltaspike git commit: DELTASPIKE-928 Allow to disable storeWindowTree() on ClientWindow mode
Date Wed, 15 Jul 2015 21:37:12 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 7823bf88a -> 035a77076


DELTASPIKE-928 Allow to disable storeWindowTree() on ClientWindow mode

Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/035a7707
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/035a7707
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/035a7707

Branch: refs/heads/master
Commit: 035a770767afa9908e18cd4a992d5639c13efc91
Parents: 7823bf8
Author: Thomas Andraschko <tandraschko@apache.org>
Authored: Wed Jul 15 23:37:03 2015 +0200
Committer: Thomas Andraschko <tandraschko@apache.org>
Committed: Wed Jul 15 23:37:03 2015 +0200

----------------------------------------------------------------------
 .../deltaspike/jsf/spi/scope/window/ClientWindowConfig.java  | 7 +++++++
 .../jsf/spi/scope/window/DefaultClientWindowConfig.java      | 6 ++++++
 .../jsf/impl/component/window/WindowIdHtmlRenderer.java      | 8 +++++---
 .../resources/META-INF/resources/deltaspike/windowhandler.js | 2 +-
 4 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/035a7707/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/ClientWindowConfig.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/ClientWindowConfig.java
b/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/ClientWindowConfig.java
index b626eaf..74c960f 100644
--- a/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/ClientWindowConfig.java
+++ b/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/ClientWindowConfig.java
@@ -86,6 +86,13 @@ public interface ClientWindowConfig extends Serializable
      * @return the prepared html which gets sent out to the client as intermediate client
window.
      */
     String getClientWindowHtml();
+    
+    /**
+     * @return whether localStorage is used in the browser to store the HTML content between
client redirects.
+     *          Currently it's only used by {@link ClientWindowRenderMode#CLIENTWINDOW}.
+     * @see windowhandler.html
+     */
+    boolean isClientWindowStoreWindowTreeEnabled(); 
 
     /**
      * Restricts the number of active windows.

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/035a7707/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/DefaultClientWindowConfig.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/DefaultClientWindowConfig.java
b/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/DefaultClientWindowConfig.java
index 3b95fff..63624ad 100644
--- a/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/DefaultClientWindowConfig.java
+++ b/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/DefaultClientWindowConfig.java
@@ -243,4 +243,10 @@ public class DefaultClientWindowConfig implements ClientWindowConfig
     {
         return this.maxWindowContextCount;
     }
+    
+    @Override
+    public boolean isClientWindowStoreWindowTreeEnabled()
+    {
+        return true;
+    }
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/035a7707/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java
index a952606..7db4de4 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java
@@ -74,8 +74,10 @@ public class WindowIdHtmlRenderer extends Renderer
         writer.startElement("script", component);
         writer.writeAttribute("type", "text/javascript", null);
         writer.write("(function(){");
-        writer.write("dswh.init('" + windowId + "','" + clientWindowRenderMode + "'");
+        writer.write("dswh.init('" + windowId + "','" + clientWindowRenderMode + "',{");
 
+        writer.write("'storeWindowTree':'" + clientWindowConfig.isClientWindowStoreWindowTreeEnabled()
+ "'");
+        
         // see #729
         if (clientWindow.isInitialRedirectSupported(context))
         {
@@ -83,7 +85,7 @@ public class WindowIdHtmlRenderer extends Renderer
             if (cookie != null && cookie instanceof Cookie)
             {
                 Cookie servletCookie = (Cookie) cookie;
-                writer.write(",{'initialRedirectWindowId':'" + servletCookie.getValue() +
"'}");
+                writer.write(",'initialRedirectWindowId':'" + servletCookie.getValue() +
"'");
 
                 // expire/remove cookie
                 servletCookie.setMaxAge(0);
@@ -91,7 +93,7 @@ public class WindowIdHtmlRenderer extends Renderer
             }
         }
 
-        writer.write(");");
+        writer.write("});");
         writer.write("})();");
         writer.endElement("script");
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/035a7707/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
index bc7b9d6..dc9bac1 100644
--- a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
+++ b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
@@ -91,7 +91,7 @@ window.dswh = window.dswh || {
             },
             
             overwriteOnClickEvents : function() {
-                if (dswh.utils.isHtml5()) {
+                if (dswh.utils.isHtml5() && dswh.cfg.storeWindowTree) {
                     var links = document.getElementsByTagName("a");
                     for (var i = 0; i < links.length; i++) {
                         if (!links[i].onclick) {


Mime
View raw message