click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r958233 - in /click/trunk/click/framework/src/org/apache/click: CallbackDispatcher.java ClickServlet.java
Date Sat, 26 Jun 2010 15:06:47 GMT
Author: sabob
Date: Sat Jun 26 15:06:47 2010
New Revision: 958233

URL: http://svn.apache.org/viewvc?rev=958233&view=rev
Log:
renamed methods beforeXXX to preXXX. Also added a clear method for cleaning up the dispatcher.

Modified:
    click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java
    click/trunk/click/framework/src/org/apache/click/ClickServlet.java

Modified: click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java?rev=958233&r1=958232&r2=958233&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java (original)
+++ click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java Sat Jun 26 15:06:47
2010
@@ -33,13 +33,13 @@ import org.apache.commons.lang.Validate;
  */
 public class CallbackDispatcher {
 
-    // -------------------------------------------------------------- Constants
+    // Constants --------------------------------------------------------------
 
     /** The thread local dispatcher holder. */
-    private static final ThreadLocal<DispatcherStack> THREAD_LOCAL_DISPATCHER = 
+    private static final ThreadLocal<DispatcherStack> THREAD_LOCAL_DISPATCHER =
                     new ThreadLocal<DispatcherStack>();
 
-    // -------------------------------------------------------------- Variables
+    // Variables --------------------------------------------------------------
 
     /** The set of registered behavior enabled controls. */
     Set<Control> behaviorEnabledControls;
@@ -56,7 +56,7 @@ public class CallbackDispatcher {
         this.logger = configService.getLogService();
     }
 
-    // --------------------------------------------------------- Public Methods
+    // Public Methods ---------------------------------------------------------
 
     public static void registerBehavior(Control control) {
         CallbackDispatcher instance = getThreadLocalDispatcher();
@@ -68,7 +68,7 @@ public class CallbackDispatcher {
         instance.internalRegisterCallback(control, callback);
     }
 
-    // protected methods ------------------------------------------------------
+    // Protected Methods ------------------------------------------------------
 
     /**
      * Allow the dispatcher to handle the error that occurred.
@@ -76,11 +76,23 @@ public class CallbackDispatcher {
      * @param throwable the error which occurred during processing
      */
     protected void errorOccurred(Throwable throwable) {
-        getBehaviorEnabledControls().clear();
-        getCallbacks().clear();
+        clear();
     }
 
-    // ------------------------------------------------ package private methods
+    // Package Private Methods ------------------------------------------------
+
+    /**
+     * Remove all callbacks and controls from this dispatcher.
+     */
+    void clear() {
+        if (hasCallbacks()) {
+            getCallbacks().clear();
+        }
+
+        if (hasBehaviorEnabledControls()) {
+            getBehaviorEnabledControls().clear();
+        }
+    }
 
     /**
      * Register the behavior source control.
@@ -105,7 +117,7 @@ public class CallbackDispatcher {
         getCallbacks().add(callbackHolder);
     }
 
-    void processBeforeResponse(Context context) {
+    void processPreResponse(Context context) {
         if (hasBehaviorEnabledControls()) {
             for (Control control : getBehaviorEnabledControls()) {
                 List<Behavior> behaviors = control.getBehaviors();
@@ -124,7 +136,7 @@ public class CallbackDispatcher {
         }
     }
 
-    void processBeforeGetHeadElements(Context context) {
+    void processPreGetHeadElements(Context context) {
         if (hasBehaviorEnabledControls()) {
             for (Control control : getBehaviorEnabledControls()) {
                 List<Behavior> behaviors = control.getBehaviors();

Modified: click/trunk/click/framework/src/org/apache/click/ClickServlet.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ClickServlet.java?rev=958233&r1=958232&r2=958233&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ClickServlet.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ClickServlet.java Sat Jun 26 15:06:47
2010
@@ -613,8 +613,8 @@ public class ClickServlet extends HttpSe
             }
         }
 
-        callbackDispatcher.processBeforeResponse(context);
-        callbackDispatcher.processBeforeGetHeadElements(context);
+        callbackDispatcher.processPreResponse(context);
+        callbackDispatcher.processPreGetHeadElements(context);
         performRender(page, context, partial);
     }
 
@@ -1767,8 +1767,8 @@ public class ClickServlet extends HttpSe
             if (pageAction != null) {
                 continueProcessing = false;
                 partial = ClickUtils.invokeAction(page, pageAction);
-                callbackDispatcher.processBeforeResponse(context);
-                callbackDispatcher.processBeforeGetHeadElements(context);
+                callbackDispatcher.processPreResponse(context);
+                callbackDispatcher.processPreGetHeadElements(context);
 
                 renderPartial(partial, context);
             }
@@ -1791,8 +1791,8 @@ public class ClickServlet extends HttpSe
 
                 // Ensure we execute the beforeResponse and beforeGetHeadElements
                 // for Ajax requests
-                callbackDispatcher.processBeforeResponse(context);
-                callbackDispatcher.processBeforeGetHeadElements(context);
+                callbackDispatcher.processPreResponse(context);
+                callbackDispatcher.processPreGetHeadElements(context);
 
                 partial = eventDispatcher.getPartial();
 
@@ -1809,8 +1809,8 @@ public class ClickServlet extends HttpSe
                     performOnRender(page, context);
                 }
 
-                callbackDispatcher.processBeforeResponse(context);
-                callbackDispatcher.processBeforeGetHeadElements(context);
+                callbackDispatcher.processPreResponse(context);
+                callbackDispatcher.processPreGetHeadElements(context);
                 performRender(page, context);
             }
         } else {



Mime
View raw message