myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject svn commit: r642689 - /myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/
Date Sun, 30 Mar 2008 06:19:33 GMT
Author: imario
Date: Sat Mar 29 23:19:32 2008
New Revision: 642689

URL: http://svn.apache.org/viewvc?rev=642689&view=rev
Log:
added doc, minor api cleanup

Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/ContextCallback.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRLifecycleFactory.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRLifecycleWrapper.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSubmit.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSubmitRenderer.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSupport.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRViewRootWrapper.java

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/ContextCallback.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/ContextCallback.java?rev=642689&r1=642688&r2=642689&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/ContextCallback.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/ContextCallback.java
Sat Mar 29 23:19:32 2008
@@ -21,6 +21,10 @@
 import javax.faces.context.FacesContext;
 import javax.faces.component.UIComponent;
 
+/**
+ * Interface similar to JSF 1.2 invokeOnComponent to make it easily possible to
+ * migrate to that feature. 
+ */
 interface ContextCallback
 {
     void invokeContextCallback(FacesContext context, UIComponent component);

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRLifecycleFactory.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRLifecycleFactory.java?rev=642689&r1=642688&r2=642689&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRLifecycleFactory.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRLifecycleFactory.java
Sat Mar 29 23:19:32 2008
@@ -4,6 +4,10 @@
 import javax.faces.lifecycle.Lifecycle;
 import java.util.Iterator;
 
+/**
+ * A LifecycleFactory which just decorates the lifecycle passed in to the constructor to
+ * allow interception on ppr requests.
+ */
 public class PPRLifecycleFactory extends LifecycleFactory
 {
     private final LifecycleFactory delegate;

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRLifecycleWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRLifecycleWrapper.java?rev=642689&r1=642688&r2=642689&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRLifecycleWrapper.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRLifecycleWrapper.java
Sat Mar 29 23:19:32 2008
@@ -24,6 +24,11 @@
 import javax.faces.event.PhaseListener;
 import javax.faces.lifecycle.Lifecycle;
 
+/**
+ * A lifecycle wrapper which just decorates the lifecycle passed in to the constructor.
+ * On any ppr request this wrapper will wrap the UIViewRoot of the current view to
+ * make it possible to process just those components in question (affected components).
+ */
 public class PPRLifecycleWrapper extends Lifecycle
 {
     private final Lifecycle delegate;

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java?rev=642689&r1=642688&r2=642689&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java
Sat Mar 29 23:19:32 2008
@@ -54,9 +54,9 @@
 
     private String _inlineLoadingMessage;
 
-    private Boolean _showDebugMessages = new Boolean(false);
+    private Boolean _showDebugMessages = Boolean.FALSE;
 
-    private Boolean _stateUpdate = new Boolean(true);
+    private Boolean _stateUpdate = Boolean.FALSE;
 
     private String _appendMessages;
 

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSubmit.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSubmit.java?rev=642689&r1=642688&r2=642689&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSubmit.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSubmit.java
Sat Mar 29 23:19:32 2008
@@ -18,17 +18,18 @@
  */
 package org.apache.myfaces.custom.ppr;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
 
-import javax.faces.component.UIComponentBase;
 import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
 import javax.faces.context.FacesContext;
 import javax.faces.el.ValueBinding;
 import javax.faces.event.FacesEvent;
-import java.util.Map;
-import java.util.List;
-import java.util.Iterator;
 import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author Thomas Spiegl
@@ -78,6 +79,12 @@
             };
     }
 
+    /**
+     * intercept the event placed by any child component
+     * <br />
+     * if such an event happens PPRSubmit will gather all components and store their client-ids
in
+     * a request scoped list for further processing by the {@link PPRViewRootWrapper} 
+     */
     public void queueEvent(FacesEvent event)
     {
         super.queueEvent(event);
@@ -85,30 +92,32 @@
         FacesContext context = FacesContext.getCurrentInstance();
 
         String processComponentIdsString = getProcessComponentIds();
+        if (!StringUtils.isEmpty(processComponentIdsString))
+        {
+            Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+            List allProcessComponents = (List) requestMap.get(PPRSupport.PROCESS_COMPONENTS);
 
-        Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
-        List allProcessComponents = (List) requestMap.get(PPRSupport.PROCESS_COMPONENTS);
+            List processComponents = PPRSupport.getComponentsByCommaSeparatedIdList(
+                context,
+                this,
+                processComponentIdsString,
+                null
+            );
 
-        List processComponents = PPRSupport.getComponentsByCommaSeparatedIdList(
-            context,
-            this,
-            processComponentIdsString,
-            null
-        );
+            Iterator iterComponents = processComponents.iterator();
+            while (iterComponents.hasNext())
+            {
+                UIComponent component = (UIComponent) iterComponents.next();
+                String clientId = component.getClientId(context);
 
-        Iterator iterComponents = processComponents.iterator();
-        while (iterComponents.hasNext())
-        {
-            UIComponent component = (UIComponent) iterComponents.next();
-            String clientId = component.getClientId(context);
+                if (allProcessComponents == null)
+                {
+                    allProcessComponents = new ArrayList();
+                    requestMap.put(PPRSupport.PROCESS_COMPONENTS, allProcessComponents);
+                }
 
-            if (allProcessComponents == null)
-            {
-                allProcessComponents = new ArrayList();
-                requestMap.put(PPRSupport.PROCESS_COMPONENTS, allProcessComponents);
+                allProcessComponents.add(clientId);
             }
-
-            allProcessComponents.add(clientId);
         }
     }
 }

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSubmitRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSubmitRenderer.java?rev=642689&r1=642688&r2=642689&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSubmitRenderer.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSubmitRenderer.java
Sat Mar 29 23:19:32 2008
@@ -31,7 +31,10 @@
 import java.util.List;
 
 /**
- * @author Thomas Spiegl
+ * If container for a commond component this component allows you to configure which components
+ * to process (validate/update-model) during a ppr request.
+ *
+ * TODO: document why this component helps with UIData too ... why does it?
  */
 public class PPRSubmitRenderer extends Renderer
 {
@@ -45,26 +48,6 @@
             (command == null || command.isImmediate())) {
             throw new FacesException("PPRSubmit must embed a command component with immedate='false'.");
         }
-
-        /*
-        UIComponent parent = component.getParent();
-        if (parent instanceof UICommand) {
-
-            UICommand command = (UICommand) parent;
-
-            if (!StringUtils.isEmpty(pprSubmit.getProcessComponentIds()))
-            {
-                if (!Boolean.TRUE.equals(command.getAttributes().get(PPRSupport.COMMAND_CONFIGURED_MARK)))
-                {
-                    command.getAttributes().put(PPRSupport.COMMAND_CONFIGURED_MARK, Boolean.TRUE);
-                    command.addActionListener(new PPRActionListener());
-                }
-            }
-        }
-        else {
-            throw new FacesException("PPRSubmitRenderer must be embedded in a command component.");
-        }
-        */
     }
 
     public void encodeEnd(FacesContext context, UIComponent component) throws IOException
@@ -72,15 +55,20 @@
         UICommand command = findCommandComponent(true, component);
 
         if (command != null) {
-            PPRSupport.initPPR(context, command);
             List panelGroups = new ArrayList(5);
             String id = command.getId();
             addPPRPanelGroupComponents(context.getViewRoot(), panelGroups);
             for (int i = 0; i < panelGroups.size(); i++) {
                 PPRPanelGroup pprGroup = (PPRPanelGroup) panelGroups.get(i);
+
+                // will init only once, but initPPR awaits a PPRPanelGroup
+                PPRSupport.initPPR(context, pprGroup);
+
                 List triggers = pprGroup.parsePartialTriggers();
                 for (int j = 0; j < triggers.size(); j++) {
                     PartialTriggerParser.PartialTrigger trigger = (PartialTriggerParser.PartialTrigger)
triggers.get(j);
+
+                    // TODO: what about trigger patterns?
                     if (trigger.getPartialTriggerId().equals(id)) {
                         PPRSupport.encodeJavaScript(context, command, pprGroup, trigger);
                     }
@@ -92,6 +80,10 @@
         }
     }
 
+    /**
+     * This component can be child of a command component or embed one as child.
+     * Try to find the command component that way.  
+     */
     private UICommand findCommandComponent(boolean checkParent, UIComponent component)
     {
         if (checkParent) {
@@ -113,6 +105,7 @@
 
     public void addPPRPanelGroupComponents(UIComponent component, List list)
     {
+        // TODO: what about facets?
         for (Iterator it = component.getChildren().iterator(); it.hasNext();) {
             UIComponent c = (UIComponent) it.next();
             if (c instanceof PPRPanelGroup) {

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSupport.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSupport.java?rev=642689&r1=642688&r2=642689&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSupport.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSupport.java
Sat Mar 29 23:19:32 2008
@@ -88,7 +88,7 @@
      * @throws java.io.IOException if the underlying Layer throws an {@link java.io.IOException}
      *                             it is passed through
      */
-    public static void initPPR(FacesContext facesContext, UIComponent uiComponent) throws
IOException
+    public static void initPPR(FacesContext facesContext, PPRPanelGroup uiComponent) throws
IOException
     {
         //if(isPartialRequest(facesContext)) {
         //    return;

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRViewRootWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRViewRootWrapper.java?rev=642689&r1=642688&r2=642689&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRViewRootWrapper.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRViewRootWrapper.java
Sat Mar 29 23:19:32 2008
@@ -33,6 +33,10 @@
 import java.util.Locale;
 import java.util.Map;
 
+/**
+ * UIViewRoot wrapper which will process only those components configured using {@link PPRSubmit}.
+ * If this configuration is missing the default process will take place.
+ */
 public class PPRViewRootWrapper extends UIViewRoot
 {
     private final UIViewRoot delegateViewRoot;



Mime
View raw message