org.makumba.forms.html
Class FieldEditor

java.lang.Object
  extended by org.makumba.commons.formatters.FieldFormatter
      extended by org.makumba.forms.html.FieldEditor
Direct Known Subclasses:
binaryEditor, charEditor, choiceEditor, dateEditor, errorEditor, textEditor

public class FieldEditor
extends FieldFormatter


Field Summary
static String ERROR_NO_BOOLEAN
           
static String ERROR_NO_INT
           
static String ERROR_NO_REAL
           
static String extraFormattingParam
           
(package private) static String formName
           
(package private) static String[] params
           
(package private) static String[][] paramValues
           
(package private) static String suffixName
           
 
Constructor Summary
protected FieldEditor()
          Don't use this, use getInstance()
 
Method Summary
 void checkParam(RecordFormatter rf, int fieldIndex, String name, String val)
           
 String format(RecordFormatter rf, int fieldIndex, Object o, Dictionary<String,Object> formatParams)
          Format the object to pure text.
 String formatHidden(RecordFormatter rf, int fieldIndex, Object o, Dictionary<String,Object> formatParams)
           
 String formatHiddenValue(RecordFormatter rf, int fieldIndex, Object o, Dictionary<String,Object> formatParams)
          Formats the value to appear in hidden input statement.
 String formatShow(RecordFormatter rf, int fieldIndex, Object o, Dictionary<String,Object> formatParams)
           
 String formatValue(RecordFormatter rf, int fieldIndex, Object o, Dictionary<String,Object> formatParams)
          Formats the value to appear in an input statement.
 String[] getAcceptedParams()
           
 String[][] getAcceptedValue()
           
static String getExtraFormatting(RecordFormatter rf, int fieldIndex, Dictionary<String,Object> formatParams)
           
static String getInputID(RecordFormatter rf, int fieldIndex, Dictionary<String,Object> formatParams)
           
static String getInputName(RecordFormatter rf, int fieldIndex, Dictionary<String,Object> formatParams)
           
static String getInputName(RecordFormatter rf, int fieldIndex, String suffix)
           
static FieldFormatter getInstance()
           
static String getSuffix(RecordFormatter rf, int fieldIndex, Dictionary<String,Object> formatParams)
           
 void onStartup(RecordFormatter rf, int fieldIndex)
           
 Object readFrom(RecordFormatter rf, int fieldIndex, HttpParameters p, String suffix)
          Reads, converts and validates the value present in the HttpParameters, for the FieldEditor indicated by the given index.
 Object readFrom(RecordFormatter rf, int fieldIndex, HttpParameters p, String suffix, boolean allowMultipleValues)
          As readFrom(RecordFormatter, int, HttpParameters, String), but if indicated, then allowing multiple values of the type, which might be needed e.g. for certain types/editors in search forms.
static void setExtraFormatting(Dictionary<String,Object> formatParams, String extraFormatting)
           
static void setFormName(Dictionary<String,Object> formatParams, String formName)
           
static void setSuffix(Dictionary<String,Object> formatParams, String suffix)
           
protected  Integer toInt(RecordFormatter rf, int fieldIndex, Object o)
           
protected  Double toReal(RecordFormatter rf, int fieldIndex, Object o)
           
 
Methods inherited from class org.makumba.commons.formatters.FieldFormatter
checkParams, equals, formatNotNull, formatNull, getDefaultValueFormat, getEmptyValueFormat, getExpr, getIntParam, getIntParamString, initExpr, resetValueFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_NO_INT

public static final String ERROR_NO_INT
See Also:
Constant Field Values

ERROR_NO_BOOLEAN

public static final String ERROR_NO_BOOLEAN
See Also:
Constant Field Values

ERROR_NO_REAL

public static final String ERROR_NO_REAL
See Also:
Constant Field Values

params

static String[] params

paramValues

static String[][] paramValues

suffixName

static final String suffixName
See Also:
Constant Field Values

formName

static final String formName
See Also:
Constant Field Values

extraFormattingParam

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

FieldEditor

protected FieldEditor()
Don't use this, use getInstance()

Method Detail

getInstance

public static FieldFormatter getInstance()

getAcceptedParams

public String[] getAcceptedParams()
Overrides:
getAcceptedParams in class FieldFormatter

getAcceptedValue

public String[][] getAcceptedValue()
Overrides:
getAcceptedValue in class FieldFormatter

getSuffix

public static String getSuffix(RecordFormatter rf,
                               int fieldIndex,
                               Dictionary<String,Object> formatParams)

setSuffix

public static void setSuffix(Dictionary<String,Object> formatParams,
                             String suffix)

setFormName

public static void setFormName(Dictionary<String,Object> formatParams,
                               String formName)

checkParam

public void checkParam(RecordFormatter rf,
                       int fieldIndex,
                       String name,
                       String val)
Overrides:
checkParam in class FieldFormatter

format

public String format(RecordFormatter rf,
                     int fieldIndex,
                     Object o,
                     Dictionary<String,Object> formatParams)
Description copied from class: FieldFormatter
Format the object to pure text. If text-format is blank, try the "empty" replacer value.

Overrides:
format in class FieldFormatter
Parameters:
rf - TODO
fieldIndex - TODO

formatShow

public String formatShow(RecordFormatter rf,
                         int fieldIndex,
                         Object o,
                         Dictionary<String,Object> formatParams)

formatHidden

public String formatHidden(RecordFormatter rf,
                           int fieldIndex,
                           Object o,
                           Dictionary<String,Object> formatParams)

formatHiddenValue

public String formatHiddenValue(RecordFormatter rf,
                                int fieldIndex,
                                Object o,
                                Dictionary<String,Object> formatParams)
Formats the value to appear in hidden input statement.


formatValue

public String formatValue(RecordFormatter rf,
                          int fieldIndex,
                          Object o,
                          Dictionary<String,Object> formatParams)
Formats the value to appear in an input statement.


onStartup

public void onStartup(RecordFormatter rf,
                      int fieldIndex)

getInputName

public static String getInputName(RecordFormatter rf,
                                  int fieldIndex,
                                  Dictionary<String,Object> formatParams)

getInputName

public static String getInputName(RecordFormatter rf,
                                  int fieldIndex,
                                  String suffix)

getInputID

public static String getInputID(RecordFormatter rf,
                                int fieldIndex,
                                Dictionary<String,Object> formatParams)

getExtraFormatting

public static String getExtraFormatting(RecordFormatter rf,
                                        int fieldIndex,
                                        Dictionary<String,Object> formatParams)

setExtraFormatting

public static void setExtraFormatting(Dictionary<String,Object> formatParams,
                                      String extraFormatting)

readFrom

public Object readFrom(RecordFormatter rf,
                       int fieldIndex,
                       HttpParameters p,
                       String suffix,
                       boolean allowMultipleValues)
As readFrom(RecordFormatter, int, HttpParameters, String), but if indicated, then allowing multiple values of the type, which might be needed e.g. for certain types/editors in search forms.
This is a default implementation that ignores the relaxedValidityCheck parameter and simply calls readFrom(RecordFormatter, int, HttpParameters, String); subclasses should thus override this method if they want to allow multiple values.


readFrom

public Object readFrom(RecordFormatter rf,
                       int fieldIndex,
                       HttpParameters p,
                       String suffix)
Reads, converts and validates the value present in the HttpParameters, for the FieldEditor indicated by the given index.


toInt

protected Integer toInt(RecordFormatter rf,
                        int fieldIndex,
                        Object o)

toReal

protected Double toReal(RecordFormatter rf,
                        int fieldIndex,
                        Object o)