public abstract class UISimpleCustomWidget extends UICustomWidget
Custom widgets handling whole list elements must extend UIListCustomWidget
.
Along with the widget itself, a factory must be provided. Such a factory must implement UIWidgetFactory
.
For instance, for a custom widget MyCustomWidget
, it is recommended to create the associated
factory MyCustomWidgetFactory
.
Like a UIBeanEditor
, a custom widget can be specified as the default view of a data model element
(a field or a group that is terminal or under a terminal group).
In addition, thanks to the fact that a factory is now specified, it becomes possible to control
whether the specified widget is relevant regarding the data model element.
If this is not the case, an error can be added at the data model compilation
(see UIWidgetFactory.setup(WidgetFactorySetupContext)
.
A custom widget can be specifically instantiated and embedded in custom layouts (UIForm
),
custom user services (UserService
) and in other custom widgets.
UIListCustomWidget
,
UIWidgetFactory
Constructor and Description |
---|
UISimpleCustomWidget(Path aNodePath,
WidgetFactoryContext aContext) |
UISimpleCustomWidget(WidgetFactoryContext aContext) |
Modifier and Type | Method and Description |
---|---|
void |
validate(WidgetValidationContext aValidationContext)
Offers the opportunity to perform custom validations upon user input.
|
abstract void |
write(WidgetWriter aWriter,
WidgetDisplayContext aContext)
This method defines how to display the widget.
|
isDisplayingCustomWidgetValidationMessage, isEditorDisabled, setEditorDisabled
public UISimpleCustomWidget(WidgetFactoryContext aContext)
public UISimpleCustomWidget(Path aNodePath, WidgetFactoryContext aContext)
public abstract void write(WidgetWriter aWriter, WidgetDisplayContext aContext)
public void validate(WidgetValidationContext aValidationContext)
A common use case consists of retrieving the HTTP parameter values from the incoming context, checking them, then supplying the validation context with the converted values. Error messages can be supplied to the validation context if needed.
Default implementation does nothing.
This method is not called if UICustomWidget.isEditorDisabled()
returns true.
This method is not called by the Ajax validation mechanism. See
UIAtomicWidget.setAjaxPrevalidationEnabled(boolean)
for more information.