Class EventHandler
java.lang.Object
org.apache.myfaces.tobago.facelets.TobagoComponentHandler
org.apache.myfaces.tobago.facelets.EventHandler
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 Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classWraps a method expression in a AjaxBehaviorListener -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier 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.voidapplyNextHandler(jakarta.faces.view.facelets.FaceletContext arg0, jakarta.faces.component.UIComponent arg1) protected EventBehaviorcreateBehavior(jakarta.faces.context.FacesContext context) jakarta.faces.component.UIComponentcreateComponent(jakarta.faces.view.facelets.FaceletContext arg0) protected final jakarta.faces.view.facelets.TagAttributegetAttribute(String arg0) jakarta.faces.view.facelets.TagAttributejakarta.faces.view.facelets.ComponentConfigViewDeclarationLanguage.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.protected final jakarta.faces.view.facelets.TagAttributegetRequiredAttribute(String arg0) jakarta.faces.view.facelets.TaggetTag()jakarta.faces.view.facelets.TagAttributegetTagAttribute(String arg0) protected jakarta.faces.view.facelets.TagHandlerDelegategetTagId()booleanisDisabled(jakarta.faces.view.facelets.FaceletContext arg0) static booleanisNew(jakarta.faces.component.UIComponent arg0) voidonComponentCreated(jakarta.faces.view.facelets.FaceletContext faceletContext, jakarta.faces.component.UIComponent component, jakarta.faces.component.UIComponent parent) voidsetAttributes(jakarta.faces.view.facelets.FaceletContext arg0, Object arg1) toString()Methods inherited from class TobagoComponentHandler
createMetaRuleset, onComponentPopulated
-
Field Details
-
AJAX_BEHAVIOR_LISTENER_SIG
-
delegateFactory
protected jakarta.faces.view.facelets.TagHandlerDelegateFactory delegateFactory -
tagId
-
tag
protected final jakarta.faces.view.facelets.Tag tag -
nextHandler
protected final jakarta.faces.view.facelets.FaceletHandler nextHandler
-
-
Constructor Details
-
EventHandler
public EventHandler(jakarta.faces.view.facelets.ComponentConfig config)
-
-
Method Details
-
apply
public void apply(jakarta.faces.view.facelets.FaceletContext ctx, jakarta.faces.component.UIComponent parent) throws IOException - Throws:
IOException
-
getEventName
ViewDeclarationLanguage.retargetAttachedObjects uses it to check if the the target to be processed is applicable for this handler -
applyAttachedObject
public 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()
-
createBehavior
-
onComponentCreated
public void onComponentCreated(jakarta.faces.view.facelets.FaceletContext faceletContext, jakarta.faces.component.UIComponent component, jakarta.faces.component.UIComponent parent) -
getFor
The documentation says this attribute should not be used since it is not taken into account. Instead, getEventName is used on ViewDeclarationLanguage.retargetAttachedObjects. -
getComponentConfig
public jakarta.faces.view.facelets.ComponentConfig getComponentConfig() -
isNew
public static boolean isNew(jakarta.faces.component.UIComponent arg0) -
getTagHandlerDelegate
protected jakarta.faces.view.facelets.TagHandlerDelegate getTagHandlerDelegate() -
createComponent
public jakarta.faces.component.UIComponent createComponent(jakarta.faces.view.facelets.FaceletContext arg0) -
applyNextHandler
public void applyNextHandler(jakarta.faces.view.facelets.FaceletContext arg0, jakarta.faces.component.UIComponent arg1) throws IOException, jakarta.faces.FacesException, jakarta.el.ELException - Throws:
IOExceptionjakarta.faces.FacesExceptionjakarta.el.ELException
-
getBinding
public jakarta.faces.view.facelets.TagAttribute getBinding() -
getTag
public jakarta.faces.view.facelets.Tag getTag() -
getTagAttribute
-
getTagId
-
isDisabled
public boolean isDisabled(jakarta.faces.view.facelets.FaceletContext arg0) -
setAttributes
-
getAttribute
-
getRequiredAttribute
protected final jakarta.faces.view.facelets.TagAttribute getRequiredAttribute(String arg0) throws jakarta.faces.view.facelets.TagException - Throws:
jakarta.faces.view.facelets.TagException
-
toString
-