org.makumba.forms.tags
Class FormTagBase

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.makumba.analyser.AnalysableElement
          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
Provides generic methods for makumba forms and is itself an implementation of the generic mak:form

Version:
$Id: FormTagBase.java 5153 2010-05-18 21:37:50Z rosso_nero $
Author:
Cristian Bogdan, Rudolf Mayer, Manuel Gay
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.makumba.analyser.AnalysableElement
AnalysableElement.FilePositionElementComparator
 
Field Summary
static String __MAKUMBA__FORM__COUNTER__
           
(package private)  String afterHandler
           
(package private)  String annotation
           
(package private)  String annotationSeparator
           
 String baseObject
          the tag attributes
(package private)  String basePointer
           
(package private)  BodyContent bodyContent
           
protected  DataDefinitionProvider ddp
           
protected  FormDataProvider fdp
           
protected  String field
           
 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.
protected  String multipleSubmitErrorMsg
           
protected  String operation
           
(package private)  Boolean reloadFormOnError
           
(package private)  FormResponder responder
          derived tag data
(package private)  long starttime
           
protected  String styleId
           
protected  String triggerEvent
           
protected  DataDefinition type
           
 
Fields inherited from class org.makumba.commons.tags.GenericMakumbaTag
extraFormatting, extraFormattingParams, NEEDED_RESOURCES, params
 
Fields inherited from class org.makumba.analyser.AnalysableTag
ATTRIBUTE_VALUES_TRUE_FALSE, tagData, tagKey, TYPES
 
Fields inherited from class org.makumba.analyser.AnalysableElement
ANALYSIS_STATE
 
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
protected  boolean allowEmptyBody()
           
(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)
          FIXME QueryExecutionProvider should tell us the syntax for the primary key name
 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
 String getFormIdentifier()
          the HTML ID of the form
 Object getFormSuffixIdentifier()
          the suffix of the form identifier, used to uniquely identify the form on the page
 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.
protected  String getSubmitJavascriptCall(String event, boolean ajax)
          builds the javascript call necessary to submit a form via partial post-back
 void initialiseState()
          Resets and initialises the tag's state, to work in a tag pool.
protected  void registerPossibleAttributeValues()
          Override this in order to register possible attribute values using AnalysableTag.registerAttributeValues(String, String...).
 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 setField(String s)
           
 void setHandler(String s)
           
 void setMessage(String s)
           
 void setMethod(String s)
           
 void setMultipart()
           
 void setMultipleSubmitErrorMsg(String s)
           
 void setName(String s)
           
 void setObject(String s)
           
 void setOnReset(String s)
           
 void setOnSubmit(String s)
           
 void setOperation(String o)
           
 void setReloadFormOnError(String s)
           
 void setStyleId(String s)
           
 void setTagKey(PageCache pageCache)
          Sets tagKey to uniquely identify this tag.
 void setTarget(String s)
          additional html attributes:
 void setTriggerEvent(String e)
           
 void setType(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, isAttribute, setAddTitle, setCols, 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, setTitle, setType, setUrlEncode, toString
 
Methods inherited from class org.makumba.analyser.AnalysableTag
addTagText, allowsIdenticalKey, canHaveBody, checkAttributeValues, doEndTag, getElementData, getPageContext, getPageTextInfo, getTagKey, getTagText, needPageCache, notEmpty, onlyInt, registerAttributeValues, setTagDataAtAnalysis
 
Methods inherited from class org.makumba.analyser.AnalysableElement
checkTagFound, discardJSPParsingData, getAnalyzedElementData, getCurrentBodyTagData, getElementAfter, getElementBefore, getPageCache, getPageCache, getRunningElementData, getTagByAttribute, getTagById, getThreadElementStack, initializeThread, keepAnalysisState, setAnalyzedElementData, setRunningElementData
 
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

__MAKUMBA__FORM__COUNTER__

public static final String __MAKUMBA__FORM__COUNTER__
See Also:
Constant Field Values

baseObject

public String baseObject
the tag attributes


handler

String handler

afterHandler

String afterHandler

formMethod

String formMethod

formAction

public String formAction

formName

String formName

formMessage

String formMessage

annotation

String annotation

annotationSeparator

String annotationSeparator

multipleSubmitErrorMsg

protected String multipleSubmitErrorMsg

field

protected String field

operation

protected String operation

triggerEvent

protected String triggerEvent

styleId

protected String styleId

bodyContent

BodyContent bodyContent

responder

FormResponder responder
derived tag data


type

protected DataDefinition type

basePointer

String basePointer

reloadFormOnError

Boolean reloadFormOnError

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.


starttime

long starttime

fdp

protected FormDataProvider fdp

ddp

protected DataDefinitionProvider ddp
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

allowEmptyBody

protected boolean allowEmptyBody()

setObject

public void setObject(String s)

setStyleId

public void setStyleId(String s)
Overrides:
setStyleId in class GenericMakumbaTag

setType

public void setType(String s)
Overrides:
setType in class GenericMakumbaTag

setField

public void setField(String s)

setOperation

public void setOperation(String o)

setTriggerEvent

public void setTriggerEvent(String e)

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)
additional html attributes:


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)

setMultipleSubmitErrorMsg

public void setMultipleSubmitErrorMsg(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)
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

doEndAnalyze

public void doEndAnalyze(PageCache pageCache)
Description copied from class: AnalysableTag
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

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

initialiseState

public void initialiseState()
Description copied from class: GenericMakumbaTag
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

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

registerPossibleAttributeValues

protected void registerPossibleAttributeValues()
Description copied from class: AnalysableTag
Override this in order to register possible attribute values using AnalysableTag.registerAttributeValues(String, String...). The registered attributes are checked before AnalysableTag.doStartAnalyze(PageCache) and throw a ProgrammerError is thrown if the provided value is not allowed.

Overrides:
registerPossibleAttributeValues in class AnalysableTag

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()

getSubmitJavascriptCall

protected String getSubmitJavascriptCall(String event,
                                         boolean ajax)
builds the javascript call necessary to submit a form via partial post-back


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

getNestedFormNames

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

getFormIdentifier

public String getFormIdentifier()
the HTML ID of the form


getFormSuffixIdentifier

public Object getFormSuffixIdentifier()
the suffix of the form identifier, used to uniquely identify the form on the page