Package 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: <tr wicket:enclosure="controllingChildId"> 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
-
-
Constructor Summary
Constructors Constructor Description AjaxEnclosureListener()
Construct.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
isControllerOfEnclosure(Component component, Enclosure enclosure)
Check if a given component is the controlling child of a given enclosurevoid
onBeforeRespond(Map<String,Component> map, AjaxRequestTarget target)
Try to find Enclosures that have their controllers added already, and add them to the target.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.wicket.ajax.AjaxRequestTarget.IListener
onAfterRespond, onAfterRespond, updateAjaxAttributes
-
-
-
-
Constructor Detail
-
AjaxEnclosureListener
public AjaxEnclosureListener()
Construct.
-
-
Method Detail
-
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 interfaceAjaxRequestTarget.IListener
- Parameters:
map
- modifiable map (markupId -> component) of components already added to the targettarget
- the target itself. Could be used to add components or to append/prepend JavaScript
-
isControllerOfEnclosure
public static boolean isControllerOfEnclosure(Component component, Enclosure enclosure)
Check if a given component is the controlling child of a given enclosure- Parameters:
component
-enclosure
-- Returns:
- true if the given component is the controlling child of the given InlineEnclosure
-
-