Repository: wicket
Updated Branches:
  refs/heads/wicket-6.x 76439c3b6 -> e4c1d939f


added a note about AjaxRequestTarget and AjaxRequestHandler


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/e4c1d939
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/e4c1d939
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/e4c1d939

Branch: refs/heads/wicket-6.x
Commit: e4c1d939fc3568292674c13530a82751937dcc71
Parents: 76439c3
Author: Andrea Del Bene <“[email protected]”>
Authored: Tue May 5 15:17:26 2015 +0200
Committer: Andrea Del Bene <“[email protected]”>
Committed: Tue May 5 15:20:01 2015 +0200

----------------------------------------------------------------------
 .../src/docs/guide/ajax/ajax_1.gdoc             | 32 ++++++++++++++++++++
 1 file changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/e4c1d939/wicket-user-guide/src/docs/guide/ajax/ajax_1.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/ajax/ajax_1.gdoc 
b/wicket-user-guide/src/docs/guide/ajax/ajax_1.gdoc
index 5f1ccf5..0ab54fd 100644
--- a/wicket-user-guide/src/docs/guide/ajax/ajax_1.gdoc
+++ b/wicket-user-guide/src/docs/guide/ajax/ajax_1.gdoc
@@ -62,3 +62,35 @@ Repeaters component that have 
@org.apache.wicket.markup.repeater.AbstractRepeate
 
 If we want to refresh their markup via AJAX we must add one of their parent 
containers to the @AjaxRequestTarget@.
 {warning}
+
+The standard implementation of @AjaxRequestTarget@ used by Wicket is class 
@org.apache.wicket.ajax.AjaxRequestHandler@. To create new instances of 
@AjaxRequestTarget@ a Wicket application uses the provider object registered 
with method @setAjaxRequestTargetProvider@:
+
+{code}
+setAjaxRequestTargetProvider(
+               IContextProvider<AjaxRequestTarget, Page> 
ajaxRequestTargetProvider)
+{code}
+
+The provider is an implementation of interface 
@org.apache.wicket.util.IContextProvider@, hence to use custom implementations 
of @AjaxRequestTarget@ we must register a custom provider that returns the 
desired implementation: 
+
+{code}
+private static class MyCustomAjaxRequestTargetProvider implements
+               IContextProvider<AjaxRequestTarget, Page>
+       {
+               @Override
+               public AjaxRequestTarget get(Page page)
+               {
+                       return new MyCustomAjaxRequestTarget();
+               }
+       }
+{code}
+
+{note}
+During request handling @AjaxRequestHandler@ sends an event to its application 
to notify the entire component hierarchy of the current page:
+
+{code}
+   //'page' is the associated Page instance
+   page.send(app, Broadcast.BREADTH, this);
+{code}
+
+The payload of the event is the @AjaxRequestHandler@ itself.
+{note}

Reply via email to