org.makumba.list
Class ListFormDataProvider

java.lang.Object
  extended by org.makumba.list.ListFormDataProvider
All Implemented Interfaces:
FormDataProvider

public class ListFormDataProvider
extends Object
implements FormDataProvider

Native implementation of the FormDataProvider by the list. We pass on an AnalysableTag to all our methods in order to provide context to the method, so it knows what kind of data to compute. In addition we also pass some other parameters useful for data computation.

Version:
$Id: ListFormDataProvider.java,v 1.1 18.09.2007 18:31:07 Manuel Exp $
Author:
Manuel Gay

Constructor Summary
ListFormDataProvider()
           
 
Method Summary
 String computeBasePointer(MultipleKey tagKey, PageContext pageContext)
           
 DataDefinition getBasePointerType(AnalysableTag tag, PageCache pageCache, String baseObject)
          Gives the type corresponding to the base object of a tag, based on its name
 FieldDefinition getInputTypeAtAnalysis(AnalysableTag tag, DataDefinition dd, String fieldName, PageCache pageCache)
          Gets the type of an input tag
static ListFormDataProvider getInstance()
           
 MultipleKey getParentListKey(AnalysableTag tag)
           
 FieldDefinition getTypeOnEndAnalyze(MultipleKey tagKey, PageCache pageCache)
          Computes the type of the field based on the information collected at analysis.
 Object getValue(MultipleKey tagKey, PageContext pageContext, PageCache pageCache)
          Returns the value of the currently running tag, for Input and Option tags.
 FieldDefinition onBasicValueEndAnalyze(MultipleKey tagKey, PageCache pageCache)
          Computes data at the end of BasicValueTag analysis (InputTag, OptionTag)
 void onBasicValueStartAnalyze(AnalysableTag tag, boolean isNull, MultipleKey parentFormKey, PageCache pageCache, String ptrExpr)
          Computes data at the beginning of BasicValueTag analysis (InputTag, OptionTag)
 void onFormEndAnalyze(MultipleKey tagKey, PageCache pageCache)
          Computes data at the end of form analysis.
 void onFormEndTag(MultipleKey tagKey, PageCache pageCache, PageContext pageContext)
           
 void onFormStartAnalyze(AnalysableTag tag, PageCache pageCache, String ptrExpr)
          Computes data at the beginning of form analysis.
 void onFormStartTag(MultipleKey tagKey, PageCache pageCache, PageContext pageContext)
          Computes data at the beginning of form runtime.
 void onNonQueryStartAnalyze(AnalysableTag tag, boolean isNull, MultipleKey parentFormKey, PageCache pageCache, String expr)
          Computes data for analysis start in case of tags which aren't wrapped in a query context (of the kind mak:list).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListFormDataProvider

public ListFormDataProvider()
Method Detail

onFormStartAnalyze

public void onFormStartAnalyze(AnalysableTag tag,
                               PageCache pageCache,
                               String ptrExpr)
Description copied from interface: FormDataProvider
Computes data at the beginning of form analysis.

Specified by:
onFormStartAnalyze in interface FormDataProvider
Parameters:
tag - the AnalysableTag for whom we do this
pageCache - the pageCache of the current page
ptrExpr - the base pointer expression

onBasicValueStartAnalyze

public void onBasicValueStartAnalyze(AnalysableTag tag,
                                     boolean isNull,
                                     MultipleKey parentFormKey,
                                     PageCache pageCache,
                                     String ptrExpr)
Description copied from interface: FormDataProvider
Computes data at the beginning of BasicValueTag analysis (InputTag, OptionTag)

Specified by:
onBasicValueStartAnalyze in interface FormDataProvider
Parameters:
tag - the AnalysableTag for whom we do this
pageCache - the pageCache of the current page
ptrExpr - the expression of the base pointer

onNonQueryStartAnalyze

public void onNonQueryStartAnalyze(AnalysableTag tag,
                                   boolean isNull,
                                   MultipleKey parentFormKey,
                                   PageCache pageCache,
                                   String expr)
Description copied from interface: FormDataProvider
Computes data for analysis start in case of tags which aren't wrapped in a query context (of the kind mak:list). This is the case of InputTag and OptionTag in particular contexts (e.g. a newForm, which does not depend itself on data but where these tags need to fetch e.g. set values from a specific location).

Specified by:
onNonQueryStartAnalyze in interface FormDataProvider

onFormEndAnalyze

public void onFormEndAnalyze(MultipleKey tagKey,
                             PageCache pageCache)
Description copied from interface: FormDataProvider
Computes data at the end of form analysis.

Specified by:
onFormEndAnalyze in interface FormDataProvider
pageCache - the pageCache of the current page

onBasicValueEndAnalyze

public FieldDefinition onBasicValueEndAnalyze(MultipleKey tagKey,
                                              PageCache pageCache)
Description copied from interface: FormDataProvider
Computes data at the end of BasicValueTag analysis (InputTag, OptionTag)

Specified by:
onBasicValueEndAnalyze in interface FormDataProvider
pageCache - the pageCache of the current page
Returns:
the FieldDefinition corresponding to the object the tag is based on

onFormStartTag

public void onFormStartTag(MultipleKey tagKey,
                           PageCache pageCache,
                           PageContext pageContext)
                    throws LogicException
Description copied from interface: FormDataProvider
Computes data at the beginning of form runtime.

Specified by:
onFormStartTag in interface FormDataProvider
pageCache - the pageCache of the current page
pageContext - the pageContext in which the form is
Throws:
LogicException

onFormEndTag

public void onFormEndTag(MultipleKey tagKey,
                         PageCache pageCache,
                         PageContext pageContext)
Specified by:
onFormEndTag in interface FormDataProvider

getTypeOnEndAnalyze

public FieldDefinition getTypeOnEndAnalyze(MultipleKey tagKey,
                                           PageCache pageCache)
Description copied from interface: FormDataProvider
Computes the type of the field based on the information collected at analysis.

Specified by:
getTypeOnEndAnalyze in interface FormDataProvider
pageCache - the pageCache of the current page
Returns:
a FieldDefinition indicating the type of what we are interested in

getBasePointerType

public DataDefinition getBasePointerType(AnalysableTag tag,
                                         PageCache pageCache,
                                         String baseObject)
Description copied from interface: FormDataProvider
Gives the type corresponding to the base object of a tag, based on its name

Specified by:
getBasePointerType in interface FormDataProvider
Parameters:
tag - the tag for which we need to discover the tag
pageCache - the page cache of the current page
baseObject - the label of the object we want to discover
Returns:
the DataDefinition corresponding to the type of the object

computeBasePointer

public String computeBasePointer(MultipleKey tagKey,
                                 PageContext pageContext)
                          throws LogicException
Specified by:
computeBasePointer in interface FormDataProvider
Throws:
LogicException

getValue

public Object getValue(MultipleKey tagKey,
                       PageContext pageContext,
                       PageCache pageCache)
                throws LogicException
Description copied from interface: FormDataProvider
Returns the value of the currently running tag, for Input and Option tags.

Specified by:
getValue in interface FormDataProvider
pageCache - the pageCache of the current page
Returns:
the value corresponding to the tag.
Throws:
LogicException

getInputTypeAtAnalysis

public FieldDefinition getInputTypeAtAnalysis(AnalysableTag tag,
                                              DataDefinition dd,
                                              String fieldName,
                                              PageCache pageCache)
Description copied from interface: FormDataProvider
Gets the type of an input tag

Specified by:
getInputTypeAtAnalysis in interface FormDataProvider
Parameters:
tag - TODO
fieldName - the name of the field of which the type should be returned
pageCache - the page cache of the current page
Returns:
A FieldDefinition corresponding to the type of the input field

getParentListKey

public MultipleKey getParentListKey(AnalysableTag tag)
Specified by:
getParentListKey in interface FormDataProvider

getInstance

public static ListFormDataProvider getInstance()