org.apache.myfaces.view.facelets.tag.jsf.core
Class AjaxHandler

java.lang.Object
  extended by javax.faces.view.facelets.TagHandler
      extended by org.apache.myfaces.view.facelets.tag.jsf.core.AjaxHandler
All Implemented Interfaces:
AttachedObjectHandler, BehaviorHolderAttachedObjectHandler, FaceletHandler

@JSFFaceletTag(name="f:ajax")
public class AjaxHandler
extends TagHandler
implements 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:

Version:
$Revision: 1177714 $ $Date: 2011-09-30 10:51:51 -0500 (Fri, 30 Sep 2011) $
Author:
Leonardo Uribe (latest modification by $Author: lu4242 $)

Nested Class Summary
static class AjaxHandler.AjaxBehaviorListenerImpl
          Wraps a method expression in a AjaxBehaviorListener
 
Field Summary
static Class<?>[] AJAX_BEHAVIOR_LISTENER_SIG
           
static String STANDARD_JSF_AJAX_LIBRARY_LOADED
          Constant used to check if in the current build view it has been rendered the standard jsf javascript library.
 
Fields inherited from class javax.faces.view.facelets.TagHandler
nextHandler, tag, tagId
 
Constructor Summary
AjaxHandler(TagConfig config)
           
 
Method Summary
 void apply(FaceletContext ctx, UIComponent parent)
           
 void applyAttachedObject(FacesContext context, UIComponent parent)
          This method should create an AjaxBehavior object and attach it to the parent component.
protected  AjaxBehavior createBehavior(FacesContext context)
           
 String getEventName()
          ViewDeclarationLanguage.retargetAttachedObjects uses it to check if the the target to be processed is applicable for this handler
 String getFor()
          The documentation says this attribute should not be used since it is not taken into account.
static void registerJsfAjaxDefaultResource(FaceletContext ctx, UIComponent parent)
           
 
Methods inherited from class javax.faces.view.facelets.TagHandler
getAttribute, getRequiredAttribute, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AJAX_BEHAVIOR_LISTENER_SIG

public static final Class<?>[] AJAX_BEHAVIOR_LISTENER_SIG

STANDARD_JSF_AJAX_LIBRARY_LOADED

public static final String STANDARD_JSF_AJAX_LIBRARY_LOADED
Constant used to check if in the current build view it has been rendered the standard jsf javascript library. It is necessary to remove this key from facesContext attribute map after build, to keep working this code for next views to be built.

See Also:
Constant Field Values
Constructor Detail

AjaxHandler

public AjaxHandler(TagConfig config)
Method Detail

apply

public void apply(FaceletContext ctx,
                  UIComponent parent)
           throws IOException
Specified by:
apply in interface FaceletHandler
Throws:
IOException

registerJsfAjaxDefaultResource

public static void registerJsfAjaxDefaultResource(FaceletContext ctx,
                                                  UIComponent parent)

getEventName

public String getEventName()
ViewDeclarationLanguage.retargetAttachedObjects uses it to check if the the target to be processed is applicable for this handler

Specified by:
getEventName in interface BehaviorHolderAttachedObjectHandler

applyAttachedObject

public void applyAttachedObject(FacesContext context,
                                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:
applyAttachedObject in interface AttachedObjectHandler

createBehavior

protected AjaxBehavior createBehavior(FacesContext context)

getFor

public String getFor()
The documentation says this attribute should not be used since it is not taken into account. Instead, getEventName is used on ViewDeclarationLanguage.retargetAttachedObjects.

Specified by:
getFor in interface AttachedObjectHandler


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.