org.apache.wicket.protocol.http
Class AjaxEnclosureListener
java.lang.Object
org.apache.wicket.protocol.http.AjaxEnclosureListener
- All Implemented Interfaces:
- AjaxRequestTarget.IListener
public class AjaxEnclosureListener
- extends Object
- implements AjaxRequestTarget.IListener
This listener adds Enclosures to AjaxTarget, where the child controller of the said Enclosure is
already added. This is a part of the fix to the problem:
"Changing the visibility of a child component in Ajax callback method will not affect the entire
enclosure but just the child component itself. This is because only the child component is added
to the AjaxRequestTarget"
When used with an "Inline" Enclosure, this problem is fixed.
Syntax for inline enclosure:
In this example the tag used is tr, but any other tag could be used as well. The attribute
"wicket:enclosure" is mandatory, and is used to recognise an inline enclosure. The value of the
attribute, here "controllingChildId" can contain an id for the child (controller) element. If the
said value is not given, the first element inside the enclosure will be used as a controller
child. If there are no elements inside the enclosure, the parsing will fail.
- Author:
- Joonas Hamalainen
- See Also:
WebApplication
,
InlineEnclosure
,
InlineEnclosureHandler
,
EnclosureResolver
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AjaxEnclosureListener
public AjaxEnclosureListener()
onBeforeRespond
public void onBeforeRespond(Map<String,Component> map,
AjaxRequestTarget target)
- Try to find Enclosures that have their controllers added already, and add them to the target.
- Specified by:
onBeforeRespond
in interface AjaxRequestTarget.IListener
- Parameters:
map
- read-only map:markupId->component of components already added to the targettarget
- the target itself. Could be used to add components or to append/prepend
javascript
onAfterRespond
public void onAfterRespond(Map<String,Component> map,
AjaxRequestTarget.IJavascriptResponse response)
- Description copied from interface:
AjaxRequestTarget.IListener
- Triggered after ajax request target is done with its response cycle. At this point only
additional javascript can be output to the response using the provided
AjaxRequestTarget.IJavascriptResponse
object
NOTE: During this stage of processing any calls to target that manipulate the response
(adding components, javascript) will have no effect
- Specified by:
onAfterRespond
in interface AjaxRequestTarget.IListener
- Parameters:
map
- read-only map:markupId->component of components already added to the targetresponse
- response object that can be used to output javascript
Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.