Package com.storedobject.vaadin
Class AbstractDataEditor.DForm
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.Component>
com.storedobject.vaadin.AbstractForm<T>
com.storedobject.vaadin.ObjectForm<T>
com.storedobject.vaadin.AbstractDataEditor.DForm
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.component.HasStyle
,Serializable
- Enclosing class:
AbstractDataEditor<T>
Form to be used internally.
- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.storedobject.vaadin.AbstractForm
AbstractForm.ValueHandler
-
Field Summary
Fields inherited from class com.storedobject.vaadin.AbstractForm
container, data, objectClass, objectData
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.vaadin.flow.component.HasValue
<?, ?> createField
(String fieldName, Class<?> fieldType, String label) Create the field for the particular name.protected T
Create an instance of the data object.protected void
customizeField
(String fieldName, com.vaadin.flow.component.HasValue<?, ?> field) Customize a field.protected void
Generate field names.protected Method
getFieldGetMethod
(String fieldName) Get the field's "get" method.protected int
getFieldOrder
(String fieldName) Get the order in which a field to appear in the form.protected Method
getFieldSetMethod
(String fieldName, Method getMethod) Get the field's "set" method.protected boolean
handleValueSetError
(String fieldName, com.vaadin.flow.component.HasValue<?, ?> field, Object fieldValue, Object objectValue, Throwable error) Handle errors while setting (committing) values.protected boolean
includeField
(String fieldName) Check whether field should be included in the form or not.Methods inherited from class com.storedobject.vaadin.ObjectForm
addField, addField, addField, addField, addField, addField, addField, addField, constructed, createField, getDataClass, getFieldNames, getLabel, getObjectClass, isFieldIncluded, setFieldCustomizer, setMethodHandlerHost
Methods inherited from class com.storedobject.vaadin.AbstractForm
add, addField, addField, addFields, addIncludeFieldChecker, addValidator, addValidator, attachField, clearError, clearErrors, clearFields, commit, connect, connect, connect, createContainer, createField, detachField, dumpValues, getBinder, getColumns, getColumnSpan, getComponent, getContainer, getContent, getErrorDisplay, getField, getFieldLabel, getFieldLabel, getFieldName, getObject, getObject, getView, initContent, isFieldEditable, isFieldEditable, isFieldVisible, isFieldVisible, isReadOnly, load, markError, newLine, remove, removeAll, removeField, removeField, removeField, setColumns, setColumnSpan, setErrorDisplay, setFieldLabel, setFieldLabel, setIncludeFieldChecker, setObject, setObject, setReadOnly, setRequired, setRequired, setRequired, setRequired, setRequired, setRequired, setRequired, setRequired, setView, streamFieldNamesCreated, streamFieldsCreated
Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getElement
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
DForm
-
-
Method Details
-
generateFieldNames
protected void generateFieldNames()Description copied from class:ObjectForm
Generate field names. This method is generally not overridden.- Overrides:
generateFieldNames
in classObjectForm<T>
-
getFieldGetMethod
Description copied from class:ObjectForm
Get the field's "get" method. The default implementation checks for both getXXX and isXXX methods.- Overrides:
getFieldGetMethod
in classObjectForm<T>
- Parameters:
fieldName
- Name of the field- Returns:
- Field's "get" method (if method is found, it will return
null
).
-
getFieldSetMethod
Description copied from class:ObjectForm
Get the field's "set" method. The default implementation checks the availability of setXXX method.- Overrides:
getFieldSetMethod
in classObjectForm<T>
- Parameters:
fieldName
- Name of the fieldgetMethod
- "get" method of this field (determined throughObjectForm.getFieldGetMethod(String)
)- Returns:
- Field's "set" method (if method is found, it will return
null
).
-
createField
protected com.vaadin.flow.component.HasValue<?,?> createField(String fieldName, Class<?> fieldType, String label) Description copied from class:ObjectForm
Create the field for the particular name. Default implementation try to obtain the value from the "field creator" (ObjectFieldCreator.createField(String, Class, String)
).- Overrides:
createField
in classObjectForm<T>
- Parameters:
fieldName
- Name of the fieldfieldType
- Type of the field's valuelabel
- Label- Returns:
- Field
-
includeField
Description copied from class:ObjectForm
Check whether field should be included in the form or not.- Overrides:
includeField
in classObjectForm<T>
- Parameters:
fieldName
- Name of the field.- Returns:
- True or false. (Default return value is
true
).
-
getFieldOrder
Description copied from class:ObjectForm
Get the order in which a field to appear in the form. Any integer value can be returned and the field is placed in the form in ascending order of the values returned by this method. Default implementation try to obtain the value from the "field creator" (ObjectFieldCreator.getFieldOrder(String)
).- Overrides:
getFieldOrder
in classObjectForm<T>
- Parameters:
fieldName
- Name of the field- Returns:
- Field order.
-
createObjectInstance
Create an instance of the data object. Default implementation tries to invoke the default constructor to create an instance. Fixed values will be set to the created object instance by invokingAbstractDataEditor.setFixedValues(Object)
.- Overrides:
createObjectInstance
in classAbstractForm<T>
- Returns:
- Newly created data object.
-
customizeField
Description copied from class:ObjectForm
Customize a field. This method is invoked when a field is created. One may do some customization here.- Overrides:
customizeField
in classObjectForm<T>
- Parameters:
fieldName
- Name of the fieldfield
- Field
-
handleValueSetError
protected boolean handleValueSetError(String fieldName, com.vaadin.flow.component.HasValue<?, ?> field, Object fieldValue, Object objectValue, Throwable error) Description copied from class:ObjectForm
Handle errors while setting (committing) values. Default implementation returnstrue
without doing anything.- Overrides:
handleValueSetError
in classObjectForm<T>
- Parameters:
fieldName
- Name of the fieldfield
- FieldfieldValue
- Field's value that's being committedobjectValue
- Value currently being in the objecterror
- Error occurred while setting the value- Returns:
- Whether the error situation is handled or not.
-