Class EventHandler
java.lang.Object
jakarta.faces.view.facelets.TagHandler
jakarta.faces.view.facelets.MetaTagHandler
jakarta.faces.view.facelets.DelegatingMetaTagHandler
jakarta.faces.view.facelets.ComponentHandler
org.apache.myfaces.tobago.facelets.TobagoComponentHandler
org.apache.myfaces.tobago.facelets.EventHandler
- All Implemented Interfaces:
- jakarta.faces.view.AttachedObjectHandler,- jakarta.faces.view.BehaviorHolderAttachedObjectHandler,- jakarta.faces.view.facelets.FaceletHandler
public class EventHandler
extends TobagoComponentHandler
implements jakarta.faces.view.BehaviorHolderAttachedObjectHandler
This tag creates an instance of AjaxBehavior, and associates it with the nearest
 parent UIComponent that implements ClientBehaviorHolder interface. This tag can
 be used on single or composite components.
 
Unless otherwise specified, all attributes accept static values or EL expressions.
According to the documentation, the tag handler implementing this tag should meet the following conditions:
- Since this tag attach objects to UIComponent instances, and those instances implements Behavior interface, this component should implement BehaviorHolderAttachedObjectHandler interface.
- f:ajax does not support binding property. In theory we should do something similar to f:convertDateTime tag does: extends from ConverterHandler and override setAttributes method, but in this case BehaviorTagHandlerDelegate has binding property defined, so if we extend from BehaviorHandler we add binding support to f:ajax.
- This tag works as a attached object handler, but note on the api there is no component to define a target for a behavior. See comment inside apply() method.
- Since:
- 3.0.0
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classWraps a method expression in a AjaxBehaviorListener
- 
Field SummaryFieldsFields inherited from class jakarta.faces.view.facelets.DelegatingMetaTagHandlerdelegateFactoryFields inherited from class jakarta.faces.view.facelets.TagHandlernextHandler, tag, tagId
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidapply(jakarta.faces.view.facelets.FaceletContext ctx, jakarta.faces.component.UIComponent parent) voidapplyAttachedObject(jakarta.faces.context.FacesContext context, jakarta.faces.component.UIComponent parent) This method should create an AjaxBehavior object and attach it to the parent component.protected EventBehaviorcreateBehavior(jakarta.faces.context.FacesContext context) ViewDeclarationLanguage.retargetAttachedObjects uses it to check if the the target to be processed is applicable for this handlergetFor()The documentation says this attribute should not be used since it is not taken into account.voidonComponentCreated(jakarta.faces.view.facelets.FaceletContext faceletContext, jakarta.faces.component.UIComponent component, jakarta.faces.component.UIComponent parent) Methods inherited from class org.apache.myfaces.tobago.facelets.TobagoComponentHandlercreateMetaRuleset, onComponentPopulatedMethods inherited from class jakarta.faces.view.facelets.ComponentHandlercreateComponent, getComponentConfig, getTagHandlerDelegate, isNewMethods inherited from class jakarta.faces.view.facelets.DelegatingMetaTagHandlerapplyNextHandler, getBinding, getTag, getTagAttribute, getTagId, isDisabled, setAttributesMethods inherited from class jakarta.faces.view.facelets.TagHandlergetAttribute, getRequiredAttribute, toString
- 
Field Details- 
AJAX_BEHAVIOR_LISTENER_SIG
 
- 
- 
Constructor Details- 
EventHandlerpublic EventHandler(jakarta.faces.view.facelets.ComponentConfig config) 
 
- 
- 
Method Details- 
applypublic void apply(jakarta.faces.view.facelets.FaceletContext ctx, jakarta.faces.component.UIComponent parent) throws IOException - Specified by:
- applyin interface- jakarta.faces.view.facelets.FaceletHandler
- Overrides:
- applyin class- jakarta.faces.view.facelets.DelegatingMetaTagHandler
- Throws:
- IOException
 
- 
getEventNameViewDeclarationLanguage.retargetAttachedObjects uses it to check if the the target to be processed is applicable for this handler- Specified by:
- getEventNamein interface- jakarta.faces.view.BehaviorHolderAttachedObjectHandler
 
- 
applyAttachedObjectpublic void applyAttachedObject(jakarta.faces.context.FacesContext context, jakarta.faces.component.UIComponent parent) This method should create an AjaxBehavior object and attach it to the parent component.Also, it should check if the parent can apply the selected AjaxBehavior to the selected component through ClientBehaviorHolder.getEventNames() or ClientBehaviorHolder.getDefaultEventName() - Specified by:
- applyAttachedObjectin interface- jakarta.faces.view.AttachedObjectHandler
 
- 
createBehavior
- 
onComponentCreatedpublic void onComponentCreated(jakarta.faces.view.facelets.FaceletContext faceletContext, jakarta.faces.component.UIComponent component, jakarta.faces.component.UIComponent parent) - Overrides:
- onComponentCreatedin class- jakarta.faces.view.facelets.ComponentHandler
 
- 
getForThe documentation says this attribute should not be used since it is not taken into account. Instead, getEventName is used on ViewDeclarationLanguage.retargetAttachedObjects.- Specified by:
- getForin interface- jakarta.faces.view.AttachedObjectHandler
 
 
-