Interface IPluginFormElementWidget

  • All Superinterfaces:
    IFCPlugin, IFCRemoteSyncPlugin, INamedUiElement, INameProviding, ITransferable, Serializable

    public interface IPluginFormElementWidget
    extends IFCRemoteSyncPlugin
    Interface for plugins to integrate own form element widgets within the form designer. These widgets are added to the drawer panel that usually contain the built-in standard items such as input fields and select elements.

    To create a form element widget, you need to create class that implements IXItemWidget. This class contains the server side logic of the plugin, such as how the HTML is rendered and how the data is validated. Optionally, you can also create a JavaScript file that will be loaded when the form designer is opened. This JavaScript file can contain custom client side logic. It can be used, for example, when you need to declare additional item properties or when you need custom property editors in the form designer.

    See the node module fc-form-designer (available via the custom XIMA npm registry) for more details regarding the contents of the JavaScript file. That module contains the TypeScript declaration files with the client side API.

    Author:
    XIMA MEDIA GmbH
    • Method Detail

      • getCssData

        default String getCssData()
        Return the path to the CSS file that is loaded when the form designer is opened. This file should contain additional styles required for the widget within the form designer.

        The default implementation reads the #getCssPath() via {getResourceAsString(String).

        Returns:
        The contents of the CSS to include in the form designer.
      • getCssPath

        default String getCssPath()
        Return the path to the CSS file that is loaded when the form designer is opened. This file should contain additional styles required for the widget within the form designer. The returned path must point to an existing resource in the classpath of this plugin.

        The default implementation expects the resource to be located at includes/designer/designer-min.css.

        Returns:
        The path where the CSS resource is located.
      • getJavaScriptData

        default String getJavaScriptData()
        Returns the contents of the JavaScript file that is loaded when the form designer is opened . This file should contain the setup logic for the designer, such as adding custom properties or editors.

        The default implementation reads the #getJavaScriptPath() via {getResourceAsString(String).

        See the node module fc-form-designer (available via the custom XIMA npm registry) for more details regarding the contents of the JavaScript file. That module contains the TypeScript declaration files with the client side API.

        Returns:
        The contents of the JavacScript to include in the form designer.
      • getJavaScriptPath

        default String getJavaScriptPath()
        Returns the path to the JavaScript file that is loaded when the form designer is opened. This file should contain the setup logic for the designer, such as adding custom properties or editors. The returned path must point to an existing resource in the classpath of this plugin.

        The default implementation expects the resource to be located at includes/designer/designer-min.js.

        See the node module fc-form-designer (available via the custom XIMA npm registry) for more details regarding the contents of the JavaScript file. That module contains the TypeScript declaration files with the client side API.

        Returns:
        The path where the JavaScript resource is located.
      • getResource

        default InputStream getResource​(String path)
        Reads the resource at the given path. The default implementation simply reads the resource at the given path from the class loader of this plugin. Normally you should not have to override this method.
        Parameters:
        path - The path from which to load the CSS file.
        Returns:
        The data with CSS resource.
      • getResourceAsString

        default String getResourceAsString​(String path)
        Reads the resource at the given path. The default implementation simply reads the resource at the given path from the class loader of this plugin. Normally you should not have to override this method.
        Parameters:
        path - The path from which to load the CSS file.
        Returns:
        The data with CSS resource.
      • getWidgets

        List<Class<? extends IXItemWidget>> getWidgets​(Locale locale)
        Parameters:
        locale - Current locale.
        Returns:
        The list of all available form element widgets.
      • isAvailableInDesigner

        default boolean isAvailableInDesigner​(IPluginFormElementWidgetIsAvailableInDesignerParams params)
        Optional method for checking whether a widget is available in the form designer. This method is called when a new form designer is opened, and is passed the current project being edited, as well as the widget to check. It is called once for each widget returned by getWidgets(Locale). When this method returns false, the widget is not shown in the list of available elements in the designer. When the form already contains an instance of the widget, an error message is shown to the user that the widget could not be found.

        This method lets you omit certain widgets under certain circumstances. The default implementation simply returns true.

        Parameters:
        params - Parameters with the widget to check and the current project being edited.
        Returns:
        Whether the widget is available.
        Since:
        7.0.0