click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r962414 - /click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java
Date Fri, 09 Jul 2010 05:38:24 GMT
Author: sabob
Date: Fri Jul  9 05:38:23 2010
New Revision: 962414

URL: http://svn.apache.org/viewvc?rev=962414&view=rev
Log:
improved logging

Modified:
    click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java

Modified: click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java?rev=962414&r1=962413&r2=962414&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java Fri Jul  9
05:38:23 2010
@@ -131,8 +131,6 @@ public class ActionEventDispatcher {
      * Fire all the registered action events after the Page Controls have been
      * processed and return true if the page should continue processing.
      *
-     * @see #fireActionEvents(org.apache.click.Context, int)
-     *
      * @param context the request context
      *
      * @return true if the page should continue processing, false otherwise
@@ -284,10 +282,32 @@ public class ActionEventDispatcher {
 
         boolean continueProcessing = true;
 
+        if (logger.isTraceEnabled()) {
+            String sourceClassName = ClassUtils.getShortClassName(source.getClass());
+            HtmlStringBuffer buffer = new HtmlStringBuffer();
+            buffer.append("   processing Behaviors for control: '");
+            buffer.append(source.getName()).append("' ");
+            buffer.append(sourceClassName);
+            logger.trace(buffer.toString());
+        }
+
         for (Behavior behavior : source.getBehaviors()) {
 
-            if (behavior.isRequestTarget(context)) {
+            boolean isRequestTarget = behavior.isRequestTarget(context);
+
+            if (logger.isTraceEnabled()) {
+                String behaviorClassName = ClassUtils.getShortClassName(behavior.getClass());
+                HtmlStringBuffer buffer = new HtmlStringBuffer();
+                buffer.append("      invoked: ");
+                buffer.append(behaviorClassName);
+                buffer.append(".isRequestTarget() : ");
+                buffer.append(isRequestTarget);
+                logger.trace(buffer.toString());
+            }
+
+            if (isRequestTarget) {
 
+                // The first non-null Partial returned will be rendered, other Partials are
ignored
                 Partial behaviorPartial = behavior.onAction(source);
                 if (partial == null && behaviorPartial != null) {
                     partial = behaviorPartial;
@@ -295,10 +315,17 @@ public class ActionEventDispatcher {
 
                 if (logger.isTraceEnabled()) {
                     String behaviorClassName = ClassUtils.getShortClassName(behavior.getClass());
+                    String partialClassName = null;
+
+                    if (behaviorPartial != null) {
+                        partialClassName = ClassUtils.getShortClassName(behaviorPartial.getClass());
+                    }
+
                     HtmlStringBuffer buffer = new HtmlStringBuffer();
-                    buffer.append("   invoked: ");
+                    buffer.append("      invoked: ");
                     buffer.append(behaviorClassName);
-                    buffer.append(".isRequestTarget() : true");
+                    buffer.append(".onAction() : ");
+                    buffer.append(partialClassName);
 
                     if (partial == behaviorPartial && behaviorPartial != null) {
                         buffer.append(" (Partial content will be rendered)");
@@ -311,15 +338,6 @@ public class ActionEventDispatcher {
                     }
 
                     logger.trace(buffer.toString());
-
-                    if (partial == null) {
-                        buffer = new HtmlStringBuffer();
-                        buffer.append("   invoked: ");
-                        buffer.append(behaviorClassName);
-                        buffer.append(".onAction() : null");
-                        buffer.append(" (*no* Partial was returned by Behavior)");
-                        logger.trace(buffer.toString());
-                    }
                 }
 
                 continueProcessing = false;



Mime
View raw message