org.dbforms.taglib
Class DbFilterConditionTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.dbforms.taglib.AbstractScriptHandlerTag
              extended by org.dbforms.taglib.DbFilterConditionTag
All Implemented Interfaces:
Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.TryCatchFinally

public class DbFilterConditionTag
extends AbstractScriptHandlerTag
implements javax.servlet.jsp.tagext.TryCatchFinally

Holds an sql condition that has to be nested inside a DbFilterTag. A condition is specified as sql code in the body of the tag. The character ? is a placeholder for user's input substitution. Every char ? found in sql code is replaced with value evalutated from corresponding filterValue tag nested. So there must be as ? as filterValue tags.

Version:
$Revision: 1.25 $
Author:
Sergio Moretti
See Also:
Serialized Form

Nested Class Summary
protected static class DbFilterConditionTag.State
          tag's state holder.
 
Field Summary
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
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
DbFilterConditionTag()
           
 
Method Summary
protected  int addValue(DbFilterValueTag value)
          add a value to the value's list. called from nested DbFilterValueTag objs.
 int doAfterBody()
          read filterCondition from body
 void doFinally()
          reset tag state
 int doStartTag()
          initialize environment and process body only if this condition is the currently selected.
 boolean equals(Object obj)
          comparison using conditionId field
protected  String getConditionName()
          condition prefix for request parameters
protected static String getConditionName(int tableId, int conditionId)
          condition prefix for request parameter
 String getLabel()
          DOCUMENT ME!
protected static String getSqlFilter(HttpServletRequest request, int tableId, int conditionId)
          generate condition from request.
protected static FieldValue[] getSqlFilterParams(HttpServletRequest request, int tableId, int conditionId)
          generate condition from request.
protected  DbFilterConditionTag.State getState()
          DOCUMENT ME!
 int hashCode()
          DOCUMENT ME!
protected  StringBuffer render()
          render output, called from parent DbFilterCondition obj.
 void setLabel(String string)
          DOCUMENT ME!
protected  void setState(javax.servlet.jsp.PageContext pg, DbFilterTag parent, DbFilterConditionTag.State state)
          DOCUMENT ME!
 
Methods inherited from class org.dbforms.taglib.AbstractScriptHandlerTag
doCatch, getAccessKey, getConfig, getOnBlur, getOnChange, getOnClick, getOnDblClick, getOnFocus, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getOnSelect, getStyle, getStyleClass, getTabIndex, getTitle, prepareEventHandlers, prepareStyles, setAccessKey, setOnBlur, setOnChange, setOnClick, setOnDblClick, setOnFocus, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setOnSelect, setStyle, setStyleClass, setTabIndex, setTitle
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doEndTag, doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.TryCatchFinally
doCatch
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Constructor Detail

DbFilterConditionTag

public DbFilterConditionTag()
Method Detail

setLabel

public void setLabel(String string)
DOCUMENT ME!

Parameters:
string -

getLabel

public String getLabel()
DOCUMENT ME!

Returns:

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspException
read filterCondition from body

Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Overrides:
doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException
See Also:
IterationTag.doAfterBody()

doFinally

public void doFinally()
reset tag state

Specified by:
doFinally in interface javax.servlet.jsp.tagext.TryCatchFinally
Overrides:
doFinally in class AbstractScriptHandlerTag
See Also:
TryCatchFinally.doFinally()

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
initialize environment and process body only if this condition is the currently selected.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException
See Also:
Tag.doStartTag()

equals

public boolean equals(Object obj)
comparison using conditionId field

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
DOCUMENT ME!

Overrides:
hashCode in class Object
Returns:
DOCUMENT ME!

getConditionName

protected static String getConditionName(int tableId,
                                         int conditionId)
condition prefix for request parameter

Parameters:
tableId -
conditionId -
Returns:

getSqlFilter

protected static String getSqlFilter(HttpServletRequest request,
                                     int tableId,
                                     int conditionId)
generate condition from request. Called from nested DbFilterTag object

Parameters:
request -
tableId -
conditionId -
Returns:
string containing sql condition code

getSqlFilterParams

protected static FieldValue[] getSqlFilterParams(HttpServletRequest request,
                                                 int tableId,
                                                 int conditionId)
generate condition from request. Called from nested DbFilterTag object

Parameters:
request -
tableId -
conditionId -
Returns:
string containing sql condition code

getConditionName

protected String getConditionName()
condition prefix for request parameters

Returns:

setState

protected void setState(javax.servlet.jsp.PageContext pg,
                        DbFilterTag parent,
                        DbFilterConditionTag.State state)
DOCUMENT ME!

Parameters:
pg - DOCUMENT ME!
parent - DOCUMENT ME!
state -

getState

protected DbFilterConditionTag.State getState()
DOCUMENT ME!

Returns:

addValue

protected int addValue(DbFilterValueTag value)
add a value to the value's list. called from nested DbFilterValueTag objs.

Parameters:
value -
Returns:
index of the newly added object

render

protected StringBuffer render()
                       throws javax.servlet.jsp.JspException
render output, called from parent DbFilterCondition obj.

Returns:
string containing html code for this obj
Throws:
javax.servlet.jsp.JspException


Copyright © 2002-2006 DbForms. All Rights Reserved.