Interface UIWidgetFactory<T extends UIWidget>
-
- Type Parameters:
T- the type of widgets to be instantiated.
- All Known Implementing Classes:
UIWidgetFileUploadFactory
public interface UIWidgetFactory<T extends UIWidget>This interface defines a factory to create a custom widget. This factory is called each time a new instance of a widget must be created. A concrete implementation can be used in two contexts: in the configuration of a data model element, or directly in a form using the methodUIFormWriter.newCustomWidget(Path, UIWidgetFactory).Definition in the data model
The factory must be declared under the element
xs:annotation/xs:appinfo/osd:defaultView:<widget osd:class="com.foo.MyWidgetFactory"/>where
com.foo.MyWidgetFactoryis the fully qualified name of the class implementing this interface. It is also possible to set additional JavaBean properties:<widget osd:class="com.foo.MyWidgetFactory"> <param1>...</param1> <param2>...</param2> </widget>where
param1andparam2are JavaBean properties of the specified class.For more information, see the JavaBean specifications.
Life cycle
- If the concrete factory is referenced by a data model element, then,
when the data model is loaded:
- the specified factory class is instantiated through its default
constructor and the setters of the JavaBean properties
are called (in the example above,
setParam1(...)andsetParam2(...)); - then, the method
setup(WidgetFactorySetupContext)is called for the new instance).
- the specified factory class is instantiated through its default
constructor and the setters of the JavaBean properties
are called (in the example above,
- During the operational phase: the method
newInstance(WidgetFactoryContext)is called each time an associated element has to be displayed in the user interface.
- Since:
- 5.8.0
- See Also:
UICustomWidget,UIFormWriter.newCustomWidget(Path, UIWidgetFactory)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TnewInstance(WidgetFactoryContext aContext)Creates and returns a new instance of widget.voidsetup(WidgetFactorySetupContext aContext)Checks and prepares this instance if called while the data model is being loaded.
-
-
-
Method Detail
-
newInstance
T newInstance(WidgetFactoryContext aContext)
Creates and returns a new instance of widget.
-
setup
void setup(WidgetFactorySetupContext aContext)
Checks and prepares this instance if called while the data model is being loaded.Do note that during this step, all models may not be properly loaded. Thus, the repository should not be accessed during this step.
This method is not called by the method
UIFormWriter.newCustomWidget(Path, UIWidgetFactory).
-
-