You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by kn...@apache.org on 2008/08/27 14:53:03 UTC
svn commit: r689465 -
/wicket/sandbox/knopp/experimental/wicket/src/main/java/org/apache/wicket/ajaxng/AjaxRequestAttributes.java
Author: knopp
Date: Wed Aug 27 05:53:02 2008
New Revision: 689465
URL: http://svn.apache.org/viewvc?rev=689465&view=rev
Log: (empty)
Modified:
wicket/sandbox/knopp/experimental/wicket/src/main/java/org/apache/wicket/ajaxng/AjaxRequestAttributes.java
Modified: wicket/sandbox/knopp/experimental/wicket/src/main/java/org/apache/wicket/ajaxng/AjaxRequestAttributes.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/knopp/experimental/wicket/src/main/java/org/apache/wicket/ajaxng/AjaxRequestAttributes.java?rev=689465&r1=689464&r2=689465&view=diff
==============================================================================
--- wicket/sandbox/knopp/experimental/wicket/src/main/java/org/apache/wicket/ajaxng/AjaxRequestAttributes.java (original)
+++ wicket/sandbox/knopp/experimental/wicket/src/main/java/org/apache/wicket/ajaxng/AjaxRequestAttributes.java Wed Aug 27 05:53:02 2008
@@ -24,6 +24,26 @@
/**
* Attributes for an Ajax Request.
*
+ * This class supports delegating the calls to another {@link AjaxRequestAttributes} instance if one
+ * is specified. To extend attributes from behavior or component the following pattern can be used:
+ *
+ * <pre>
+ * // add a precondition to super attirbutes
+ * class MyBehavior extends AjaxBehavior
+ * {
+ * public AjaxRequestAttributes getAttributes()
+ * {
+ * return new AjaxRequestAttributesImpl(super.getAttributes)
+ * {
+ * public FunctionList getPreconditions()
+ * {
+ * return super.getPreconditions().add("function(requestQueueItem) { return true; }";);
+ * }
+ * }
+ * }
+ * }
+ * </pre>
+ *
* <hr>
*
* <p>
@@ -56,27 +76,6 @@
*
* </dl>
*
- * This class supports delegating the calls to another {@link AjaxRequestAttributes} instance if one
- * is specified. To extend attributes from behavior or component the following pattern can be used:
- *
- * <pre>
- * // add a precondition to super attirbutes
- * class MyBehavior extends AjaxBehavior
- * {
- * public AjaxRequestAttributes getAttributes()
- * {
- * return new AjaxRequestAttributesImpl(super.getAttributes)
- * {
- * public FunctionList getPreconditions()
- * {
- * return super.getPreconditions().add("function(requestQueueItem) { return true; }";);
- * }
- * }
- * }
- * }
- * </pre>
- *
- *
* @author Matej Knopp
*/
public class AjaxRequestAttributes
@@ -296,6 +295,28 @@
* }
* </pre>
*
+ * Preconditions can also be asynchronous (with the rest of the queue waiting until precondition
+ * finishes). An example of asynchronous precondition:
+ *
+ * <pre>
+ * function(requestQueueItem, makeAsync, asyncReturn)
+ * {
+ * makeAsync(); // let the queue know that this precondition is asynchronous
+ * var f = function()
+ * {
+ * if (someCondition())
+ * {
+ * asyncReturn(true); // return the precondition value
+ * }
+ * else
+ * {
+ * asyncReturn(false); // return the precondition value
+ * }
+ * };
+ * window.setTimeout(f, 1000); // postpone the actual check 1000 millisecond. The queue will wait.
+ * }
+ * </pre>
+ *
* @return FunctionList or <code>null</code>
*/
public FunctionList getPreconditions()
@@ -491,6 +512,13 @@
*/
public boolean allowDefault()
{
- return false;
+ if (delegate != null)
+ {
+ return delegate.allowDefault();
+ }
+ else
+ {
+ return false;
+ }
}
}