org.makumba.forms.tags
Class FormTagBase

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.makumba.analyser.AnalysableTag
          extended by org.makumba.commons.tags.GenericMakumbaTag
              extended by org.makumba.forms.tags.FormTagBase
All Implemented Interfaces:
Serializable, BodyTag, IterationTag, JspTag, Tag
Direct Known Subclasses:
AddTag, EditTag, NewTag, SearchTag

public class FormTagBase
extends GenericMakumbaTag
implements BodyTag

mak:form base tag

Version:
$Id: FormTagBase.java 3688 2009-02-04 19:44:21Z rosso_nero $
Author:
Cristian Bogdan, Rudolf Mayer
See Also:
Serialized Form

Field Summary
static String __MAKUMBA__FORM__COUNTER__
           
(package private)  String afterHandler
           
(package private)  String annotation
           
(package private)  String annotationSeparator
           
 String baseObject
           
(package private)  String basePointer
           
(package private)  BodyContent bodyContent
           
protected  DataDefinitionProvider ddp
           
protected  FormDataProvider fdp
           
 String formAction
           
(package private)  String formMessage
           
(package private)  String formMethod
           
(package private)  String formName
           
(package private)  String handler
           
(package private)  HashMap<String,String> lazyEvaluatedInputs
          Names of the forms in the page, needed for nested forms that depend on each other, e.g. two nested new forms, where one wants to store the result of the new operation of the other.
(package private)  Boolean reloadFormOnError
           
(package private)  FormResponder responder
           
(package private)  long starttime
           
 
Fields inherited from class org.makumba.commons.tags.GenericMakumbaTag
extraFormatting, extraFormattingParams, NEEDED_RESOURCES, params
 
Fields inherited from class org.makumba.analyser.AnalysableTag
analyzedTag, ATTRIBUTE_VALUES_TRUE_FALSE, runningTag, tagData, tagKey, TYPES
 
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
FormTagBase()
           
 
Method Summary
(package private)  void checkNoParent(String attrName)
          Generates an error message if this form has no parent form (and hence can't have the given attribute)
protected  void doAnalyzedCleanup()
          Called by doEndTag in its finally block.
 int doAnalyzedEndTag(PageCache pageCache)
          Lets the responder write the pre- and postamble for the form, and writes the bodyContent inside.
 int doAnalyzedStartTag(PageCache pageCache)
          Sets the responder elements, computes the base pointer if needed
 void doEndAnalyze(PageCache pageCache)
          End the analysis of the tag, after all tags in the page were visited.
 void doInitBody()
           
 void doStartAnalyze(PageCache pageCache)
          Starts the analysis of the tag, without knowing what tags follow it in the page.
 FormTagBase findParentForm()
          Finds the parent form
(package private)  FormTagBase findRootForm()
          Finds the root form
 DataDefinition getDataTypeAtAnalysis(PageCache pageCache)
          The basic data type inside the form. null for generic forms
 String getDefaultExpr(String fieldName)
          The default expression for an input tag, if none is indicated
 Object getFormIdentifier()
           
 HashMap<String,MultipleKey> getNestedFormNames(PageCache pageCache)
           
(package private)  String getOperation()
          Gets the name of the operation of the tag based on its class name
 ResponderOperation getResponderOperation(String operation)
          Gives the operation associated with this form tag.
 void initialiseState()
          Resets and initialises the tag's state, to work in a tag pool.
 void setAction(String s)
           
 void setAfterHandler(String s)
           
 void setAnnotation(String s)
           
 void setAnnotationSeparator(String s)
           
 void setBodyContent(BodyContent bc)
           
 void setClientSideValidation(String clientSideValidation)
           
 void setHandler(String s)
           
 void setMessage(String s)
           
 void setMethod(String s)
           
 void setMultipart()
           
 void setName(String s)
           
 void setObject(String s)
           
 void setOnReset(String s)
           
 void setOnSubmit(String s)
           
 void setReloadFormOnError(String s)
           
 void setTagKey(PageCache pageCache)
          Sets tagKey to uniquely identify this tag.
 void setTarget(String s)
           
 boolean shouldComputeBasePointer()
          Indicates whether the base pointer should be computed or not
 
Methods inherited from class org.makumba.commons.tags.GenericMakumbaTag
doStartTag, getParams, setAddTitle, setCols, setConvertLinks, setDefault, setElementSeparator, setEllipsis, setEllipsisLength, setEmpty, setFormat, setHtml, setLabelSeparator, setLineSeparator, setLongLineLength, setMaxlength, setMaxLength, setOnClick, setOnDblClick, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setRows, setSize, setStyle, setStyleClass, setStyleId, setTitle, setType, setType, setUrlEncode, toString
 
Methods inherited from class org.makumba.analyser.AnalysableTag
addTagText, allowsIdenticalKey, canHaveBody, checkValidAttributeValues, doEndTag, getAnalyzedTag, getCurrentBodyTag, getPageCache, getPageContext, getPageTextInfo, getRunningTag, getTagKey, getTagText, getThreadTagStack, initializeThread, needPageCache, onlyInt, setTagDataAtAnalysis
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, 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, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.IterationTag
doAfterBody
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
doEndTag, doStartTag, getParent, release, setPageContext, setParent
 

Field Detail

baseObject

public String baseObject

handler

String handler

afterHandler

String afterHandler

formMethod

String formMethod

formAction

public String formAction

formName

String formName

formMessage

String formMessage

responder

FormResponder responder

starttime

long starttime

basePointer

String basePointer

bodyContent

BodyContent bodyContent

annotation

String annotation

annotationSeparator

String annotationSeparator

reloadFormOnError

Boolean reloadFormOnError

fdp

protected FormDataProvider fdp

ddp

protected DataDefinitionProvider ddp

lazyEvaluatedInputs

HashMap<String,String> lazyEvaluatedInputs
Names of the forms in the page, needed for nested forms that depend on each other, e.g. two nested new forms, where one wants to store the result of the new operation of the other.


__MAKUMBA__FORM__COUNTER__

public static final String __MAKUMBA__FORM__COUNTER__
See Also:
Constant Field Values
Constructor Detail

FormTagBase

public FormTagBase()
Method Detail

setBodyContent

public void setBodyContent(BodyContent bc)
Specified by:
setBodyContent in interface BodyTag

doInitBody

public void doInitBody()
Specified by:
doInitBody in interface BodyTag

setObject

public void setObject(String s)

setAction

public void setAction(String s)

setHandler

public void setHandler(String s)

setAfterHandler

public void setAfterHandler(String s)

setMethod

public void setMethod(String s)

setName

public void setName(String s)

setMessage

public void setMessage(String s)

setMultipart

public void setMultipart()

setTarget

public void setTarget(String s)

setOnReset

public void setOnReset(String s)

setOnSubmit

public void setOnSubmit(String s)

setClientSideValidation

public void setClientSideValidation(String clientSideValidation)

setAnnotation

public void setAnnotation(String s)

setAnnotationSeparator

public void setAnnotationSeparator(String s)

setReloadFormOnError

public void setReloadFormOnError(String s)

getOperation

String getOperation()
Gets the name of the operation of the tag based on its class name

Returns:
The name of the operation: Edit, Input, ...

shouldComputeBasePointer

public boolean shouldComputeBasePointer()
Indicates whether the base pointer should be computed or not

Returns:
false if we are at runtime (i.e. the baseObject has been set by JSP), true if we are at analysis time

setTagKey

public void setTagKey(PageCache pageCache)
Sets tagKey to uniquely identify this tag. Called at analysis time before doStartAnalyze() and at runtime before doMakumbaStartTag()

Overrides:
setTagKey in class AnalysableTag
Parameters:
pageCache - the page cache of the current page
See Also:
AnalysableTag.doAnalyzedStartTag(org.makumba.analyser.PageCache), AnalysableTag.doStartAnalyze(org.makumba.analyser.PageCache)

doStartAnalyze

public void doStartAnalyze(PageCache pageCache)
Starts the analysis of the tag, without knowing what tags follow it in the page. Typically this method will allocate initial data structures, that are then completed at doEndAnalyze() FIXME QueryExecutionProvider should tell us the syntax for the primary key name

Overrides:
doStartAnalyze in class AnalysableTag
Parameters:
pageCache - The page cache for the current page

findParentForm

public FormTagBase findParentForm()
Finds the parent form

Returns:
The parent form class of this tag

findRootForm

FormTagBase findRootForm()
Finds the root form

Returns:
The root form, in case of multiple nested forms

checkNoParent

void checkNoParent(String attrName)
Generates an error message if this form has no parent form (and hence can't have the given attribute)

Parameters:
attrName - the name of the attribute that shouldn't be used
Throws:
ProgrammerError

doEndAnalyze

public void doEndAnalyze(PageCache pageCache)
End the analysis of the tag, after all tags in the page were visited.

Overrides:
doEndAnalyze in class AnalysableTag
Parameters:
pageCache - The page cache for the current page

initialiseState

public void initialiseState()
Resets and initialises the tag's state, to work in a tag pool. See bug 583. If this method is overriden in a child class, the child's method must call super.initaliseState().

Overrides:
initialiseState in class GenericMakumbaTag

doAnalyzedStartTag

public int doAnalyzedStartTag(PageCache pageCache)
                       throws JspException,
                              LogicException
Sets the responder elements, computes the base pointer if needed

Overrides:
doAnalyzedStartTag in class AnalysableTag
Parameters:
pageCache - the page cache of the current page
Throws:
JspException
LogicException
See Also:
AnalysableTag.doStartTag()

doAnalyzedEndTag

public int doAnalyzedEndTag(PageCache pageCache)
                     throws JspException
Lets the responder write the pre- and postamble for the form, and writes the bodyContent inside. Resets all the variables.

Overrides:
doAnalyzedEndTag in class AnalysableTag
Parameters:
pageCache - the page cache of the current page
Throws:
JspException
See Also:
AnalysableTag.doEndTag()

getDefaultExpr

public String getDefaultExpr(String fieldName)
The default expression for an input tag, if none is indicated


getDataTypeAtAnalysis

public DataDefinition getDataTypeAtAnalysis(PageCache pageCache)
The basic data type inside the form. null for generic forms


getResponderOperation

public ResponderOperation getResponderOperation(String operation)
Gives the operation associated with this form tag. Each tag should implement its own

Parameters:
operation - name of the operation
Returns:
a ResponderOperation object holding the operation information

doAnalyzedCleanup

protected void doAnalyzedCleanup()
Description copied from class: AnalysableTag
Called by doEndTag in its finally block. Use it to clean references that will not be used next time the servlet container uses the tag object.

Overrides:
doAnalyzedCleanup in class GenericMakumbaTag

getNestedFormNames

public HashMap<String,MultipleKey> getNestedFormNames(PageCache pageCache)

getFormIdentifier

public Object getFormIdentifier()