Class UIForm
Note: Since 5.9.0, a more advanced user interface
can be implemented to replace the default model-driven record form.
For more information, see UserServiceRecordFormFactory
.
Definition in the data model
A specific record view may be associated with the default view of a table.
The component must be declared under the element
<osd:table>
. For example:
where<xs:annotation> <xs:appinfo> <osd:table> <primaryKeys>/id</primaryKeys> <recordForm osd:class="com.foo.MyUIForm"/> <osd:table> <xs:appinfo> </xs:annotation>
com.foo.MyUIForm
is
the fully qualified name of a class implementing this interface.
The declaration may also use parameters:
where<recordForm class="com.foo.MyUIForm"> <param1>...</param1> <param2>...</param2> </recordForm>
param1
and param2
are JavaBean properties
of the com.foo.MyUIForm
class.
For more information, see the JavaBean specification.
Life cycle
When a session of EBX® generates HTTP responses involving the record view:
- The class specified is instantiated through its default constructor and the setter properties of the JavaBean
are called (in the example above,
setParam1(...)
andsetParam2(...)
). - The method
defineHeader(UIFormHeader, UIFormContext)
is invoked. - The method
defineBody(UIFormBody, UIFormContext)
is invoked. - Finally, the method
defineBottomBar(UIFormBottomBar, UIFormContext)
is invoked.
Once all these definition methods have been invoked, the specified contents are then written in the following order:
- the header
- the body (invoking the method
UIFormPane.writePane(UIFormPaneWriter, UIFormContext)
) - the bottom bar
Multi-threading
The EBX® user interface ensures that an instance of this class is executed by no more than one thread at any given time.
- Since:
- 5.3.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
defineBody
(UIFormBody aBody, UIFormContext aContext) Specifies the body of the form.void
defineBottomBar
(UIFormBottomBar aBottomBar, UIFormContext aContext) Specifies the bottom bar of the form.void
defineHeader
(UIFormHeader aHeader, UIFormContext aContext) Specifies the header of the form.boolean
shallValidateForm
(UIFormContext aContext) Returnstrue
if the user input associated with this form will be validated; returnsfalse
if the local user input related to the current form is ignored beyond the execution of this method.void
validateForm
(UIFormRequestContext aContext) This method offers the opportunity to perform custom validation on user input.
-
Constructor Details
-
UIForm
public UIForm()
-
-
Method Details
-
defineHeader
Specifies the header of the form. Default implementation does nothing, that is, default header will be displayed.For details on when the EBX® user interface invokes this method, see Life cycle.
-
defineBody
Specifies the body of the form. Default implementation does nothing, that is, the default body will be displayed.For details on when the EBX® user interface invokes this method, see Life cycle.
-
defineBottomBar
Specifies the bottom bar of the form. Default implementation does nothing, that is, the default bottom bar will be displayed.For details on when the EBX® user interface invokes this method, see Life cycle.
-
validateForm
This method offers the opportunity to perform custom validation on user input. It typically does so by retrieving the HTTP parameter values from the incoming request and checking them, so as to supply the validation context with new, converted values. It can also add error messages.This method is called only if the method
shallValidateForm()
has returnedtrue
and after all other components have been validated (built-in and UI bean alike).Default implementation does nothing.
- Since:
- 5.5.0
- See Also:
-
shallValidateForm
Returnstrue
if the user input associated with this form will be validated; returnsfalse
if the local user input related to the current form is ignored beyond the execution of this method.More precisely, user input validation is performed in five steps:
- All input components are validated either from a UI bean or automatically generated components.
- The constraints defined by data model nodes are executed, potentially adding their own error messages.
- This
shallValidateForm
method is invoked and decides whether the remaining steps below are to be invoked (it can also perform some validation itself). - If this method returns
true
: the methodvalidateForm()
is invoked. For example, it can perform user interface-specific checks. - Finally, if no errors block submission, the updates performed on the context are committed to the current dataspace. If there are errors, the page is redisplayed with error messages.
Default implementation always returns
true
.- Since:
- 5.5.0
- See Also:
-