com.sun.faces.facelets.tag.jsf.core
public final class AjaxHandler extends TagHandlerImpl implements javax.faces.view.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. If this tag is nested within a single
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 javax.faces
and
name
with the value jsf.js
. 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.
Modifier and Type | Field and Description |
---|---|
private javax.faces.view.facelets.TagAttribute |
disabled |
private javax.faces.view.facelets.TagAttribute |
event |
private javax.faces.view.facelets.TagAttribute |
execute |
private javax.faces.view.facelets.TagAttribute |
immediate |
private javax.faces.view.facelets.TagAttribute |
listener |
private javax.faces.view.facelets.TagAttribute |
onerror |
private javax.faces.view.facelets.TagAttribute |
onevent |
private javax.faces.view.facelets.TagAttribute |
render |
private boolean |
wrapping |
Constructor and Description |
---|
AjaxHandler(javax.faces.view.facelets.TagConfig config) |
Modifier and Type | Method and Description |
---|---|
void |
apply(javax.faces.view.facelets.FaceletContext ctx,
javax.faces.component.UIComponent parent) |
private void |
applyAttachedObject(javax.faces.view.facelets.FaceletContext ctx,
javax.faces.component.UIComponent parent,
java.lang.String eventName)
|
void |
applyAttachedObject(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent parent) |
private void |
applyNested(javax.faces.view.facelets.FaceletContext ctx,
javax.faces.component.UIComponent parent,
java.lang.String eventName) |
private void |
applyWrapping(javax.faces.view.facelets.FaceletContext ctx,
javax.faces.component.UIComponent parent,
java.lang.String eventName) |
private javax.faces.component.behavior.AjaxBehavior |
createAjaxBehavior(javax.faces.view.facelets.FaceletContext ctx,
java.lang.String eventName) |
java.lang.String |
getEventName() |
java.lang.String |
getFor() |
private java.lang.String |
getUnsupportedEventMessage(java.lang.String eventName,
java.util.Collection<java.lang.String> eventNames,
javax.faces.component.UIComponent parent) |
private void |
installAjaxResourceIfNecessary() |
private boolean |
isWrapping() |
private void |
setBehaviorAttribute(javax.faces.view.facelets.FaceletContext ctx,
javax.faces.component.behavior.AjaxBehavior behavior,
javax.faces.view.facelets.TagAttribute attr,
java.lang.Class type) |
findNextByType, findNextByType
private final javax.faces.view.facelets.TagAttribute event
private final javax.faces.view.facelets.TagAttribute execute
private final javax.faces.view.facelets.TagAttribute render
private final javax.faces.view.facelets.TagAttribute onevent
private final javax.faces.view.facelets.TagAttribute onerror
private final javax.faces.view.facelets.TagAttribute disabled
private final javax.faces.view.facelets.TagAttribute immediate
private final javax.faces.view.facelets.TagAttribute listener
private final boolean wrapping
public AjaxHandler(javax.faces.view.facelets.TagConfig config)
config
- public void apply(javax.faces.view.facelets.FaceletContext ctx, javax.faces.component.UIComponent parent) throws java.io.IOException
apply
in interface javax.faces.view.facelets.FaceletHandler
java.io.IOException
public void applyAttachedObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent parent)
applyAttachedObject
in interface javax.faces.view.AttachedObjectHandler
public java.lang.String getFor()
getFor
in interface javax.faces.view.AttachedObjectHandler
public java.lang.String getEventName()
getEventName
in interface javax.faces.view.BehaviorHolderAttachedObjectHandler
private boolean isWrapping()
private void applyWrapping(javax.faces.view.facelets.FaceletContext ctx, javax.faces.component.UIComponent parent, java.lang.String eventName) throws java.io.IOException
java.io.IOException
private void applyNested(javax.faces.view.facelets.FaceletContext ctx, javax.faces.component.UIComponent parent, java.lang.String eventName)
private void applyAttachedObject(javax.faces.view.facelets.FaceletContext ctx, javax.faces.component.UIComponent parent, java.lang.String eventName)
ctx
- parent
- eventName
- private javax.faces.component.behavior.AjaxBehavior createAjaxBehavior(javax.faces.view.facelets.FaceletContext ctx, java.lang.String eventName)
private void setBehaviorAttribute(javax.faces.view.facelets.FaceletContext ctx, javax.faces.component.behavior.AjaxBehavior behavior, javax.faces.view.facelets.TagAttribute attr, java.lang.Class type)
private void installAjaxResourceIfNecessary()
private java.lang.String getUnsupportedEventMessage(java.lang.String eventName, java.util.Collection<java.lang.String> eventNames, javax.faces.component.UIComponent parent)
Copyright © 2002-2010 Oracle America, Inc. All Rights Reserved.