You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by st...@apache.org on 2012/05/14 18:02:34 UTC

svn commit: r1338266 - in /myfaces/extensions/cdi/trunk/jee-modules/jsf-module: api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/config/ impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ impl/src/main/resource...

Author: struberg
Date: Mon May 14 16:02:34 2012
New Revision: 1338266

URL: http://svn.apache.org/viewvc?rev=1338266&view=rev
Log:
EXTCDI-285 add intermediate page branding

and improve javadoc

Modified:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/config/ClientConfig.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ClientSideWindowHandler.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/static/windowhandler.html

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/config/ClientConfig.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/config/ClientConfig.java?rev=1338266&r1=1338265&r2=1338266&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/config/ClientConfig.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/config/ClientConfig.java Mon May 14 16:02:34 2012
@@ -42,6 +42,7 @@ import java.util.Map;
 public class ClientConfig implements Serializable
 {
     private static final long serialVersionUID = 581351549574404793L;
+    public static final String BODY_ATTRIBUTES_PLACEHOLDER = "$$bodyAttributes$$";
 
     private boolean javaScriptEnabled = true;
 
@@ -76,9 +77,18 @@ public class ClientConfig implements Ser
     }
 
     /**
-     * For branding the windowhandler page - e.g. change the backgroundcolour
+     * For branding the whole windowhandler page - e.g. not only change the
+     * background color, add some images and empty menu structure
      * or the language of the message text - you can just copy the content of the
      * {@link #DEFAULT_WINDOW_HANDLER_HTML_FILE} and adopt it to your needs.
+     *
+     * The reason for this is to minimize visual side effects on browsers who do
+     * not properly support html5 localstorage.
+     *
+     * If you just like to change the default background color, then use
+     * {@link #getBodyAttributes()} instead. This will replace the
+     * {@link #BODY_ATTRIBUTES_PLACEHOLDER} on the windowhandler.html page.
+     *
      * @return the location of the <i>windowhandler.html</i> resource
      *         which should be sent to the users browser.
      */
@@ -88,6 +98,17 @@ public class ClientConfig implements Ser
     }
 
     /**
+     * Overwrite this method to set custom specific body attributes on the
+     * intermediate windowhandler.html page.
+     *
+     * @return
+     */
+    public String getBodyAttributes()
+    {
+        return "";
+    }
+
+    /**
      * This might return different windowhandlers based on user settings like
      * his language, an affiliation, etc
      * @return a String containing the whole windowhandler.html file.
@@ -119,6 +140,7 @@ public class ClientConfig implements Ser
         }
 
         windowHandlerHtml = sb.toString();
+
         return windowHandlerHtml;
     }
 

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ClientSideWindowHandler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ClientSideWindowHandler.java?rev=1338266&r1=1338265&r2=1338266&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ClientSideWindowHandler.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ClientSideWindowHandler.java Mon May 14 16:02:34 2012
@@ -170,6 +170,10 @@ public class ClientSideWindowHandler ext
 
             String windowHandlerHtml = this.clientConfig.getWindowHandlerHtml();
 
+            // replace any background color or other body attribute setting
+            windowHandlerHtml = windowHandlerHtml.replace(ClientConfig.BODY_ATTRIBUTES_PLACEHOLDER,
+                                                          clientConfig.getBodyAttributes());
+
             if (windowId == null)
             {
                 windowId = UNINITIALIZED_WINDOW_ID_VALUE;

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/static/windowhandler.html
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/static/windowhandler.html?rev=1338266&r1=1338265&r2=1338266&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/static/windowhandler.html (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/static/windowhandler.html Mon May 14 16:02:34 2012
@@ -22,7 +22,7 @@
 <html>
 
 <head><title>Loading...</title></head>
-<body><div id="message" style="position:absolute;left:40%;top:40%">
+<body $$bodyAttributes$$><div id="message" style="position:absolute;left:40%;top:40%">
     Your browser does not support JavaScript.
     Click <a href="$$noscriptUrl$$">here</a> to continue without JavaScript.
 </div></body>