javawebparts.ajaxparts.taglib
Class AjaxEnableTag

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
        |
        +--javawebparts.ajaxparts.taglib.AjaxEnableTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.IterationTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class AjaxEnableTag
extends javax.servlet.jsp.tagext.TagSupport

This class is a custom tag (AjaxEnableTag) that must be placed on a page AFTER all other Ajax-enabled tags. Its job is to render Javascript or external reference links for all the handlers required on the page. Each Ajax-enabled tag that fires will add its request, response and error handlers in PageContext. In this class we iterate over those collections and for each standard handler we render its code, or we render a link to the external .js file for custom handlers, if their location is not local.

Author:
Frank W. Zammetti
See Also:
Serialized Form

Field Summary
private  java.lang.String debug
          What level of debugging should be done?
private static org.apache.commons.logging.Log log
          Log instance.
private  java.lang.String logger
          What logger implementation to use.
private  boolean suppress
          Flag: When set to true, the JWPWindowLogger and AjaxPartsTaglib objects will NOT be rendered, only the applicable handlers, and the attach() calls, will be rendered.
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
AjaxEnableTag()
          Constructor.
 
Method Summary
private  java.lang.String createErrorRegisterCall(java.lang.String code, java.lang.String groupRef, java.lang.String elementRef, java.lang.String type, java.lang.String function)
          Create the registration call for the error handler.
private  java.lang.String createRegisterCall(AjaxHandlerConfig handler)
          Create the registration call for the handler.
 int doStartTag()
          Render the results of the tag.
 java.lang.String getDebug()
          Accessor for debug.
 java.lang.String getLogger()
          Accessor for logger.
 void setDebug(java.lang.String inDebug)
          Mutator for debug.
 void setLogger(java.lang.String inLogger)
          Mutator for logger.
 void setSuppress(boolean inSuppressFlag)
          Set the suppress flag of the tag.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log
Log instance.


suppress

private boolean suppress
Flag: When set to true, the JWPWindowLogger and AjaxPartsTaglib objects will NOT be rendered, only the applicable handlers, and the attach() calls, will be rendered. This is used when using the taglib on a JSP that is itself rendering a response for an AJAX call.


debug

private java.lang.String debug
What level of debugging should be done?


logger

private java.lang.String logger
What logger implementation to use.

Constructor Detail

AjaxEnableTag

public AjaxEnableTag()
Constructor.

Method Detail

setLogger

public void setLogger(java.lang.String inLogger)
Mutator for logger.

Parameters:
inLogger - New value for logger.

getLogger

public java.lang.String getLogger()
Accessor for logger.

Returns:
Value of logger.

setDebug

public void setDebug(java.lang.String inDebug)
Mutator for debug.

Parameters:
inDebug - New value for debug.

getDebug

public java.lang.String getDebug()
Accessor for debug.

Returns:
Value of debug.

setSuppress

public void setSuppress(boolean inSuppressFlag)
Set the suppress flag of the tag.

Parameters:
inSuppressFlag - suppress flag of the tag

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Render the results of the tag.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.TagSupport
Returns:
Return code.
Throws:
javax.servlet.jsp.JspException - If anything goes wrong

createRegisterCall

private java.lang.String createRegisterCall(AjaxHandlerConfig handler)
Create the registration call for the handler.

Parameters:
handler - the handler configuration.
Returns:
String the Call string.

createErrorRegisterCall

private java.lang.String createErrorRegisterCall(java.lang.String code,
                                                 java.lang.String groupRef,
                                                 java.lang.String elementRef,
                                                 java.lang.String type,
                                                 java.lang.String function)
Create the registration call for the error handler.

Parameters:
code - the error code.
groupRef - the group reference.
elementRef - the element reference.
type - the type of event.
function - the error function.
Returns:
String the Call string.


Copyright © 2005 Frank W. Zammetti