Return-Path: Delivered-To: apmail-click-commits-archive@www.apache.org Received: (qmail 38300 invoked from network); 3 Jul 2010 11:13:11 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 3 Jul 2010 11:13:11 -0000 Received: (qmail 33953 invoked by uid 500); 3 Jul 2010 11:13:11 -0000 Delivered-To: apmail-click-commits-archive@click.apache.org Received: (qmail 33932 invoked by uid 500); 3 Jul 2010 11:13:11 -0000 Mailing-List: contact commits-help@click.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: click-dev@click.apache.org Delivered-To: mailing list commits@click.apache.org Received: (qmail 33923 invoked by uid 99); 3 Jul 2010 11:13:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Jul 2010 11:13:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Jul 2010 11:13:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 70AEC23889DD; Sat, 3 Jul 2010 11:12:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r960197 - in /click/trunk/click/framework/src/org/apache/click/control: Button.java Submit.java Date: Sat, 03 Jul 2010 11:12:14 -0000 To: commits@click.apache.org From: sabob@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100703111214.70AEC23889DD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sabob Date: Sat Jul 3 11:12:14 2010 New Revision: 960197 URL: http://svn.apache.org/viewvc?rev=960197&view=rev Log: button should handle ajax requests Modified: click/trunk/click/framework/src/org/apache/click/control/Button.java click/trunk/click/framework/src/org/apache/click/control/Submit.java Modified: click/trunk/click/framework/src/org/apache/click/control/Button.java URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/Button.java?rev=960197&r1=960196&r2=960197&view=diff ============================================================================== --- click/trunk/click/framework/src/org/apache/click/control/Button.java (original) +++ click/trunk/click/framework/src/org/apache/click/control/Button.java Sat Jul 3 11:12:14 2010 @@ -18,6 +18,7 @@ */ package org.apache.click.control; +import org.apache.click.Context; import org.apache.click.util.HtmlStringBuffer; /** @@ -141,14 +142,37 @@ public class Button extends Field { // Public Methods -------------------------------------------------------- /** - * Returns true, as buttons perform no server side logic. + * For non Ajax requests this method returns true, as buttons by default + * perform no server side logic. If the button is an Ajax target and a + * behavior is defined, the behavior action will be invoked. * * @see org.apache.click.control.Field#onProcess() * - * @return true + * @return true to continue Page event processing or false otherwise */ @Override public boolean onProcess() { + Context context = getContext(); + + if (!context.isAjaxRequest()) { + return true; + } + + if (isDisabled()) { + // Switch off disabled property if control has incoming request + // parameter. Normally this means the field was enabled via JS + if (context.hasRequestParameter(getName())) { + setDisabled(false); + } else { + // If field is disabled skip process event + return true; + } + } + + if (context.hasRequestParameter(getName())) { + dispatchActionEvent(); + } + return true; } Modified: click/trunk/click/framework/src/org/apache/click/control/Submit.java URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/Submit.java?rev=960197&r1=960196&r2=960197&view=diff ============================================================================== --- click/trunk/click/framework/src/org/apache/click/control/Submit.java (original) +++ click/trunk/click/framework/src/org/apache/click/control/Submit.java Sat Jul 3 11:12:14 2010 @@ -194,8 +194,7 @@ public class Submit extends Button { * Process the submit event and return true to continue event processing. *

* If the submit button is clicked and a Control listener is defined, the - * listener method will be invoked and its boolean return value will be - * returned by this method. + * listener method will be invoked. *

* Submit buttons will be processed after all the non Button Form Controls * have been processed. Submit buttons will be processed in the order