public class Form extends java.lang.Object implements AForm, IClearableMessageSet
IForm implementation.FormRef in this cases.| Constructor and Description |
|---|
Form() |
Form(IFieldFactory fieldsFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
addValidator(IFormValidator l) |
void |
addValidator(IFormValidator l,
boolean checkFieldNames) |
void |
binded(int id)
The form has been binded, do any required initialization.
|
<T extends IField> |
bindField(java.lang.Class<T> type,
java.lang.String id)
If the form has an
IFieldFactory, then if the requested field
has not been registered yet, then a new one is created and registered. |
void |
clearMessages()
Removes all messages with
IMessage.getAutoRemoveIndicator() setted. |
boolean |
containsValidator(IFormValidator l) |
boolean |
equals(java.lang.Object obj) |
IAction |
getAction(java.lang.String id) |
java.util.Set<java.lang.String> |
getActions() |
<T> AFormField<T> |
getBindedField(java.lang.Class<T> type,
java.lang.String id) |
AFormField<?> |
getBindedField(java.lang.String id)
This method is not intended to be called before
IForm.bindField(Class, String). |
java.util.Set<java.lang.String> |
getBindedFields()
This method is not intended to be called before
IForm.binded(int). |
IFieldContraints |
getContraintsFor(java.lang.String fieldId) |
<T> AFormField<T> |
getField(java.lang.Class<T> type,
java.lang.String id) |
AFormField<?> |
getField(java.lang.String id) |
java.util.Set<java.lang.String> |
getFields() |
IFieldFactory |
getFieldsFactory() |
java.lang.String |
getLabel(java.lang.String id)
This method can be called before binding the field.
|
IMessage |
getMessage() |
IMessage |
getMessage(java.lang.Enum<?> sc) |
IMessage[] |
getMessages() |
java.util.Map<java.lang.Enum<?>,IMessage> |
getMessagesMap() |
StrokeStripe |
getStrokes() |
int |
hashCode() |
boolean |
hasMessage() |
boolean |
hasMessage(MessageTypeEnum type) |
boolean |
hasValidationMessages(MessageTypeEnum type) |
boolean |
isEnabled()
If disabled then actions are also disabled.
|
boolean |
isReadOnly()
In a read only form, actions are enabled but input fields are not.
|
boolean |
isShadow()
All fields in a shadow form act as shadow fields, see
AFormField.setShadow(boolean). |
boolean |
isShadow(java.lang.String fieldId)
Let the form control the single field shadow state.
|
Form |
registerAction(java.lang.String id,
IAction action)
Used to add actions to the current form.
|
Form |
registerField(java.lang.String id,
AFormField<?> field) |
IAction |
removeAction(java.lang.String id) |
void |
removeAllValidators() |
AFormField<?> |
removeField(java.lang.String id) |
boolean |
removeValidator(IFormValidator l) |
Form |
replaceAction(java.lang.String id,
IAction action) |
void |
setMessage(java.lang.Enum<?> sc,
IMessage message) |
boolean |
validate(java.lang.String fieldId,
java.lang.String... otherFieldsToValidate)
The default implementation uses
#validateImpl(String).An isShadow() does not trigger any validation and returns always true. |
public Form()
public Form(IFieldFactory fieldsFactory)
fieldsFactory - - fields created by the factory must also implement
the AFormField interface.public final IFieldFactory getFieldsFactory()
public Form registerAction(java.lang.String id, IAction action)
IFormregisterAction in interface IFormregisterAction in interface AFormid - - the action id to be added.action - - the IAction handler.public Form replaceAction(java.lang.String id, IAction action)
replaceAction in interface IFormreplaceAction in interface AFormpublic IAction removeAction(java.lang.String id)
removeAction in interface IFormremoveAction in interface AFormpublic Form registerField(java.lang.String id, AFormField<?> field)
public AFormField<?> removeField(java.lang.String id)
id - public void binded(int id)
IFormIForm.bindField(Class, String) call.binded in interface IFormbinded in interface AFormid - - since it can be called more than once, as you can have the IForm
form shared between different IFlow (if the implementation support it),
this id can be used to track this situation, it changes when a new cycle of bind
begins.public <T extends IField> T bindField(java.lang.Class<T> type, java.lang.String id)
IFieldFactory, then if the requested field
has not been registered yet, then a new one is created and registered.public IAction getAction(java.lang.String id)
public java.util.Set<java.lang.String> getActions()
getActions in interface IFormgetActions in interface AFormpublic StrokeStripe getStrokes()
getStrokes in interface IFormgetStrokes in interface AFormStrokeStripe for the form.public java.lang.String getLabel(java.lang.String id)
IFormpublic AFormField<?> getBindedField(java.lang.String id)
IFormIForm.bindField(Class, String).getBindedField in interface IFormgetBindedField in interface AFormgetBindedField in interface IFormViewIField binded to the given id.public final <T> AFormField<T> getBindedField(java.lang.Class<T> type, java.lang.String id)
getBindedField in interface AFormgetBindedField in interface IFormViewpublic java.util.Set<java.lang.String> getBindedFields()
IFormIForm.binded(int).getBindedFields in interface IFormgetBindedFields in interface AFormgetBindedFields in interface IFormViewpublic AFormField<?> getField(java.lang.String id)
public final <T> AFormField<T> getField(java.lang.Class<T> type, java.lang.String id)
public IFieldContraints getContraintsFor(java.lang.String fieldId)
getContraintsFor in interface AFormgetContraintsFor in interface IFormViewpublic java.util.Set<java.lang.String> getFields()
public boolean isEnabled()
IFormpublic boolean isReadOnly()
IFormisReadOnly in interface IFormisReadOnly in interface AFormisReadOnly in interface IFormViewpublic boolean isShadow()
AFormField.setShadow(boolean).public boolean isShadow(java.lang.String fieldId)
fieldId - - the field idpublic boolean validate(java.lang.String fieldId,
java.lang.String... otherFieldsToValidate)
#validateImpl(String).isShadow() does not trigger any validation and returns always true.validate in interface IFormvalidate in interface AFormfieldId - - the changed field or null to validate the whole form.otherFieldsToValidate - - possible other fields that must be validated.public final IMessage getMessage()
getMessage in interface IMessageSetgetMessage in interface AFormpublic final IMessage getMessage(java.lang.Enum<?> sc)
getMessage in interface IMessageSetgetMessage in interface AFormpublic final IMessage[] getMessages()
getMessages in interface IMessageSetgetMessages in interface AFormpublic final java.util.Map<java.lang.Enum<?>,IMessage> getMessagesMap()
getMessagesMap in interface IMessageSetgetMessagesMap in interface AFormIMessageSet.getMessage().public final boolean hasMessage()
hasMessage in interface IMessageSethasMessage in interface AFormpublic final boolean hasMessage(MessageTypeEnum type)
hasMessage in interface IMessageSethasMessage in interface AFormMessageTypeEnum type or severe is found.public final void setMessage(java.lang.Enum<?> sc,
IMessage message)
setMessage in interface IMessageSetsetMessage in interface AFormsc - - the owner of the message.message - - null to remove the message for the given IMessageToken.public final void clearMessages()
IClearableMessageSetIMessage.getAutoRemoveIndicator() setted.clearMessages in interface IClearableMessageSetpublic boolean hasValidationMessages(MessageTypeEnum type)
type - MessageTypeEnum type.public void addValidator(IFormValidator l)
public void addValidator(IFormValidator l, boolean checkFieldNames)
l - checkFieldNames - - If true fields required by the validator, see
IFormValidator.getFieldNames(), are checked for existence.IFieldFactory.public boolean removeValidator(IFormValidator l)
public boolean containsValidator(IFormValidator l)
public void removeAllValidators()
public final int hashCode()
hashCode in class java.lang.Objectpublic final boolean equals(java.lang.Object obj)
equals in class java.lang.Object