|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.empire.struts2.jsp.controls.InputControl
public abstract class InputControl
Nested Class Summary | |
---|---|
static interface |
InputControl.ControlInfo
This interface extends the value information by information about the input control used with the renderInput function |
static class |
InputControl.FieldValueError
This class wraps a parsing or validation error. |
static interface |
InputControl.ValueInfo
This interface allows access to a value and its metainformation used with the renderData function |
Field Summary | |
---|---|
static String |
CURRENCY_CODE_ATTRIBUTE
|
static String |
FILE_DATA_COLUMN_ATTRIBUTE
|
protected static org.slf4j.Logger |
log
|
static String |
MAXVALUE_ATTRIBUTE
|
static String |
MINVALUE_ATTRIBUTE
|
static Object |
NO_VALUE
The NO_VALUE constant is used as a return value from getFieldValue to indicate that the value for this column has not been provided |
static Object |
NULL_VALUE
The NULL_VALUE constant is used as a return value from getFieldValue to indicate that the field value was provided with the request, but is empty so that the underlying database field should be set to null |
static String |
NUMBER_FORMAT_ATTRIBUTE
|
static String |
NUMBER_FRACTION_DIGITS
|
static String |
NUMBER_GROUPSEP_ATTRIBUTE
|
Constructor Summary | |
---|---|
InputControl()
|
Method Summary | |
---|---|
protected InputControl.FieldValueError |
error(ErrorType errorType,
Object msgParam,
String value)
|
protected InputControl.FieldValueError |
error(ErrorType errorType,
String[] msgParams,
String value)
This method can be used to return a parsing or validation error To be used in the getFieldValue, the parseValue or the validate function. |
protected String |
formatValue(InputControl.ValueInfo vi)
Returns the value formated as a string This is a shortcut for formatString(vi.getValue(), vi) Derived classes may override formatString |
protected String |
formatValue(Object value,
InputControl.ValueInfo vi,
boolean hasError)
Returns the value formated as a string this is a simple default implementation that does no type-secific formatting Derived classes may override formatString an provide further formmatting see TextInputControl for details |
Object |
getFieldValue(String name,
RequestParamProvider request,
Locale locale,
Column column)
this method parses and validates the value of a particular column from the request |
protected String |
getFormatOption(InputControl.ValueInfo vi,
String option)
|
protected boolean |
hasFormatOption(InputControl.ValueInfo vi,
String option)
checks if a particular formating option has been specified. |
protected void |
internalRenderText(HtmlWriter writer,
InputControl.ValueInfo vi)
this method renders a record value read only it is internally called by renderText |
protected Object |
parseValue(String value,
Locale locale,
Column column)
this function may be overridden to parse and convert the input value to the data type of the supplied column |
protected void |
printText(HtmlWriter writer,
String text,
String defaultValue)
writes out plain text to the output stream if the text supplied is null or an empty String then a is written |
abstract void |
renderInput(HtmlWriter writer,
InputControl.ControlInfo ci)
this method renders a record value for input |
void |
renderText(HtmlWriter writer,
InputControl.ValueInfo vi)
this method renders a record value read only this can be either in a read only form or a table |
boolean |
useLabelId()
This method determines whether an id should be put on the input label If true than the renderInput function must add an id attribute to an input field The value of the id is supplied with the ControlInfo |
protected Object |
validate(Object value,
Locale locale,
Column column,
String s)
this function may be overridden to validate a value that has previously been parsed |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static org.slf4j.Logger log
public static final String NUMBER_FORMAT_ATTRIBUTE
public static final String NUMBER_GROUPSEP_ATTRIBUTE
public static final String NUMBER_FRACTION_DIGITS
public static final String MINVALUE_ATTRIBUTE
public static final String MAXVALUE_ATTRIBUTE
public static final String CURRENCY_CODE_ATTRIBUTE
public static final String FILE_DATA_COLUMN_ATTRIBUTE
public static final Object NO_VALUE
public static final Object NULL_VALUE
Constructor Detail |
---|
public InputControl()
Method Detail |
---|
protected final InputControl.FieldValueError error(ErrorType errorType, String[] msgParams, String value)
protected final InputControl.FieldValueError error(ErrorType errorType, Object msgParam, String value)
public boolean useLabelId()
public Object getFieldValue(String name, RequestParamProvider request, Locale locale, Column column)
name
- the name under which the param is stored on the requestrequest
- used to access the request Parameterscolumn
- the column for which the value should be
public void renderText(HtmlWriter writer, InputControl.ValueInfo vi)
writer
- the HtmlWriter for html write-outvi
- Object holding the value and meta-information about the valuepublic abstract void renderInput(HtmlWriter writer, InputControl.ControlInfo ci)
writer
- the HtmlWriter for html write-outci
- Object holding the value and meta-information about the value and the controlprotected void internalRenderText(HtmlWriter writer, InputControl.ValueInfo vi)
writer
- the HtmlWriter for html write-outvi
- Object holding the value and meta-information about the valueprotected final void printText(HtmlWriter writer, String text, String defaultValue)
writer
- the HtmlWriter for html write-outtext
- the text to writeprotected Object parseValue(String value, Locale locale, Column column)
value
- the value string from the requestlocale
- the user localecolumn
- the column for which the value is supplied
protected Object validate(Object value, Locale locale, Column column, String s)
value
- the parsed object valuecolumn
- the column for which the value should be validateds
- the unparsed value string. In case of an error this should be forwarded to the error function.
protected String formatValue(Object value, InputControl.ValueInfo vi, boolean hasError)
value
- the value to be formattedvi
- Meta-information about the value
protected final String formatValue(InputControl.ValueInfo vi)
protected boolean hasFormatOption(InputControl.ValueInfo vi, String option)
vi
- the value infooption
- the formating option to check
protected String getFormatOption(InputControl.ValueInfo vi, String option)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |