public final class AjaxHandler extends TagHandlerImpl implements BehaviorHolderAttachedObjectHandler
Enable
one or more components in the view
to perform Ajax operations. This tag handler must create an instance
of AjaxBehavior
using the tag attribute
values.
events
attribute for
this tag that can be a ValueExpression
must be evaluated at tag
execution time since the event name is used in the process of Behavior
creation.ClientBehaviorHolder
component:
events
attribute value is not specified,
obtain the default event name by calling ClientBehaviorHolder.getDefaultEventName()
.
If that returns null
throw an exception
.events
attribute value is specified, ensure it
that it exists in the Collection
returned from a call to
ClientBehaviorHolder.getEventNames()
and throw an exception
if
it doesn't exist.AjaxBehavior
instance to the ClientBehaviorHolder
component by calling ClientBehaviorHolder.addClientBehavior(java.lang.String, javax.faces.component.behavior.ClientBehavior)
passing event
and the AjaxBehavior
instance.UIViewRoot.getComponentResources()
. If
the Ajax resource does not exist, create a UIOutput
component
instance and set the renderer type to javax.faces.resource.Script
.
Set the the following attributes in the component's attribute Map
:
library
with the value and
name
with the value . Install the component
resource using UIViewRoot.addComponentResource()
and specifying
head
as the target
argument.
If this tag has component children, add the AjaxBehavior
to
AjaxBehaviors
by calling AjaxBehaviors.pushBehavior(javax.faces.context.FacesContext, javax.faces.component.behavior.AjaxBehavior, java.lang.String)
. As
subsequent child components that implement the ClientBehaviorHolder
interface
are evaluated this AjaxBehavior
instance must be added as a behavior to
the component.
nextHandler, tag, tagId
Constructor and Description |
---|
AjaxHandler(TagConfig config) |
Modifier and Type | Method and Description |
---|---|
void |
apply(FaceletContext ctx,
UIComponent parent)
Process changes on a particular UIComponent |
void |
applyAttachedObject(FacesContext context,
UIComponent parent)
Take the argument
|
String |
getEventName()
Return the client event name to which this behavior applies. |
String |
getFor()
Return the value of the "for"
attribute specified by the page author on the tag for
this |
findNextByType, findNextByType
getAttribute, getRequiredAttribute, toString
public AjaxHandler(TagConfig config)
config
- public void apply(FaceletContext ctx, UIComponent parent) throws IOException
FaceletHandler
Process changes on a particular UIComponent
apply
in interface FaceletHandler
ctx
- the current FaceletContext instance for this executionparent
- the parent UIComponent to operate uponIOException
- if unable to load relativePath
public void applyAttachedObject(FacesContext context, UIComponent parent)
AttachedObjectHandler
Take the argument
parent
and apply this attached object to it. The
action taken varies with class that implements one of the
subinterfaces of this interface.
applyAttachedObject
in interface AttachedObjectHandler
context
- The FacesContext
for this requestparent
- The UIComponent
to which this
particular attached object must be applied.public String getFor()
AttachedObjectHandler
Return the value of the "for"
attribute specified by the page author on the tag for
this AttachedObjectHandler
.
getFor
in interface AttachedObjectHandler
public String getEventName()
BehaviorHolderAttachedObjectHandler
Return the client event name to which this behavior applies.
getEventName
in interface BehaviorHolderAttachedObjectHandler
Comments to: faces-dev@eclipse.org.
Copyright © 2019 Eclipse Foundation. All rights reserved.
Use is subject to license terms.