You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2009/04/28 21:05:30 UTC

svn commit: r769502 - in /myfaces/trinidad/trunk: src/site/xdoc/ src/site/xdoc/devguide/ trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/ trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ trinidad-sandbox/sandbox-demo/sr...

Author: matzew
Date: Tue Apr 28 19:05:30 2009
New Revision: 769502

URL: http://svn.apache.org/viewvc?rev=769502&view=rev
Log:
TRINIDAD-1459 - Add support for Change Manager (customization) feature for Facelets mode

In order to support Change Manager feature in Facelets, we simply introduce a new/optional 
ViewHandler, that extends the FaceletViewHandler.

Thanks to Prakash Udupa N for the patch.

Added:
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadFaceletViewHandler.java
Modified:
    myfaces/trinidad/trunk/src/site/xdoc/devguide/configuration.xml
    myfaces/trinidad/trunk/src/site/xdoc/installation.xml
    myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/web.xml
    myfaces/trinidad/trunk/trinidad-sandbox/sandbox-demo/src/main/webapp/WEB-INF/web.xml

Modified: myfaces/trinidad/trunk/src/site/xdoc/devguide/configuration.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/src/site/xdoc/devguide/configuration.xml?rev=769502&r1=769501&r2=769502&view=diff
==============================================================================
--- myfaces/trinidad/trunk/src/site/xdoc/devguide/configuration.xml (original)
+++ myfaces/trinidad/trunk/src/site/xdoc/devguide/configuration.xml Tue Apr 28 19:05:30 2009
@@ -365,6 +365,22 @@
 rely heavily on frames will likely need to increase this value.
 </p>
 </subsection>
+<subsection name="org.apache.myfaces.trinidad.CHANGE_PERSISTENCE">
+<p>
+This configuration option allows to enable the change persistence 
+feature. This feature is used to achieve customizations using 
+ChangeManager APIs (in package org.apache.myfaces.trinidad.change).
+ The valid values are:
+<ul>
+<li>'session'. This is a convenience token value to use 
+org.apache.myfaces.trinidad.change.SessionChangeManager
+</li>
+<li>Package qualified class name of any custom implementation of 
+org.apache.myfaces.trinidad.change.ChangeManager.
+</li>
+</ul>
+</p>
+</subsection>
 <subsection name="org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE">
 <p>
 This configuration option enables an optimized strategy for caching some

Modified: myfaces/trinidad/trunk/src/site/xdoc/installation.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/src/site/xdoc/installation.xml?rev=769502&r1=769501&r2=769502&view=diff
==============================================================================
--- myfaces/trinidad/trunk/src/site/xdoc/installation.xml (original)
+++ myfaces/trinidad/trunk/src/site/xdoc/installation.xml Tue Apr 28 19:05:30 2009
@@ -154,7 +154,8 @@
 <source><![CDATA[
   <context-param>
     <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
-    <param-value>com.sun.facelets.FaceletViewHandler</param-value>
+    <!-- TrinidadFaceletViewHander must be the alternate view handler if SessionChangeManager is used -->
+    <param-value>org.apache.myfaces.trinidadinternal.facelets.TrinidadFaceletViewHandler</param-value>
   </context-param>
 
   <context-param>
@@ -167,10 +168,14 @@
 Make sure to also remove the
 default <code>com.sun.facelets.FaceletViewHandler</code> from your
 <code>faces-config.xml</code>.  Trinidad comes with its own ViewHandler
-which needs to be invoked in the correct order with the Facelets
-ViewHandler.  If you specified the alternative view handler parameter
+which needs to be invoked in the correct order with the Facelet specific
+ViewHandler noted above. If you specified the alternative view handler parameter
 as described above, it will be called by the Apache Trinidad ViewHandler
-at the right time.
+at the right time. Note that if Session based change persistence is not
+used, <code>com.sun.facelets.FaceletViewHandler</code> or any of its custom 
+extensions can be set as the alternate view handler. For information about 
+enabling Change Persistence feature, please see the 'Configuring Apache Trinidad' 
+developer guide chapter.
 </p>
 
 

Modified: myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/web.xml?rev=769502&r1=769501&r2=769502&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/web.xml Tue Apr 28 19:05:30 2009
@@ -124,7 +124,7 @@
   <!-- Uncomment the below for use with Facelets
   <context-param>
     <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
-    <param-value>com.sun.facelets.FaceletViewHandler</param-value>
+    <param-value>org.apache.myfaces.trinidadinternal.facelets.TrinidadFaceletViewHandler</param-value>
   </context-param>
 
   <context-param>

Added: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadFaceletViewHandler.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadFaceletViewHandler.java?rev=769502&view=auto
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadFaceletViewHandler.java (added)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadFaceletViewHandler.java Tue Apr 28 19:05:30 2009
@@ -0,0 +1,38 @@
+package org.apache.myfaces.trinidadinternal.facelets;
+
+
+import com.sun.facelets.FaceletViewHandler;
+
+import java.io.IOException;
+
+import javax.faces.FacesException;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.trinidad.change.ChangeManager;
+import org.apache.myfaces.trinidad.context.RequestContext;
+
+/**
+ * ViewHandler implementation for Trinidad in Facelets mode
+ */
+public class TrinidadFaceletViewHandler
+  extends FaceletViewHandler
+{
+  public TrinidadFaceletViewHandler(ViewHandler parent)
+  {
+    super(parent);
+  }
+  
+  @Override
+  protected void buildView(FacesContext context, UIViewRoot viewToRender)
+    throws IOException, FacesException 
+  {
+    super.buildView(context, viewToRender);
+    
+    // Apply changes once we have a stable view tree built. This is the earliest 
+    //  opportunity, the document was just attached to the view root.
+    ChangeManager cm = RequestContext.getCurrentInstance().getChangeManager();
+    cm.applyComponentChangesForCurrentView(FacesContext.getCurrentInstance());
+  }
+}

Modified: myfaces/trinidad/trunk/trinidad-sandbox/sandbox-demo/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-sandbox/sandbox-demo/src/main/webapp/WEB-INF/web.xml?rev=769502&r1=769501&r2=769502&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-sandbox/sandbox-demo/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/trinidad/trunk/trinidad-sandbox/sandbox-demo/src/main/webapp/WEB-INF/web.xml Tue Apr 28 19:05:30 2009
@@ -106,7 +106,7 @@
   <!-- Uncomment the below for use with Facelets
   <context-param>
     <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
-    <param-value>com.sun.facelets.FaceletViewHandler</param-value>
+    <param-value>org.apache.myfaces.trinidadinternal.facelets.TrinidadFaceletViewHandler</param-value>
   </context-param>
 
   <context-param>