|
||||||||||
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 java.lang.String |
CURRENCY_CODE_ATTRIBUTE
|
static java.lang.String |
FILE_DATA_COLUMN_ATTRIBUTE
|
protected static org.slf4j.Logger |
log
|
static java.lang.String |
MAXVALUE_ATTRIBUTE
|
static java.lang.String |
MINVALUE_ATTRIBUTE
|
static java.lang.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 java.lang.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 java.lang.String |
NUMBER_FORMAT_ATTRIBUTE
|
static java.lang.String |
NUMBER_FRACTION_DIGITS
|
static java.lang.String |
NUMBER_GROUPSEP_ATTRIBUTE
|
Constructor Summary | |
---|---|
InputControl()
|
Method Summary | |
---|---|
protected InputControl.FieldValueError |
error(ErrorType errorType,
java.lang.Object msgParam,
java.lang.String value)
|
protected InputControl.FieldValueError |
error(ErrorType errorType,
java.lang.String[] msgParams,
java.lang.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 java.lang.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 java.lang.String |
formatValue(java.lang.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 |
java.lang.Object |
getFieldValue(java.lang.String name,
RequestParamProvider request,
java.util.Locale locale,
Column column)
this method parses and validates the value of a particular column from the request |
protected java.lang.String |
getFormatOption(InputControl.ValueInfo vi,
java.lang.String option)
|
protected boolean |
hasFormatOption(InputControl.ValueInfo vi,
java.lang.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 java.lang.Object |
parseValue(java.lang.String value,
java.util.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,
java.lang.String text,
java.lang.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 java.lang.Object |
validate(java.lang.Object value,
java.util.Locale locale,
Column column,
java.lang.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 java.lang.String NUMBER_FORMAT_ATTRIBUTE
public static final java.lang.String NUMBER_GROUPSEP_ATTRIBUTE
public static final java.lang.String NUMBER_FRACTION_DIGITS
public static final java.lang.String MINVALUE_ATTRIBUTE
public static final java.lang.String MAXVALUE_ATTRIBUTE
public static final java.lang.String CURRENCY_CODE_ATTRIBUTE
public static final java.lang.String FILE_DATA_COLUMN_ATTRIBUTE
public static final java.lang.Object NO_VALUE
public static final java.lang.Object NULL_VALUE
Constructor Detail |
---|
public InputControl()
Method Detail |
---|
protected final InputControl.FieldValueError error(ErrorType errorType, java.lang.String[] msgParams, java.lang.String value)
protected final InputControl.FieldValueError error(ErrorType errorType, java.lang.Object msgParam, java.lang.String value)
public boolean useLabelId()
public java.lang.Object getFieldValue(java.lang.String name, RequestParamProvider request, java.util.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, java.lang.String text, java.lang.String defaultValue)
writer
- the HtmlWriter for html write-outtext
- the text to writeprotected java.lang.Object parseValue(java.lang.String value, java.util.Locale locale, Column column)
value
- the value string from the requestlocale
- the user localecolumn
- the column for which the value is supplied
protected java.lang.Object validate(java.lang.Object value, java.util.Locale locale, Column column, java.lang.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 java.lang.String formatValue(java.lang.Object value, InputControl.ValueInfo vi, boolean hasError)
value
- the value to be formattedvi
- Meta-information about the value
protected final java.lang.String formatValue(InputControl.ValueInfo vi)
protected boolean hasFormatOption(InputControl.ValueInfo vi, java.lang.String option)
vi
- the value infooption
- the formating option to check
protected java.lang.String getFormatOption(InputControl.ValueInfo vi, java.lang.String option)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |