Constructor and Description |
---|
Field(Form form,
java.lang.String key,
java.lang.String label,
Input<I> sel) |
Modifier and Type | Method and Description |
---|---|
void |
addValidator(FieldValidator<I> v)
Set an external validator for the field that augments the validation performed by the input.
|
boolean |
containsInput(java.lang.Class<? extends Input> c)
Does this field use a particular type of input
|
java.util.Map<java.lang.String,java.lang.String> |
getAttributes() |
Form |
getForm() |
Input<I> |
getInput()
get the Input to be used with this Field
|
java.lang.String |
getKey()
get the key associated with this field
|
java.lang.String |
getLabel()
get the label to be displayed with this field
|
java.lang.String |
getTooltip() |
I |
getValue()
get the current value associated with this Field
|
boolean |
isFixed()
If the current field value forced to particular value
The value of the field is updated to that value if it is forced.
|
boolean |
isLocked() |
boolean |
isOptional() |
void |
lock()
Convert the Input to an UnmodifiedInput
by wrapping it in a LockedInput
|
void |
removeValidator(FieldValidator<I> v) |
void |
setDataAttr(java.lang.String key,
java.lang.String value)
Add a custom attribute to the input
this is mapped to a data-key on the input
in html and can be used for custom JS validatipm
|
void |
setInput(Input<I> i) |
void |
setLabel(java.lang.String label)
set the label associated with this field
|
void |
setOptional(boolean optional) |
void |
setTooltip(java.lang.String tooltip) |
I |
setValue(java.lang.Object o)
set the value associated with this field
|
java.lang.String |
toString() |
void |
validate()
validate the contents of this field
|
public java.lang.String toString()
toString
in class java.lang.Object
public void setDataAttr(java.lang.String key, java.lang.String value)
key
- value
- public java.util.Map<java.lang.String,java.lang.String> getAttributes()
public void lock()
public boolean isLocked()
public boolean isFixed()
public boolean containsInput(java.lang.Class<? extends Input> c)
c
- Class of Input to be testedpublic java.lang.String getKey()
public java.lang.String getLabel()
public I getValue()
public void addValidator(FieldValidator<I> v)
Input
to perform additional validation. However
this can be useful for avoiding code duplication as a FieldValidator
is added by composition
and is preferable to a FormValidator
if the validation only involves a single field because
the errors will be associated wih that field.v
- FieldValidator to setpublic void removeValidator(FieldValidator<I> v)
public I setValue(java.lang.Object o)
o
- Value to setpublic void setLabel(java.lang.String label)
label
- Label to setpublic void validate() throws FieldException
FieldException
public java.lang.String getTooltip()
public void setTooltip(java.lang.String tooltip)
public Form getForm()
public boolean isOptional()
public void setOptional(boolean optional)